[BUG] Grouped GEMM and grouped Rank2K kernels build operand iterators from a temporary Params
Maintainers usually reply within 4 days
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cpp
- Domain
- performance
Research direction
Read gemm/kernel/gemm_grouped.h, gemm_grouped_per_group_scale.h, gemm_grouped_softmax_mainloop_fusion.h, and rank_2k_grouped.h, focusing on operand iterator construction and Params lifetimes. Reproduce the reported clang -O2 builds for examples 24 and 38, then make the operand Params outlive each iterator. Done means the grouped GEMM and Rank2K PTX no longer show the reported unwritten-register addresses.
Written by the indexing model from the issue text.
Description
gemm/kernel/gemm_grouped.h builds the mainloop operand iterators from a temporary Params:
typename Mma::IteratorA iterator_A(
LayoutA(ldm_A),
ptr_A, {problem_size.m(), problem_size.k()}, thread_idx, tb_offset_A);
LayoutA(ldm_A) becomes a temporary IteratorA::Params that is destroyed at the end of the statement, but the pitch-linear PredicatedTileAccessIterator keeps Params const ¶ms_, so every later ++ / add_tile_offset reads a dead object. Same pattern in gemm_grouped_per_group_scale.h, gemm_grouped_softmax_mainloop_fusion.h, and rank_2k_grouped.h (spelled typename Mma1::IteratorA::Params(ldm_A) there). The epilogue iterators in rank_2k_grouped.h copy their Params, so those are fine.
nvcc's output happens not to show it. clang's (LLVM main, 24.0.0git) at -O2 does: building example 24's GemmGrouped kernel (half/half/float, Sm80 multistage, 128x128x32, 4 stages) for sm_121a, 30 of the 32 cp.async copies in the PTX take their global address from a register that is never written. Example 38's Rank2KGrouped kernel: 56 of 64.
Naming the Params so it lives as long as the iterator fixes it (0 of 32 and 0 of 64 after):
typename Mma::IteratorA::Params params_A{LayoutA(ldm_A)}; // braces: with parens this declares a function
typename Mma::IteratorA iterator_A(
params_A, ptr_A, {problem_size.m(), problem_size.k()}, thread_idx, tb_offset_A);
Checked against main at 0b55a2f691 with CUDA 13.4. To get main through clang at all I had to pass -D__nv_atomic_load_n=__atomic_load_n -D__NV_ATOMIC_RELAXED=__ATOMIC_RELAXED (subbyte_reference.h uses the nvcc-only builtin); that's a separate problem.
- Dominant language
- C++
- Stars
- 10.7k
- Forks
- 2.2k
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 4
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NVIDIA/cutlass
-
[Bug][CuTeDSL][Fuzz] `utils.gemm.sm100.epilogue` releases the accumulator before `tcgen05.ld` completes: no `tcgen05.wait::ld` before the arrive that lets the next MMA overwrite TMEMPossibly taken @0z5a claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 4 days
-
? - Needs Triage question
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
NVIDIA/cutlass#3796 · 1 comment · 1 reaction ·
Maintainers usually reply within 4 days
-
[DOC] IKET quick start omits the GEMM GPU requirement and references a missing examplePossibly taken @0z5a claimed this 12 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 82/100
NVIDIA/cutlass#3761 · 1 comment ·
Maintainers usually reply within 4 days
-
[BUG] CuTe DSL from_dlpack rejects float8_e4m3fn tensors (dtype_map lists Float8E5M2 only)Possibly taken @Ammar-Alnagar claimed this 22 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cutlass#3716 · 1 comment ·
Maintainers usually reply within 4 days
-
EllGemm ColumnMajor-output workspace sizing uses the unswapped problem shape and undersizes split-K semaphoresPossibly taken @XFDG claimed this 50 days ago. OpenCUTLASS C++
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
NVIDIA/cutlass#3539 · 2 comments ·
Maintainers usually reply within 4 days
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
pocoproject/poco#5626 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Issue-Bug Needs-Triage
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
microsoft/winget-cli#6645 ·
Maintainers usually reply within 2 days
-
cleanup help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ESPresense/ESPresense#2602 ·
Maintainers usually reply within 1 day
-
devex good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day