Repository navigation
Conversation
…ples Four of the seven Hopper CuTe DSL examples had no tests. Add one test file for each, in the style of test_dense_gemm_fp8_gelu.py: - test_dense_gemm.py / test_dense_gemm_persistent.py: all tile and cluster shapes, f16 / f8 / int8 inputs with each supported accumulator and output type, A/B/C major modes, batched, partial-tile and single-tile problems, and the persistent tile scheduler's swizzle and raster order. - test_fmha.py: head dims 32/64/128/256 in persistent and non-persistent mode (d256 with the N tiles can_implement accepts), no mask, causal and two sliding windows, partial tiles, GQA/MQA, bf16 and fp8 inputs. - test_cta_norm.py: LayerNorm and RMSNorm in f16/bf16/f32, thread counts from one warp to 1024, and edge shapes. L0 compiles and launches each configuration once; L1 checks it against the PyTorch reference. The bf16 cases exposed two problems in cta_norm.py, fixed here: the reference check used atol = rtol = 1e-3 for every dtype, which a one-ulp bf16 rounding difference (about 4e-3 relative) exceeds, and the command line always ran Float16 whatever --dtype said. Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
…ported run() documents scale_softmax = 0 as 1/sqrt(D) but computed 1/sqrt(q_shape[1]), the query sequence length. Use the head dimension. The module docstring still said Q and K must have the same number of heads, although run() broadcasts K/V over h // h_k query heads; the new GQA and MQA cases in test_fmha.py pass the reference check. Update the constraint. Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
This was referenced Oct 23, 2026
|
Thanks for filling this coverage gap — and for the bundled example fixes. Minor suggestions — none blocking
cc @Junkai-Wu. |
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.
Summary
examples/python/CuTeDSL/cute/hopperhas seven examples, buttest/examples/CuTeDSL/hopperonly tests three of them (FP8 2xacc, FP8 GELU, grouped GEMM). This PR adds a test file for each of the other four, written liketest_dense_gemm_fp8_gelu.py(L0 compiles and launches once; L1 checks against the PyTorch reference):test_dense_gemm.pytest_dense_gemm_persistent.pytest_fmha.pycan_implementaccepts); no mask, causal and two sliding windows; partial tiles incl.S_q = 1and bottom-right causal; GQA (8:2) and MQA; bf16; fp8test_cta_norm.pyWriting the tests turned up three small problems in the examples. The
cta_norm.pyfix is in the same commit as its test; the twofmha.pychanges are a separate commit:cta_norm.py: the reference check usedatol = rtol = 1e-3for every dtype. bf16 keeps 8 mantissa bits, so a one-ulp rounding difference from PyTorch is already about 4e-3 relative, and 6 of the 24 bf16 cases failed (1–7 mismatched elements out of 0.5–2 M, max abs diff 0.0039–0.0078). It now uses 1.6e-2 for bf16 (the PyTorch default rtol for bf16). The command line also ran Float16 regardless of--dtype.fmha.py:scale_softmax = 0is documented as 1/sqrt(D) but computed1 / sqrt(q_shape[1]), i.e. 1/sqrt(S_q). It now uses the head dimension.fmha.py: the module docstring says Q and K must have the same number of heads, butrun()already broadcasts K/V overh // h_kquery heads, and the new GQA/MQA cases pass the reference check. The constraint now reads "a multiple of".Related: #3399 (max reduction in the FMHA softmax) is performance-only; the new FMHA tests pass with and without it (85/85 each). I posted GH200 timings there.
No overlap with #3648 (bf16 inputs for the dense GEMM examples): the dense GEMM tests use the dtypes
is_valid_dtypesaccepts today; bf16 cases can be added to theDTYPESlist once #3648 lands.Results (GH200)
Full files at the default level (L0 and L1 cases), pytest 9.0.2 with the
cutlass_cicdplugins:test_dense_gemm.pytest_dense_gemm_persistent.pytest_fmha.pytest_cta_norm.pyThe runs used torch 2.14.1 rather than the 2.11.0 pinned in
cutlass_cicdrequirements.