'hal_inline' Dialectlink
IREE inline HAL interop runtime module dialect.
Low-level dialect for limited in-process ABI interop with the full HAL. Only operates synchronously, single-threaded, and on host-local buffers. Use the full HAL for all other cases.
This dialect can be used alongside the full HAL but is intended for use in
standalone configurations or paired with the hal_loader
dialect which also
carries the same usage restrictions.
See hal_inline.imports.mlir
for the full list of exported functions.
- 'hal_inline' Dialect
- Operations
- Buffer ops
- hal_inline.buffer.allocate.initialized (HAL::Inline::BufferAllocateInitializedOp)
- hal_inline.buffer.allocate (HAL::Inline::BufferAllocateOp)
- hal_inline.buffer.length (HAL::Inline::BufferLengthOp)
- hal_inline.buffer.storage (HAL::Inline::BufferStorageOp)
- hal_inline.buffer.subspan (HAL::Inline::BufferSubspanOp)
- hal_inline.buffer.wrap (HAL::Inline::BufferWrapOp)
- Buffer view ops
- hal_inline.buffer_view.assert (HAL::Inline::BufferViewAssertOp)
- hal_inline.buffer_view.buffer (HAL::Inline::BufferViewBufferOp)
- hal_inline.buffer_view.create (HAL::Inline::BufferViewCreateOp)
- hal_inline.buffer_view.dim (HAL::Inline::BufferViewDimOp)
- hal_inline.buffer_view.element_type (HAL::Inline::BufferViewElementTypeOp)
- hal_inline.buffer_view.encoding_type (HAL::Inline::BufferViewEncodingTypeOp)
- hal_inline.buffer_view.rank (HAL::Inline::BufferViewRankOp)
- hal_inline.buffer_view.trace (HAL::Inline::BufferViewTraceOp)
- Device ops
- Buffer ops
- Operations
Operationslink
Buffer opslink
Ops for !hal.buffer
/ iree_hal_buffer_t
.
hal_inline.buffer.allocate.initialized
(HAL::Inline::BufferAllocateInitializedOp)link
Buffer allocation with cloning
Syntax:
operation ::= `hal_inline.buffer.allocate.initialized` `source` `(` $source `:` type($source) `)` `` `[` $offset `,` $length `]`
`alignment` `(` $minimum_alignment `)`
`:` custom<SizeAwareType>(type($result), ref($length)) `in` type($storage)
attr-dict-with-keyword
Allocates a buffer with a copy of the provided contents.
Interfaces: OpAsmOpInterface
, SizeAwareOpInterface
Operands:link
Operand | Description |
---|---|
minimum_alignment |
index |
source |
a reference counted byte buffer |
offset |
index |
length |
index |
Results:link
Result | Description |
---|---|
result |
buffer |
storage |
a reference counted byte buffer |
hal_inline.buffer.allocate
(HAL::Inline::BufferAllocateOp)link
Empty buffer allocation operation
Syntax:
operation ::= `hal_inline.buffer.allocate` `alignment` `(` $minimum_alignment `)`
`:` custom<SizeAwareType>(type($result), $allocation_size) `in` type($storage)
attr-dict-with-keyword
Allocates a buffer of the given size. The size of the buffer returned may be larger than the requested size if the allocator has specific alignment requirements or minimum allocation sizes.
Interfaces: OpAsmOpInterface
, SizeAwareOpInterface
Operands:link
Operand | Description |
---|---|
minimum_alignment |
index |
allocation_size |
index |
Results:link
Result | Description |
---|---|
result |
buffer |
storage |
a reference counted byte buffer |
hal_inline.buffer.length
(HAL::Inline::BufferLengthOp)link
Buffer byte length accessor
Syntax:
operation ::= `hal_inline.buffer.length` `<` $buffer `:` type($buffer) `>`
`:` type($result)
attr-dict-with-keyword
Returns the allocated size of a buffer in bytes. May be less than the underlying buffer allocation if this is a subspan or view into another buffer.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
, OpAsmOpInterface
Effects: MemoryEffects::Effect{}
Operands:link
Operand | Description |
---|---|
buffer |
buffer |
Results:link
Result | Description |
---|---|
result |
index |
hal_inline.buffer.storage
(HAL::Inline::BufferStorageOp)link
Buffer backing storage accessor
Syntax:
operation ::= `hal_inline.buffer.storage` `<` $buffer `:` type($buffer) `>`
`:` type($storage)
attr-dict-with-keyword
Returns the host backing storage of the HAL buffer as a subspan limited to to the buffer's logical range (meaning that byte 0 of the returned buffer is byte 0 of the HAL buffer).
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
, OpAsmOpInterface
Effects: MemoryEffects::Effect{}
Operands:link
Operand | Description |
---|---|
buffer |
buffer |
Results:link
Result | Description |
---|---|
storage |
a reference counted byte buffer |
hal_inline.buffer.subspan
(HAL::Inline::BufferSubspanOp)link
Buffer subspan operation
Syntax:
operation ::= `hal_inline.buffer.subspan` `<` $source_buffer `:` type($source_buffer) `>`
`` `[` $source_offset `,` $length `]`
`:` type($result)
attr-dict-with-keyword
Returns a reference to a subspan of the buffer.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
, OpAsmOpInterface
, SizeAwareOpInterface
Effects: MemoryEffects::Effect{}
Operands:link
Operand | Description |
---|---|
source_buffer |
buffer |
source_offset |
index |
length |
index |
Results:link
Result | Description |
---|---|
result |
buffer |
hal_inline.buffer.wrap
(HAL::Inline::BufferWrapOp)link
Host buffer wrapping operation
Syntax:
operation ::= `hal_inline.buffer.wrap` `source` `(` $source `:` type($source) `)` `` `[` $offset `,` $length `]`
`:` type($result)
attr-dict-with-keyword
Tries wrapping a !hal.buffer around host memory backed by the given byte buffer.
Interfaces: OpAsmOpInterface
, SizeAwareOpInterface
Operands:link
Operand | Description |
---|---|
source |
a reference counted byte buffer |
offset |
index |
length |
index |
Results:link
Result | Description |
---|---|
result |
buffer |
Buffer view opslink
Ops for !hal.buffer_view
/ iree_hal_buffer_view_t
.
hal_inline.buffer_view.assert
(HAL::Inline::BufferViewAssertOp)link
Buffer view contents assertion
Syntax:
operation ::= `hal_inline.buffer_view.assert` `<` $buffer_view `:` type($buffer_view) `>`
`message` `(` $message `)`
`shape` `(` `[` $shape `]` `)`
`type` `(` $element_type `)`
`encoding` `(` $encoding_type `)`
attr-dict-with-keyword
Asserts that the buffer view contains a data compatible tensor with the
given encoding. Program execution will abort as if std.assert
had been
used.
Attributes:link
Attribute | MLIR Type | Description |
---|---|---|
message | ::mlir::StringAttr | string attribute |
Operands:link
Operand | Description |
---|---|
buffer_view |
buffer_view |
element_type |
32-bit signless integer |
encoding_type |
32-bit signless integer |
shape |
variadic of index |
hal_inline.buffer_view.buffer
(HAL::Inline::BufferViewBufferOp)link
Buffer view buffer accessor
Syntax:
operation ::= `hal_inline.buffer_view.buffer` `<` $buffer_view `:` type($buffer_view) `>`
`:` type($result)
attr-dict-with-keyword
Returns the buffer backing this view's contents.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
, OpAsmOpInterface
Effects: MemoryEffects::Effect{}
Operands:link
Operand | Description |
---|---|
buffer_view |
buffer_view |
Results:link
Result | Description |
---|---|
result |
buffer |
hal_inline.buffer_view.create
(HAL::Inline::BufferViewCreateOp)link
Buffer view reference initializer
Syntax:
operation ::= `hal_inline.buffer_view.create` `buffer` `(` $source_buffer `:` type($source_buffer) `)`
`` `[` $source_offset `,` $source_length `]`
`shape` `(` `[` $shape `]` `)`
`type` `(` $element_type `)`
`encoding` `(` $encoding_type `)`
`:` type($result)
attr-dict-with-keyword
Creates a reference to a buffer with a particular shape and element type. The buffer is not copied and both the original and view references must be synchronized. This makes it easier to associate commonly-carried metadata along with the contents.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
, OpAsmOpInterface
Effects: MemoryEffects::Effect{}
Operands:link
Operand | Description |
---|---|
source_buffer |
buffer |
source_offset |
index |
source_length |
index |
element_type |
32-bit signless integer |
encoding_type |
32-bit signless integer |
shape |
variadic of index |
Results:link
Result | Description |
---|---|
result |
buffer_view |
hal_inline.buffer_view.dim
(HAL::Inline::BufferViewDimOp)link
Buffer view dimension value query
Syntax:
operation ::= `hal_inline.buffer_view.dim` `<` $buffer_view `:` type($buffer_view) `>`
`` `[` $index `]`
`:` type($result)
attr-dict-with-keyword
Returns the value of the given dimension.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:link
Attribute | MLIR Type | Description |
---|---|---|
index | ::mlir::IntegerAttr | index attribute |
Operands:link
Operand | Description |
---|---|
buffer_view |
buffer_view |
Results:link
Result | Description |
---|---|
result |
index |
hal_inline.buffer_view.element_type
(HAL::Inline::BufferViewElementTypeOp)link
Buffer view element type query
Syntax:
operation ::= `hal_inline.buffer_view.element_type` `<` $buffer_view `:` type($buffer_view) `>`
`:` type($result)
attr-dict-with-keyword
Returns the element type of the buffer view.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:link
Operand | Description |
---|---|
buffer_view |
buffer_view |
Results:link
Result | Description |
---|---|
result |
32-bit signless integer |
hal_inline.buffer_view.encoding_type
(HAL::Inline::BufferViewEncodingTypeOp)link
Buffer view encoding type query
Syntax:
operation ::= `hal_inline.buffer_view.encoding_type` `<` $buffer_view `:` type($buffer_view) `>`
`:` type($result)
attr-dict-with-keyword
Returns the encoding type of the buffer view.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:link
Operand | Description |
---|---|
buffer_view |
buffer_view |
Results:link
Result | Description |
---|---|
result |
32-bit signless integer |
hal_inline.buffer_view.rank
(HAL::Inline::BufferViewRankOp)link
Buffer view rank query
Syntax:
operation ::= `hal_inline.buffer_view.rank` `<` $buffer_view `:` type($buffer_view) `>`
`:` type($result)
attr-dict-with-keyword
Returns the rank of the buffer view.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:link
Operand | Description |
---|---|
buffer_view |
buffer_view |
Results:link
Result | Description |
---|---|
result |
index |
hal_inline.buffer_view.trace
(HAL::Inline::BufferViewTraceOp)link
Trace value(s) operation
Syntax:
operation ::= `hal_inline.buffer_view.trace` $key `=`
$operands `:` type($operands)
attr-dict-with-keyword
Traces out to a runtime trace sink (console, log file, etc) the given buffer views and titles them with the given key. The key is informational only and useful for titling/marking specific sets of buffers for easier searching.
Attributes:link
Attribute | MLIR Type | Description |
---|---|---|
key | ::mlir::StringAttr | string attribute |
Operands:link
Operand | Description |
---|---|
operands |
variadic of buffer_view |
Device opslink
Ops for !hal.device
/ iree_hal_device_t
.
hal_inline.device.query
(HAL::Inline::DeviceQueryOp)link
Returns a runtime configuration parameter from the device
Syntax:
operation ::= `hal_inline.device.query` `key` `(` $category `:` `` `:` $key `)`
`:` type($ok) `,` type($value)
(`=` $default_value^)?
attr-dict-with-keyword
Queries a device configuration parameter with the given key. Returns a status indicating whether the pair was recognized/available and if it was the value converted to the specified type. Queries must return the same value for the lifetime of the module though may vary from run to run.
This is roughly equivalent to the sysconf
linux syscall
(https://man7.org/linux/man-pages/man3/sysconf.3.html) in that the exact
set of keys available and their interpretation is target-dependent.
Users of the op must check the ok
result before using the value as what
set of keys is available may change over time. If in doubt: don't use this.
Each key used adds additional versioning and testing complexity as runtime
code path changes will explode combinatorially and should be treated with as
much care as a binary file format change. Keys should be prefixed with ex.
when experimental indicating that they are not expected to be present
forever; all non-experimental keys should be vetted.
Well-known keys: (none yet)
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:link
Attribute | MLIR Type | Description |
---|---|---|
category | ::mlir::StringAttr | string attribute |
key | ::mlir::StringAttr | string attribute |
default_value | ::mlir::Attribute | any attribute |
Results:link
Result | Description |
---|---|
ok |
1-bit signless integer |
value |
any type |