Skip to content

test(cutedsl): gap-op dispatcher tests + fused_add_rms_norm 3-D backward + shape fallbacks - #1457

Open
arde171 wants to merge 2 commits into
linkedin:mainfrom
arde171:arde/upstream-cutedsl-tests
Open

arde171 wants to merge 2 commits into
linkedin:mainfrom
arde171:arde/upstream-cutedsl-tests

Conversation

@arde171

@arde171 arde171 commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add CuTe DSL correctness coverage in three test files. Runtime source is unchanged.

  • Compare supported native operations with both Triton and independent PyTorch references, checking every expected output and gradient.
  • Cover 2-D/3-D fused-add RMSNorm, including normalization-only, residual-only, and combined backward paths with independent gradient storage.
  • Reject missing, detached, truncated, or vacuous gradient comparisons. Check JSD endpoint, ignore-mask, aliasing, and global-denominator contracts.
  • Distinguish native execution from explicit Triton fallbacks, including separate alignment and size-limit cases. No benchmark results or speedup claims are included.

Testing Done

Exact commit 425650d645462aa804ee0e5d42d3559c70a3a3e5 on NVIDIA B300, using an exclusive GPU lease:

python -m pytest test/cutedsl/test_fused_add_rms_norm.py test/cutedsl/test_gap_ops.py test/cutedsl/test_shape_fallbacks.py

86 passed, 0 failed, 0 skipped: 60 native CuTe DSL cases, 17 explicitly asserted Triton-fallback cases, and 9 CPU helper/reference cases. For fused-linear JSD, native attribution applies to the inner JSD primitive, not the shared projection or backward-scaling operations. Changed-file Ruff lint and formatting pass.

This is targeted correctness coverage, not full model convergence or cross-platform qualification. Hopper, AMD, and Intel execution remain unqualified by these B300 results. Maintainer approval and repository CI gates remain separate requirements.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

…ard + shape fallbacks

Upstream the managed CuTe DSL dispatcher test coverage that OSS lacked. This
is a test-only change: the two source fixes these tests were written for --
the fused_add_rms_norm 3-D backward flatten fix (managed linkedin#18) and routing the
dispatcher RoPE through the fused ops-layer CuTe DSL kernels (managed linkedin#20) --
are already present in OSS upstream (identical files), so no source changes
are needed here.

Adds three parity-vs-Triton suites under test/cutedsl/:

- test_fused_add_rms_norm.py: dispatcher parity for the nvidia-cutedsl
  fused_add_rms_norm op across fp32/bf16, 2-D/3-D shapes, and in_place
  True/False, plus a focused 3-D fwd+bwd regression that used to crash with
  "ValueError: ... expected ndim=2" before the backward flatten fix.
- test_gap_ops.py: parity coverage for the geglu, softmax, layer_norm,
  kl_div, jsd, and fused_linear_jsd dispatcher registrations plus the
  jsd_loss_and_grad primitive. Each cell is pinned as real CuTe DSL or a
  by-design Triton fallback and verified against the dispatcher's fallback
  signal so a cell can never silently compare Triton-vs-Triton. Real CuTe DSL
  parity is scoped to Blackwell (sm_100+); non-Blackwell archs cleanly skip.
- test_shape_fallbacks.py: dispatcher shape-fallback coverage for softmax,
  kl_div, rms_norm, layer_norm, and fused_add_rms_norm, asserting the
  nvidia-cutedsl backend matches nvidia-triton on shapes that punt to Triton.

All suites skip (never fail) when CUDA or nvidia-cutlass-dsl is unavailable.
Collection verified: 45 tests collected; ruff check + format clean.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@arde171
arde171 force-pushed the arde/upstream-cutedsl-tests branch from 0d6349d to 6cdcce7 Compare September 11, 2026 06:48
@arde171

arde171 commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

The preliminary benchmark tables and derived speedup claims have been removed because the measurements were not sufficiently controlled. This PR adds test coverage only and makes no performance-improvement claim.

@arde171

arde171 commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

Update: the provisional performance figures referenced here have been removed. The correctness-test information is unchanged.

Add independent PyTorch references, reject missing and vacuous gradients, and explicitly distinguish native paths from shape fallbacks. Cover isolated residual gradients and JSD masking and denominator contracts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant