Skip to main content

Module vulkan_dispatch

Module vulkan_dispatch 

Source
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:

  1. The executor’s fuel_dispatch::pipelined::execute_work_item output- allocation match arm sees BackendId::Vulkan and allocates via fuel_vulkan_backend::VulkanBackend::alloc_bytes_handle (V.1.B).
  2. The kernel wrapper here reads inputs (also VulkanStorageBytes with backend handle attached), pulls the backend Arc from the first input, and calls fuel_vulkan_backend::VulkanBackend::binary_add_f32_bytes to dispatch.
  3. The Slang binary.spv kernel 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
arg_reduce
attention
binary
binary_bf16
binary_f16
binary_f64
cast
cast_f8e4m3
clamp
concat
conv2d
cumsum
flash_attn
flip
gather
index_add
indexing
masked_fill
matmul
norm
pad
powi
qmatmul
reduce
roll
scatter_add
softmax
triangular
unary
unary_bf16
unary_f16
unary_f64
write_slice
write_slice_rotating

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 (see fuel_dispatch::pipelined::WorkItemKind::Copy); the wrapper calls VulkanBackend::download_bytes on 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 shared KernelBindingTable. 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.