[BugFix] Reject unsupported TMA atomic add dtypes - #2830
Conversation
|
👋 Hi! Thank you for contributing to the TileLang project. Please remember to run We appreciate you taking this step! Our team will review your contribution, and we look forward to your awesome work! 🚀 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughTMA atomic-add lowering now validates destination dtypes before descriptor construction. Hopper-specific tests cover supported and unsupported dtypes during CUDA ChangesTMA atomic-add dtype validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
testing/python/language/test_tilelang_language_atomic.py (1)
341-352: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover every supported dtype branch.
The lowering accepts
float16,bfloat16,float32,int32,uint32, anduint64. This test covers onlyfloat32andint32. Add the other four supported dtypes to detect regressions in their validation branches.Proposed test expansion
-@pytest.mark.parametrize("dtype", [T.float32, T.int32]) +@pytest.mark.parametrize( + "dtype", + [T.float16, T.bfloat16, T.float32, T.int32, T.uint32, T.uint64], +) def test_tma_atomic_add_accepts_supported_dtype(dtype):🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@testing/python/language/test_tilelang_language_atomic.py` around lines 341 - 352, Expand the dtype parameter list in test_tma_atomic_add_accepts_supported_dtype to include T.float16, T.bfloat16, T.uint32, and T.uint64 alongside the existing T.float32 and T.int32 values, while preserving the current lowering and kernel-source assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@testing/python/language/test_tilelang_language_atomic.py`:
- Around line 12-16: Update _check_hopper() to query the currently selected CUDA
device rather than hardcoded device 0, using that device when calling
torch.cuda.get_device_properties. Preserve the existing CUDA availability guard
and Hopper capability check.
---
Nitpick comments:
In `@testing/python/language/test_tilelang_language_atomic.py`:
- Around line 341-352: Expand the dtype parameter list in
test_tma_atomic_add_accepts_supported_dtype to include T.float16, T.bfloat16,
T.uint32, and T.uint64 alongside the existing T.float32 and T.int32 values,
while preserving the current lowering and kernel-source assertion.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 0f1e0a3b-e29d-40d2-a863-25437a4a54bf
📒 Files selected for processing (2)
src/cuda/op/atomic_add.cctesting/python/language/test_tilelang_language_atomic.py
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 53ff5705cf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Fixes #2583.
Problem
The TMA atomic-add lowering accepted every dtype that could be represented by a TensorMap. That set is broader than the element types supported by
cp.reduce.async.bulk.tensor.add, so unsupported types such asint16reachedtma_store_addand failed at kernel launch instead of producing a compile-time diagnostic.Change
Validate the destination dtype in
AtomicAdd::Lowerbefore constructing the TMA descriptor. The accepted set now matches the tensor reduction contract:float16,bfloat16,float32,int32,uint32, anduint64.The existing runtime test is also restricted to SM90 hardware, while compile-level coverage verifies that
int16andfloat64are rejected and thatfloat32andint32still lower totma_store_add.Regression coverage
Against the pre-fix native library, both new negative cases fail with
DID NOT RAISE, demonstrating that the tests exercise the missing guard. The positive controls lower successfully and retaintma_store_add.Validation
python3 -m pre_commit run --files src/cuda/op/atomic_add.cc testing/python/language/test_tilelang_language_atomic.py— passed all hooks.-fsyntax-onlycompile ofsrc/cuda/op/atomic_add.ccwith the repository build flags — passed.python -m pytest -q testing/python/language/test_tilelang_language_atomic.py::test_tma_atomic_add_accepts_supported_dtype testing/python/language/test_tilelang_language_atomic.py::test_tma_atomic_add— 2 passed, 1 skipped on an SM86 GPU.python -m pytest -q testing/python/language/test_tilelang_language_atomic.py::test_tma_atomic_add_rejects_unsupported_dtype— 2 failed withDID NOT RAISE, forint16andfloat64.Summary
float16,bfloat16,float32,int32,uint32, anduint64.sm_90) compile and lowering tests for supported and unsupported dtypes.C++ style / lint notes
docs/developer_guide/cpp_style.md.