Skip to main content

Module emit

Module emit 

Source

Modules§

coopmat
cuda_c
cuda_c_fused
Fused CUDA-C kernels for the mega-pass — combine multiple kernel launches into one to reduce launch overhead and intermediate global memory traffic.
cuda_graph
CUDA-C lowering of the compute-graph IR — the second backend in one pass (plan §4, Phase 5). The same ComputeGraph that emit_graph_wgsl lowers to WGSL is lowered here to CUDA-C by a CudaCLowerer, with no per-kernel.id branches — both backends are just Lowerer impls walked by the one lower_graph driver.
df64
Double-single (df64) emulated double-precision GEMM in raw WGSL.
dxc
dxc_cache
DXC SPIR-V binary cache — avoids re-running DXC on identical HLSL source.
graph_hlsl
HLSL lowering of the portable compute-graph nodes (plan §4 / P7) — the fourth backend the one lower_graph driver walks. HlslLowerer implements the same Lowerer trait, emitting HLSL compute shaders for the portable native kit (Elementwise/Reduce/Broadcast) with the same binding ABI + math as the WGSL graph_ops kernels.
graph_msl
MSL (Metal) lowering of the portable compute-graph nodes (plan §4 / P7) — the third backend the one lower_graph driver walks, after WGSL and CUDA-C. MslLowerer implements the same Lowerer trait, emitting Metal for the portable native kit (Elementwise/Reduce/Broadcast) — same binding ABI + math as the WGSL graph_ops kernels, so a portable graph lowers to Metal with no per-id branch.
hlsl
hlsl_wave
msl
ptx
spirv
SPIR-V emission target.
wgsl

Structs§

CudaCLowerer
The CUDA-C Lowerer: walks a ComputeGraph and appends one CUDA-C kernel per node to source. The mirror of the WGSL WgslDelegateLowerer/WgslGraphLowerer.
GeneratedShader
HlslLowerer
The HLSL Lowerer: appends one HLSL kernel per portable node to source.
MslLowerer
The MSL Lowerer: appends one Metal kernel per portable node to source.

Enums§

TargetBackend

Constants§

GEMM_DF64_ENTRY
Entry-point name of GEMM_DF64_WGSL.
GEMM_DF64_WGSL
Raw WGSL source for the df64 (double-single) emulated-f64 GEMM. See the module docs for the binding ABI and precision contract. The error-free-transform helpers are transcribed verbatim — quick_two_sum/two_sum/two_prod and the df_add/df_mul pair-arithmetic are subtle and must not be “simplified”.
MATMUL_TC_TILED_ENTRY
Entry point of the tiled cooperative-matrix GEMM (matmul_tc_wgsl_tiled).

Functions§

clear_dxc_cache
Clear the DXC SPIR-V cache (useful for testing or forced recompilation).
compile_hlsl_to_spirv
Compiles HLSL source to SPIR-V bytecodes using the DirectXShaderCompiler (DXC).
compile_hlsl_to_spirv_cached
Compile HLSL to SPIR-V with caching. On a cache hit, returns the stored binary without invoking DXC. On a miss, calls the inner compiler and stores the result.
conv2d_hlsl
Emit a complete HLSL module for a portable compute-graph (the HLSL analogue of emit_graph_wgsl). Non-portable nodes lower to an explicit Err.
conv2d_msl
Emit a complete MSL module for a portable compute-graph (the MSL analogue of emit_graph_wgsl). Non-portable nodes lower to an explicit Err.
decode_spirv_words
Decode a ;-joined decimal SPIR-V word string back into Vec<u32>.
dxc_cache_len
Number of cached SPIR-V binaries.
emit_cuda_c
emit_graph_cuda_c
Emit a complete CUDA-C module for a pure compute-graph — the CUDA-C analogue of emit_graph_wgsl. A single-node graph produces one kernel (compile + dispatch it with graph_cuda_entry); multi-node graphs concatenate the per-node kernels (a device-side multi-node CUDA executor is a later deliverable — see the module header).
emit_graph_hlsl
Emits graph-hlsl.
emit_graph_msl
Emits graph-msl.
emit_graph_wgsl
Emit a complete WGSL module for a pure compute-graph (no backing KernelSpec) — the native-node path (Reduce/Broadcast in Phase 2). A single-node graph produces one kernel module; multi-node graph emission (per-node functions + a driver) is Phase 4.
emit_hlsl
emit_msl
emit_ptx
Emits ptx.
emit_shader
Emits shader.
emit_spirv
Emit a validated SPIR-V module for kernel/schedule.
emit_spirv_patched
Emit SPIR-V and patch the workgroup size to schedule.workgroup_size.
emit_wgsl
graph_cuda_entry
The CUDA-C entry-point name a single-node graph lowers to (so a caller can compile + dispatch the emitted source). Mirrors the per-node kernel chosen by CudaCLowerer. Returns Err for op-classes without a CUDA-C lowering this phase.
matmul_tc_wgsl
Emits the cooperative-matrix 8x8 GEMM tile C = A * B, all-f32.
matmul_tc_wgsl_tiled
Emits a tiled cooperative-matrix GEMM C[m x n] = A[m x k] * B[k x n] (row-major, all-f32).
patch_spirv_workgroup_size
Patch the workgroup size in a SPIR-V binary to (x, 1, 1).