Expand description
Dispatch wrappers + registration for Vulkan-backed kernels.
Sibling to baracuda_dispatch (CUDA) and the CPU dispatch in
dispatch.rs. Each kernel registers as an alternative at the
(op_kind, dtypes, BackendId::Vulkan) decision point in the
shared KernelBindingTable.
§V.1 status
Phase 7.6 step 9c Vulkan catch-up V.1.C — the proof-of-life
milestone. One op (Add f32) wired end-to-end through the
pipelined-executor binding-table dispatch:
- The executor’s
fuel_dispatch::pipelined::execute_work_itemoutput- allocation match arm seesBackendId::Vulkanand allocates viafuel_vulkan_backend::VulkanBackend::alloc_bytes_handle(V.1.B). - The kernel wrapper here reads inputs (also
VulkanStorageByteswith backend handle attached), pulls the backend Arc from the first input, and callsfuel_vulkan_backend::VulkanBackend::binary_add_f32_bytesto dispatch. - The Slang
binary.spvkernel runs on the Vulkan device; the pre-allocated output buffer carries the result.
V.2 fans out registrations to the ~25 already-compiled SPIR-V
kernels in fuel-vulkan-kernels. V.3 writes new Slang for the
kernel families CUDA has and Vulkan doesn’t.
Modules§
- affine
- Vulkan dispatch wrappers for
y = mul * x + add, per dtype. - arg_
reduce - Vulkan dispatch wrappers for argmax / argmin reductions, per dtype.
- attention
- Vulkan dispatch wrappers for rotary position embedding (RoPE), per dtype.
- binary
- Vulkan dispatch wrappers for f32 elementwise binary ops (add, sub, mul, div, maximum, minimum).
- binary_
bf16 - Vulkan dispatch wrappers for bf16 elementwise binary ops (add, sub, mul, div, maximum, minimum).
- binary_
f16 - Vulkan dispatch wrappers for f16 elementwise binary ops (add, sub, mul, div, maximum, minimum).
- binary_
f64 - Vulkan dispatch wrappers for f64 elementwise binary ops.
- cast
- Vulkan dispatch wrappers for dtype casts between f32 and f64 / half precision.
- cast_
f8e4m3 - Vulkan dispatch wrappers for casts between F8E4M3 and F32 / F16 / BF16.
- clamp
- Vulkan dispatch wrappers for
y = clamp(x, lo, hi)(f32). - concat
- Vulkan dispatch wrappers for concatenation along an axis, per dtype.
- conv2d
- Vulkan dispatch wrappers for 2-D convolution, per dtype.
- cumsum
- Vulkan dispatch wrappers for cumulative sum, per dtype.
- flash_
attn - Vulkan dispatch wrappers for FlashAttention-shape attention forward and backward.
- flip
- Vulkan dispatch wrappers for flip along an axis.
- gather
- Vulkan dispatch wrappers for gather along a dimension.
- index_
add - Vulkan dispatch wrappers for
index_addalong a dimension, per dtype. - indexing
- Vulkan dispatch wrappers for
index_select, per dtype. - masked_
fill - Vulkan dispatch wrappers for masked fill with a Bool mask.
- matmul
- Vulkan dispatch wrappers for matrix multiplication entry points, per input/output dtype combination.
- norm
- Vulkan dispatch wrappers for last-dimension normalisation (RMSNorm and LayerNorm, forward and backward), per dtype.
- pad
- Vulkan dispatch wrappers for padding forward/backward.
- powi
- Vulkan dispatch wrappers for integer power,
y = x^exp(f32). - qmatmul
- Vulkan dispatch wrappers for quantized matmul (only the quant types with a Vulkan kernel; others return an error so the route picker falls back to CPU).
- reduce
- Vulkan dispatch wrappers for sum / max / min / mean reductions.
- roll
- Vulkan dispatch wrappers for roll along an axis.
- scatter_
add - Vulkan dispatch wrappers for
scatter_addalong a dimension, per dtype. - softmax
- Vulkan dispatch wrappers for softmax over the last dimension, forward and backward, per dtype.
- triangular
- Vulkan dispatch wrappers for
triu/tril. - unary
- Vulkan dispatch wrappers for f32 elementwise unary ops (neg, sqr, sqrt, exp, log, sin, cos, tanh, …).
- unary_
bf16 - Vulkan dispatch wrappers for bf16 elementwise unary ops (neg, sqr, sqrt, exp, log, sin, cos, tanh, …).
- unary_
f16 - Vulkan dispatch wrappers for f16 elementwise unary ops.
- unary_
f64 - Vulkan dispatch wrappers for f64 elementwise unary ops.
- write_
slice - Vulkan dispatch wrappers for in-place slice write into a destination buffer (4-byte element widths).
- write_
slice_ rotating - Vulkan dispatch wrappers for rotating slice write for sliding-window K/V caches (rotating axis must be axis 0).
Functions§
- copy_
to_ cpu_ vulkan - Dispatch wrapper for
(OpKind::Copy, [T, T], Vulkan)— D2H from a Vulkan source storage into a freshly-allocated CPU output. The executor allocates the CPU output before this wrapper runs (seefuel_dispatch::pipelined::WorkItemKind::Copy); the wrapper callsVulkanBackend::download_byteson the input’s attached backend handle and copies the result into the CPU storage. - register_
vulkan_ kernels - Register every Vulkan kernel wrapper against its
(OpKind, dtypes, BackendId::Vulkan)decision-point key in the sharedKernelBindingTable. Each wrapper appears as an alternative alongside any CPU / CUDA / future-backend registrations at the same key. The route picker (architecture v1.0 §04) selects among them at plan time based on input residency + telemetry.