Skip to content

feat(stinkytofu): Add RemoveDscntPass for WMMA Loops - #10389

Open
hcman2 wants to merge 7 commits into
ROCm:developfrom
hcman2:users/hcman2/remove_dscnt_pass
Open

feat(stinkytofu): Add RemoveDscntPass for WMMA Loops#10389
hcman2 wants to merge 7 commits into
ROCm:developfrom
hcman2:users/hcman2/remove_dscnt_pass

Conversation

@hcman2

@hcman2 hcman2 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Motivation

JIRA ID: https://amd-hub.atlassian.net/browse/AIHPBLAS-4230
RemoveDscntPass is motivated by the gap between conservative s_wait_dscnt insertion and the actual dataflow/timing behavior of LDS reads in WMMA-heavy kernels.

In practice, upstream wait insertion tends to be safety-first: it often keeps dscnt values higher than necessary, and may emit multiple waits that become redundant once instruction scheduling, overlap, and issue timing are considered together. This is especially common in long loop bodies with dense ds_load streams and interleaved v_wmma instructions.

The goal of this pass is to tighten or eliminate unnecessary LDS wait pressure while preserving correctness:

Track in-flight LDS loads (ds_load) over a continuous scan.
Model when waits are still required versus when they are over-conservative.
Reduce dscnt counts to the minimum safe value when possible.
Remove waits that are provably redundant and leave a traceable comment marker.
By doing this, the pass improves instruction-level overlap (less over-waiting), reduces synchronization overhead in hot loops, and keeps the generated assembly both safer-than-manual tuning and more efficient than purely conservative wait insertion.

Test Plan

Check some performances
Stinkytofu ctest

Test Result

tox passed wo sk cases on b0
stinkytofu ci passed

Submission Checklist

@therock-pr-bot

therock-pr-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Description ✅ Pass
Forbidden Files ✅ Pass
🧪 Unit Test ⚠️ Warning Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: shared/stinkytofu/include/stinkytofu/transforms/asm/RemoveDscntPass.hpp, shared/stinkytofu/src/pipeline/backend/Gfx1250Backend.cpp, shared/stinkytofu/src/transforms/asm/RemoveDscntPass.cpp, shared/stinkytofu/tests/api/ApiExportTest.cpp, shared/stinkytofu/tests/unit/asm/RemoveDscntPassTest.cpp (+1 more); no test file found
🔎 pre-commit ✅ Pass
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled
🤖 therock-pr-bot ✅ Pass

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

therock-pr-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #10389      +/-   ##
===========================================
- Coverage    69.69%   68.52%   -1.18%     
===========================================
  Files         2754     2754              
  Lines       453338   460598    +7260     
  Branches     66803    73250    +6447     
===========================================
- Hits        315952   315585     -367     
- Misses      117083   123179    +6096     
- Partials     20303    21834    +1531     
Flag Coverage Δ *Carryforward flag
TensileLite 34.23% <ø> (ø) Carriedforward from d4e288b
TensileLite-CPP 38.07% <ø> (-0.04%) ⬇️
TensileLite-Unit 75.94% <ø> (+0.04%) ⬆️
hipBLAS 90.62% <ø> (ø) Carriedforward from d4e288b
hipBLASLt 34.89% <ø> (ø)
hipCUB 83.47% <ø> (ø) Carriedforward from d4e288b
hipDNN 86.44% <ø> (ø) Carriedforward from d4e288b
hipFFT 48.20% <ø> (ø) Carriedforward from d4e288b
hipRAND 76.12% <ø> (ø) Carriedforward from d4e288b
hipSOLVER 69.18% <ø> (ø) Carriedforward from d4e288b
hipSPARSE 86.27% <ø> (ø) Carriedforward from d4e288b
rocBLAS 48.23% <ø> (ø) Carriedforward from d4e288b
rocFFT 48.26% <ø> (ø) Carriedforward from d4e288b
rocRAND 57.02% <ø> (ø) Carriedforward from d4e288b
rocSOLVER 76.92% <ø> (ø) Carriedforward from d4e288b
rocSPARSE 72.50% <ø> (ø) Carriedforward from d4e288b
rocThrust 91.60% <ø> (ø) Carriedforward from d4e288b

*This pull request uses carry forward flags. Click here to find out more.
see 17 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hcman2
hcman2 force-pushed the users/hcman2/remove_dscnt_pass branch 3 times, most recently from e4c9300 to 98024c4 Compare August 7, 2026 01:57
@hcman2

hcman2 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

For the default conservative setting, 6 dscnt are removed for compute bound F8 256x256 MT

@hcman2
hcman2 force-pushed the users/hcman2/remove_dscnt_pass branch from 98024c4 to d4e288b Compare August 7, 2026 02:10
@hcman2

hcman2 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

tox passed wo sk cases on gfx1250

@hcman2 hcman2 changed the title feat(stinkytofu): Tune s_wait_dscnt in WMMA Loops feat(stinkytofu): Add a pass for dscnt in WMMA Loops Aug 7, 2026
@KKyang KKyang changed the title feat(stinkytofu): Add a pass for dscnt in WMMA Loops feat(stinkytofu): Add RemoveDscntPass for WMMA Loops Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants