Skip to content

test(rocsparse): check wfreduce results only in the specified lanes on gfx8/gfx9 - #13388

Closed
kliegeois wants to merge 1 commit into
ROCm:developfrom
kliegeois:users/kliegeois/fix-wfreduce-unit-test-dpp-lanes
Closed

kliegeois wants to merge 1 commit into
ROCm:developfrom
kliegeois:users/kliegeois/fix-wfreduce-unit-test-dpp-lanes

Conversation

@kliegeois

@kliegeois kliegeois commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

rocsparse-unit-test-device reports 14 failures on every wave64 gfx9 part (gfx90a / gfx94x / gfx950). They are not seen on gfx1201 (wave32), so they only show up on MI-series CI and local MI300X runs:

internal_collectives_wfreduce_sum.{i32,i64,f32,f64,complex_f32}
internal_collectives_wfreduce_max.{f32,f64,i32,i64}
internal_collectives_wfreduce_min.{i32,i64}
internal_collectives_wfreduce_partial_sum.{i32_sub8,f32_sub8}
internal_collective_extras_wfreduce_partial_sum.f64_sub8

Cause

The tests assert the reduction result in every lane. That is only what the shuffle-based implementations (ROCSPARSE_USE_MOVE_DPP == 0: gfx10+) guarantee. On gfx8/gfx9 the wfreduce_* routines are built from DPP row_shr / row_bcast steps, which accumulate the result only in the top lanes of the wavefront:

  • wfreduce_sum / _max / _min: lane wf-1.
  • wfreduce_partial_sum<WFSIZE, SUB> with SUB < 16: the last SUB lanes. The SUB == 16 and SUB == 32 cases use __shfl_xor throughout and already pass.

The routines are internal helpers whose results the library reads from those lanes, so this is a test expectation problem rather than a library bug.

Change

Test-only. rocsparse_ut::device_uses_dpp_wfreduce() selects gfx8/gfx9 from gcnArchName (the macro only exists in the device pass), and rocsparse_ut::wfreduce_first_valid_lane(wf, sub) returns the first lane to check: lane 0 on the shuffle path (every lane is still checked there), wf - sub on the DPP path. Both wfreduce unit-test files check lanes [first, wf). No library change.

Testing

rocsparse-unit-test-device, merged on top of develop aa96660108:

Device Before After
MI300X (gfx942, wave64) 632 pass, 14 fail 646 pass, 0 fail
gfx1201 (wave32) not run 646 pass, 0 fail

…nternal_collectives_warpreduce

On gfx8/gfx9 the DPP-based wfreduce_sum/_max/_min leave the result only in
lane wf-1, and wfreduce_partial_sum<WFSIZE, SUB> in the last SUB lanes. The
unit tests asserted the result in every lane, so 14 tests failed on
gfx90a/gfx94x/gfx950 (wave64) while passing on gfx1201.

Verify the lanes the implementation specifies: every lane on the shuffle path,
only the top lanes on the gfx8/gfx9 DPP path.
@kliegeois
kliegeois requested a review from a team as a code owner October 9, 2026 14:38
@therock-pr-bot

therock-pr-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
📝 PR Description ❌ Fail Error: PR description must reference a JIRA ID, ISSUE ID, or a GitHub closing keyword.
Expected: include a JIRA ID / ISSUE ID line (separator : or -, or omitted; value may be a JIRA key, a number with/without #, or a link), OR a closing keyword + issue reference. Accepted examples:
• JIRA ID : TESTAUTO-6039
• JIRA ID - #330
• JIRA ID #330
• JIRA ID (on separate line)
ROCM-25757
• ISSUE ID : TESTUTO-3334
• ISSUE ID #3334
• ISSUE ID - TESTAUTO-3433
• ISSUE ID (on separate line)
AIRUNTIME-2352
• ISSUE ID : https://github.com/<org_name>/<repo_name>/issues/1234
• Closes #10
• Fixes octo-org/octo-repo#100
• Resolves: #123
• #123
• https://github.com/<org_name>/<repo_name>/issues/123
Current: no valid JIRA/ISSUE/closing-keyword reference found
⛔ 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: projects/rocsparse/clients/unittests/unit_test_internal_collective_extras_wfreduce.cpp, projects/rocsparse/clients/unittests/unit_test_internal_collectives_warpreduce.cpp, projects/rocsparse/clients/unittests/unit_test_utils.hpp; no test file found
🔎 pre-commit ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

⚠️ 1 policy check(s) failed. Please address the issues above before this PR can be Reviewed.

🚫 Please fix the failed policies

  • ❌ PR Description

The Not ready to Review label was added to this PR. Once all policies pass, the label is removed automatically.

📖 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 Oct 9, 2026

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Description

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

@kliegeois

Copy link
Copy Markdown
Contributor Author

Closing for #13389.

@kliegeois kliegeois closed this Oct 9, 2026
kliegeois added a commit that referenced this pull request Oct 12, 2026
…13389)

## Summary
- Register `rocsparse-unit-test` and `rocsparse-unit-test-device` on the
`standard`, `comprehensive`, and `full` ctest labels, including the
installed `bin/rocsparse/CTestTestfile.cmake` that TheRock runs. `quick`
does not include them.
- Each binary is registered twice. TheRock on gfx1151 requires the
`ex_gpu_gfx1151` label, and on every other GPU it excludes `ex_gpu`, so
one entry cannot satisfy both.
- Include the gfx8/gfx9 wfreduce lane check from #13388. Without it,
`rocsparse-unit-test-device` fails 14 cases on gfx94X and gfx950, which
are TheRock Linux test targets. This supersedes #13388.

## Test plan
- [ ] TheRock `standard` on gfx94X and gfx950 runs both unit-test
binaries, and the wfreduce cases pass
- [ ] gfx1151 selects the `ex_gpu_gfx1151` entries rather than the plain
ones
- [ ] `ctest -L quick` does not run either unit-test binary

---------

Co-authored-by: Kim Liegeois <kliegeois@users.noreply.github.com>
Co-authored-by: James Sandham <33790278+jsandham@users.noreply.github.com>
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.

1 participant