irx.buffer

irx.buffer

Source: packages/irx/src/irx/buffer.py

title: Low-level buffer/view substrate model.
summary: >-
  Define the canonical IRx buffer owner and buffer view contract that Arx may
  target without introducing a user-facing scientific array API.

Functions

buffer_view_flags(ownership: BufferOwnership, mutability: BufferMutability, *, c_contiguous: bool=False, f_contiguous: bool=False) -> int

title: Build canonical buffer view flags.
parameters:
  ownership:
    type: BufferOwnership
  mutability:
    type: BufferMutability
  c_contiguous:
    type: bool
  f_contiguous:
    type: bool
returns:
  type: int

buffer_flags_include(flags: int, flag: int) -> bool

title: Return whether one buffer flag is set.
parameters:
  flags:
    type: int
  flag:
    type: int
returns:
  type: bool

buffer_view_is_readonly(flags: int) -> bool

title: Return whether a buffer view is readonly.
parameters:
  flags:
    type: int
returns:
  type: bool

buffer_view_has_validity_bitmap(flags: int) -> bool

title: Return whether a buffer view advertises a validity sidecar.
summary: >-
  This flag only says that the producer has separate validity metadata. It
  does not make generic buffer indexing null-aware.
parameters:
  flags:
    type: int
returns:
  type: bool

buffer_dtype_token(name: str) -> int

title: Return one canonical primitive dtype token.
parameters:
  name:
    type: str
returns:
  type: int

buffer_dtype_name(token: int) -> str

title: Return the canonical name for one primitive dtype token.
parameters:
  token:
    type: int
returns:
  type: str

buffer_dtype_handle(name: str) -> BufferHandle

title: Return one canonical primitive dtype token as a buffer handle.
parameters:
  name:
    type: str
returns:
  type: BufferHandle

buffer_view_ownership(flags: int) -> BufferOwnership | None

title: Return the explicit ownership state encoded in flags.
parameters:
  flags:
    type: int
returns:
  type: BufferOwnership | None

validate_buffer_view_metadata(metadata: BufferViewMetadata) -> tuple[str, ...]

title: Validate static buffer view metadata.
parameters:
  metadata:
    type: BufferViewMetadata
returns:
  type: tuple[str, Ellipsis]

Classes

BufferIndexBoundsPolicy(str, Enum)

title: Buffer view indexing bounds policy hook.
summary: >-
  DEFAULT performs semantic static-bounds rejection when analysis can prove
  the bounds and emits no runtime bounds helper yet. CHECKED and UNCHECKED
  are reserved for future lowering modes.

BufferOwnership(str, Enum)

title: Buffer view ownership state.

BufferMutability(str, Enum)

title: Buffer view mutability state.

BufferHandle

title: Static opaque handle reference for buffer descriptors.
summary: >-
  Model a pointer-valued handle for semantic validation and deterministic
  lowering. None means the handle is statically null.
attributes:
  address:
    type: int | None

Methods

is_null(self) -> bool
title: Return whether this handle is statically null.
returns:
  type: bool

BufferViewMetadata

title: Static metadata for one low-level buffer view descriptor.
summary: >-
  Represents the semantic contents of the canonical IRx buffer view. This
  is not a scientific array object; it is a plain descriptor shape.
attributes:
  data:
    type: BufferHandle
  owner:
    type: BufferHandle
  dtype:
    type: BufferHandle
  ndim:
    type: int
  shape:
    type: tuple[int, Ellipsis]
  strides:
    type: tuple[int, Ellipsis]
  offset_bytes:
    type: int
  flags:
    type: int