diff --git a/crates/ml/build.rs b/crates/ml/build.rs index 9b5a11afb..88e62c7cd 100644 --- a/crates/ml/build.rs +++ b/crates/ml/build.rs @@ -93,7 +93,7 @@ fn main() { } } let passed = kernels_with_common.len() - failed.len(); - eprintln!(" Precompiled {passed}/{} CUDA kernels ({arch}) — all BF16", + eprintln!(" Precompiled {passed}/{} CUDA kernels ({arch}) — f32/TF32", kernels_with_common.len()); if !failed.is_empty() { eprintln!(" FAILED: {}", failed.join(", ")); diff --git a/crates/ml/src/cuda_pipeline/gpu_attention.rs b/crates/ml/src/cuda_pipeline/gpu_attention.rs index 4cb3025dd..9f1f89798 100644 --- a/crates/ml/src/cuda_pipeline/gpu_attention.rs +++ b/crates/ml/src/cuda_pipeline/gpu_attention.rs @@ -217,17 +217,17 @@ impl GpuAttention { // ── Load cubin kernels ────────────────────────────────────────── - // Forward cubin — SDP kernel lives here - let module = context.load_cubin(ATTENTION_CUBIN.to_vec()) + // Forward cubin — old multihead_feature_attention (legacy, not used by cuBLAS path) + let _module = context.load_cubin(ATTENTION_CUBIN.to_vec()) .map_err(|e| MLError::ModelError(format!("attention module: {e}")))?; - let sdp_fwd_kernel = module.load_function("attn_sdp_fwd") - .map_err(|e| MLError::ModelError(format!("attn_sdp_fwd kernel load: {e}")))?; - let layer_norm_fwd_kernel = module.load_function("attn_layer_norm_fwd") - .map_err(|e| MLError::ModelError(format!("attn_layer_norm_fwd kernel load: {e}")))?; - // Backward cubin — SDP bwd, LayerNorm bwd, bias grad, grad_norm, adam + // Backward cubin — contains ALL element-wise kernels (fwd + bwd) for cuBLAS attention let bwd_module = context.load_cubin(ATTENTION_BACKWARD_CUBIN.to_vec()) .map_err(|e| MLError::ModelError(format!("attention backward module: {e}")))?; + let sdp_fwd_kernel = bwd_module.load_function("attn_sdp_fwd") + .map_err(|e| MLError::ModelError(format!("attn_sdp_fwd kernel load: {e}")))?; + let layer_norm_fwd_kernel = bwd_module.load_function("attn_layer_norm_fwd") + .map_err(|e| MLError::ModelError(format!("attn_layer_norm_fwd kernel load: {e}")))?; let sdp_bwd_kernel = bwd_module.load_function("attn_sdp_bwd") .map_err(|e| MLError::ModelError(format!("attn_sdp_bwd kernel load: {e}")))?; let layer_norm_bwd_kernel = bwd_module.load_function("attn_layer_norm_bwd")