Skip to main content

lower_matmul_to_cuda

Function lower_matmul_to_cuda 

Source
pub fn lower_matmul_to_cuda(spec: &MatmulSpec) -> String
Expand description

Lower a RECOGNIZED LOGOS matmul (C(M×N) = A(M×K)·B(K×N), from crate::tensor_recognize::recognize_matmul) to a self-contained CUDA program whose dims ARE the source program’s — the compiler generating the kernel, not a template. The emitted program reproduces the LOGOS matmul’s deterministic int8-range fill (a[p]=(p%7)-3, b[p]=(p%5)-2), computes C=A·B on the GPU, and prints the checksum Σ C — so its stdout equals the VM’s Show checksum byte-for-byte. M,N,K are baked from the spec.

Uses the best-general knobs (CudaKnobs::default). Call lower_matmul_to_cuda_with to pin a point in the knob lattice — e.g. the Int8Dp4a precision fast path.