Dialect reference¶
hexir¶
Graph level. Tensors, value semantics.
Op |
Form |
Lowers? |
|---|---|---|
|
|
yes |
|
|
yes, to |
|
|
yes |
|
|
yes |
|
|
yes, to |
|
|
bridge to |
|
function with a body |
yes |
|
declared only |
Ops in the last row parse and verify but have no lowering. Using one gives a clear error rather than silently wrong code.
Attributes¶
device"cpu"or"cuda". Written by the partition pass, copied by every lowering.
hexir.call_tir¶
The only way from the graph level to the kernel level.
%r = hexir.call_tir @matmul(%a, %b)
: (tensor<2x2xf64>, tensor<2x2xf64>) -> tensor<2x2xf64>
Its verifier enforces destination passing: the callee must take one buffer per argument, plus one for the result.
hextir¶
Kernel level. Buffers, explicit loops.
Op |
Purpose |
|---|---|
|
a kernel; last argument is the destination |
|
terminator of a |
|
a named, schedulable region |
|
one loop level, carrying its kind |
|
terminator of a |
|
a kernel-local buffer |
|
read one element |
|
write one element |
hextir.for¶
hextir.for "parallel" %c0 to %cN step %c1 { ... }
hextir.for "thread_binding" %c0 to %cN step %c1 bind "threadIdx.x" { ... }
kind is one of serial, parallel, vectorized, unrolled,
thread_binding. This attribute is the schedule — a scheduling pass changes
it rather than restructuring the loop nest.
bind names the GPU axis, and is only meaningful for thread_binding.
Attributes¶
devicewhich device this kernel targets.
hexir.kernel"matmul","add"or"relu". Says what the kernel computes without anyone having to match on its body. The.hxbserializer turns this into a descriptor.