Grouped gemm for `mul!` of CUDA tensors #611
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 268 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.335
Real PR Conversation Timeline
1 comments
"Review active on #611"
general
weight: 0.35
kshyatt
⚠️ vibe-coded, not meant for merging, mostly to get an idea of how much this matters vs the current approach.
---
Replaces the per-block loop in
mul!for CUDA tensors by a single grouped gemm call (cublasGemmGroupedBatchedEx, cuBLAS ≥ 12.5) for all small blocks, and individual gemm calls for the few large ones.α op(A)is expanded into real2m × 2kblocks[ar -ai; ai ar]by a small kernel, whileBandCare simply reinterpreted as real. Complexβis applied upfront.m n kaboveTensorKitCUDAExt.GROUPED_GEMM_THRESHOLD[](1024^3real,256^3complex) use individualcublasGemmExcalls, since tensor-core gemm beats the grouped (SIMT) kernel there. These calls uploadαandβonce, instead of once per block as in CUDA.jl'smul!.B, and cuBLAS < 12.5, use only the individual gemm calls.GroupedGemmPlan.Benchmarks
C = A B, with the oldmul!as baseline.cublasGemmExpath is slower than CUDA.jl'sgemmEx!for reasons I haven't pinned down).Tests
The existing "Multiplication and inverse: test via CPU" testset covers the grouped path (the test spaces have small blocks). A new testset covers the direct path and real/complex
βfor every combination of adjoints.🤖 Generated with Claude Code