fix(cuda): share se_a padding breakpoint#5844
Conversation
Compute the first sorted-padding sentinel once per atom and use uniform tile rounds so CUDA and ROCm gradients match the CPU tail-folding semantics. Add CPU/GPU parity coverage for plain and attention gradients, including the two-embedding tail. Coding-Agent: Codex Codex-Version: codex-cli 0.144.4 Model: gpt-5.6-sol Reasoning-Effort: xhigh
for more information, see https://pre-commit.ci
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe CUDA se_a gradient kernel now shares sorted-padding breakpoints across the block and uses uniform accumulation. A GPU regression test compares sorted-padding results with CPU gradients, including optional ChangesSorted-padding gradient handling
Estimated code review effort: 4 (Complex) | ~45 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5844 +/- ##
==========================================
- Coverage 78.58% 78.32% -0.27%
==========================================
Files 1050 1050
Lines 120637 120637
Branches 4356 4358 +2
==========================================
- Hits 94801 94485 -316
- Misses 24278 24585 +307
- Partials 1558 1567 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Possible reviewers based on changed lines, exact file history, and exact-file review history:
No review request was made automatically. Coding agent: Codex |
Summary
dy_dtwotailse_aand attention gradientsWhy existing tests missed the bug
nnei = 4without a padding sentinel, so each of the four warps handles one real neighbor and never chooses competing breakpoints.dy_dtwoback to the host or assert it, leaving overlapping tail writes invisible.Validation
cmake --build source/build --target deepmd_op_cuda runUnitTests_lib -j2source/build/lib/tests/runUnitTests_lib --gtest_filter='TestTabulateSeA.tabulate_fusion_se_a_grad_cpu'(passed)two_embedpathssm_120kernel image for the RTX 5090; CUDA CI will execute the regressionruff format .ruff check .Fixes #5650
Coding agent: Codex
Codex version: codex-cli 0.144.4
Model: gpt-5.6-sol
Reasoning effort: xhigh
Summary by CodeRabbit
Bug Fixes
Tests