Repository navigation
Conversation
Small blocks are multiplied in a single `cublasGemmGroupedBatchedEx` call, using the real 1m embedding for complex element types. Large blocks use individual `cublasGemmEx` calls with the scalars uploaded once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kshyatt
self-requested a review
November 5, 2026 15:01
Member
|
It can certainly be on a separate PR, but it looks like rocBLAS now has support for this too. |
kshyatt
reviewed
Nov 5, 2026
| @@ -0,0 +1,226 @@ | |||
| const CuStoredTensorMap{T} = TensorMap{T, S, N₁, N₂, A} where {S, N₁, N₂, A <: CuVector{T}} | |||
Member
There was a problem hiding this comment.
don't we already have this in the cutensormap.jl file?
Member
Author
|
For context, this isn't really something that should actually be merged, and I would much rather have this all go through MAK instead. @jack-dunham was playing around with our kernels compared to the cuTENSORBlockSparse stuff, and I just wanted to add something to see if this actually matters, so see this more as a prototype. It's also very unreviewed 🙃 |
kshyatt
reviewed
Nov 5, 2026
| Complex blocks benefit from individual calls much earlier, since the grouped call works on their | ||
| real 1m embedding. | ||
| """ | ||
| const GROUPED_GEMM_THRESHOLD = Ref((real = 1024^3, complex = 256^3)) |
Member
There was a problem hiding this comment.
Could some of these move into TensorKit src so we can extend them for ROCm too?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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