Skip to content

'hal_loader' Dialectlink

IREE HAL inline executable loader runtime module dialect.

Low-level dialect for dynamically loading executables and dispatching work. 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 conjunction with the hal_inline dialect which also carries the same usage restrictions.

See hal_loader.imports.mlir for the full list of exported functions.

Operationslink

Executable opslink

Ops for !hal.executable / iree_hal_executable_t.

hal_loader.executable.dispatch (HAL::Loader::ExecutableDispatchOp)link

Inline executable dispatch operation.

Syntax:

operation ::= `hal_loader.executable.dispatch` `executable` `(` $executable `:` type($executable) `)`
              `` `[` $entry_point `]`
              `workgroups` `(` `[`
              $workgroup_x `,`
              $workgroup_y `,`
              $workgroup_z
              `]` `)`
              (`constants` `(` `[` $constants^ `]` `)`)?
              `bindings` `(` `[`
              custom<DispatchBindings>($binding_buffers,
              type($binding_buffers),
              $binding_offsets,
              $binding_lengths)
              `]` `)`
              attr-dict-with-keyword

Dispatches execution to an executable entry point with the given parameters.

Traits: AttrSizedOperandSegments

Operands:link
Operand Description
executable executable
entry_point 64-bit signless integer
workgroup_x index
workgroup_y index
workgroup_z index
constants variadic of 32-bit signless integer
binding_buffers variadic of A reference counted byte buffer.
binding_offsets variadic of index
binding_lengths variadic of index

hal_loader.executable.export.ordinal (HAL::Loader::ExecutableExportOrdinalOp)link

Executable export ordinal lookup pseudo-op.

Syntax:

operation ::= `hal_loader.executable.export.ordinal` `target` `(` $entry_point `)`
              `:` type($result)
              attr-dict-with-keyword

Resolves an executable export ordinal to a value once ordinals have been assigned.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), OpAsmOpInterface, SymbolUserOpInterface

Effects: MemoryEffects::Effect{}

Attributes:link
AttributeMLIR TypeDescription
entry_point::mlir::SymbolRefAttrsymbol reference attribute
Results:link
Result Description
result index

hal_loader.executable.load (HAL::Loader::ExecutableLoadOp)link

Dynamically loads an executable.

Syntax:

operation ::= `hal_loader.executable.load` `format` `(` $format `)`
              `data` `(` $data `)`
              (`constants` `(` `[` $constants^ `]` `)`)?
              `:` type($result)
              attr-dict-with-keyword

Creates, loads, and dynamically links an executable.

Optional constants provide for specialization of the executable based on runtime-derived parameters.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), OpAsmOpInterface

Effects: MemoryEffects::Effect{}

Attributes:link
AttributeMLIR TypeDescription
format::mlir::StringAttrstring attribute
Operands:link
Operand Description
data A reference counted byte buffer.
constants variadic of 32-bit signless integer
Results:link
Result Description
result executable

hal_loader.executable.lookup.function (HAL::Loader::ExecutableLookupFunctionOp)link

Executable function lookup pseudo-op.

Syntax:

operation ::= `hal_loader.executable.lookup.function` `target` `(` $executable `:` type($executable) `)`
              `function` `(` $entry_point `)`
              `:` type($result)
              attr-dict-with-keyword

Resolves an executable export name to a runtime function id. The result is only meaningful for the executable operand and must be treated as opaque by compiler IR. The function reference is retained as a SymbolRefAttr so executable linking passes can rewrite it, but it may intentionally stop resolving after executable serialization strips the original export declarations.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), OpAsmOpInterface

Effects: MemoryEffects::Effect{}

Attributes:link
AttributeMLIR TypeDescription
entry_point::mlir::SymbolRefAttrsymbol reference attribute
Operands:link
Operand Description
executable executable
Results:link
Result Description
result 64-bit signless integer

hal_loader.executable.lookup (HAL::Loader::ExecutableLookupOp)link

Executable cache lookup pseudo-op.

Syntax:

operation ::= `hal_loader.executable.lookup` `executable` `(` $executable `)`
              `:` type($result)
              attr-dict-with-keyword

Used during conversion to provide a placeholder for a globally cached and possibly lazy-initialized executable.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), OpAsmOpInterface, SymbolUserOpInterface

Effects: MemoryEffects::Effect{}

Attributes:link
AttributeMLIR TypeDescription
executable::mlir::FlatSymbolRefAttrflat symbol reference attribute
Results:link
Result Description
result executable

hal_loader.executable.query_support (HAL::Loader::ExecutableQuerySupportOp)link

Queries whether an executable format is supported.

Syntax:

operation ::= `hal_loader.executable.query_support` `format` `(` $executable_format `)`
              `:` type($supported)
              attr-dict-with-keyword

Returns true if the given format is supported by the device loader. This does not guarantee that loading will succeed as the executable may require functionality that cannot be met my the hosting runtime environment.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), OpAsmOpInterface

Effects: MemoryEffects::Effect{}

Attributes:link
AttributeMLIR TypeDescription
executable_format::mlir::StringAttrstring attribute
Results:link
Result Description
supported 1-bit signless integer