[pr-tests][shaders] structure: pin the branch on the SCC of a mask compare #432

Open
qnjk wants to merge 1 commit from qnjk/Darner:structure-scc-test into main
First-time contributor

Contributor role (optional)

  • Fluxer ID:

What it changes

  • The problem on main: nothing. This is a tests-only change (no production line is edited), so per CONTRIBUTING it needs no A/B result and no gameplay run.

  • What it pins: s_cmp_eq_u64 and s_cmp_lg_u64 compare two lane masks, so their SCC is a per-lane property, not a uniform one — equality sets it where every lane's two bits are equal, inequality where some lane's differ, and s_cbranch_scc1/scc0 take the branch where it is set or clear. Every other s_cmp_* in the suite compares numbers, so this per-lane SCC and its exclusion from the uniform scc_some set (crates/darner-shader/src/structure.rs:1414 the rule, set at :1311-1330, filtered out of the uniform set at :920-925) were only ever reached by a title program. A lane that took the wrong way would run exactly the region the console skips — silently, and in the wrong direction.

  • The new test structure::tests::a_mask_compare_branch_is_taken_where_the_console_takes_it builds the four combinations (eq/lg × scc1/scc0) from hand-written RDNA2 instructions, structures the program, finds the s_cbranch_scc* block, and checks the branch's LaneExit::Branch condition: its support is exactly two per-lane atoms (the lanes' own two bits), not a uniform value and not an unknown. It also asserts the two compares write different values so the two masks really differ.

How it was tested

  • Tested revision: 1f5dc7c (one commit on f3840d7).
  • Commands and results:
    • cargo test --locked -p darner-shader --lib -- a_mask_compare_branch_is_taken — 1 passed, 0 failed.
    • cargo clippy --locked -p darner-shader --all-targets -- -D warnings passes.
    • Pure function: no GPU, no title, no fixture, so it runs on a bare runner.
  • Changes a default: no. Tests only.
  • A/B result: not applicable — tests-only change.
  • Gates run on that revision:
    • Gate 1, cargo clippy --workspace --all-targets --locked -- -D warnings: passes.
    • Gate 2, cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes.
    • Gate 3, cargo test --workspace --locked: not green on this machine, and not because of this change. Three pre-existing failures, each covered by an open pull request: darner-gpu stands still in parallel on the test deadlock #224 describes, and serially finishes 1772 passed and 1 failed (pipeline::make::tests::a_capped_draw_waits_once_then_drops, which passes on its own) beside the order-dependent flakes of #150; darner-shader fails emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders, whose fixture #227 fixes — that test fails identically on unmodified f3840d7 in the same worktree. The new test passes.
  • Gameplay, when relevant: not applicable — tests-only change.
  • Shader wave sizes tested, when relevant: the program is a wave32 one (the synthetic stream is built with true for the 32-lane form); wave64 shapes of the same compare are not exercised by this test.
  • Hardware dependence: none.
  • Coverage gaps: the four combinations are covered; a mask compare whose operands are not both lane masks (one uniform, one per-lane) is not, and neither is the same rule under the wave64 fold.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
    • Not applicable: tests-only change, stated at the top.
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md. (cargo xtask policy: 555 files ok.)
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #312 changes crates/darner-shader/src/structure.rs. It is listed so a reviewer can check for a conflict; this change only adds to the mod tests block at the end of the file. No open or closed issue mentions a mask compare, s_cmp_eq_u64, s_cmp_lg_u64 or per-lane SCC.
  • Replaces or overlaps: none found
## Contributor role (optional) - Fluxer ID: ## What it changes - The problem on main: nothing. This is a **tests-only** change (no production line is edited), so per CONTRIBUTING it needs no A/B result and no gameplay run. - What it pins: `s_cmp_eq_u64` and `s_cmp_lg_u64` compare two **lane masks**, so their SCC is a per-lane property, not a uniform one — equality sets it where every lane's two bits are equal, inequality where some lane's differ, and `s_cbranch_scc1`/`scc0` take the branch where it is set or clear. Every other `s_cmp_*` in the suite compares numbers, so this per-lane SCC and its exclusion from the uniform `scc_some` set (`crates/darner-shader/src/structure.rs:1414` the rule, set at `:1311-1330`, filtered out of the uniform set at `:920-925`) were only ever reached by a title program. A lane that took the wrong way would run exactly the region the console skips — silently, and in the wrong direction. - The new test `structure::tests::a_mask_compare_branch_is_taken_where_the_console_takes_it` builds the four combinations (`eq`/`lg` × `scc1`/`scc0`) from hand-written RDNA2 instructions, structures the program, finds the `s_cbranch_scc*` block, and checks the branch's `LaneExit::Branch` condition: its support is exactly two **per-lane** atoms (the lanes' own two bits), not a uniform value and not an unknown. It also asserts the two compares write different values so the two masks really differ. ## How it was tested - Tested revision: `1f5dc7c` (one commit on `f3840d7`). - Commands and results: - `cargo test --locked -p darner-shader --lib -- a_mask_compare_branch_is_taken` — 1 passed, 0 failed. - `cargo clippy --locked -p darner-shader --all-targets -- -D warnings` passes. - Pure function: no GPU, no title, no fixture, so it runs on a bare runner. - Changes a default: no. Tests only. - A/B result: not applicable — tests-only change. - Gates run on that revision: - Gate 1, `cargo clippy --workspace --all-targets --locked -- -D warnings`: passes. - Gate 2, `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: passes. - Gate 3, `cargo test --workspace --locked`: **not green on this machine, and not because of this change.** Three pre-existing failures, each covered by an open pull request: `darner-gpu` stands still in parallel on the test deadlock #224 describes, and serially finishes 1772 passed and 1 failed (`pipeline::make::tests::a_capped_draw_waits_once_then_drops`, which passes on its own) beside the order-dependent flakes of #150; `darner-shader` fails `emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders`, whose fixture #227 fixes — that test fails identically on unmodified `f3840d7` in the same worktree. The new test passes. - Gameplay, when relevant: not applicable — tests-only change. - Shader wave sizes tested, when relevant: the program is a wave32 one (the synthetic stream is built with `true` for the 32-lane form); wave64 shapes of the same compare are not exercised by this test. - Hardware dependence: none. - Coverage gaps: the four combinations are covered; a mask compare whose operands are not both lane masks (one uniform, one per-lane) is not, and neither is the same rule under the wave64 fold. ## Checklist - [x] I ran this change in the game, or say below why it can't be (docs, tests only). - Not applicable: tests-only change, stated at the top. - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. (`cargo xtask policy`: 555 files ok.) - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #312 changes `crates/darner-shader/src/structure.rs`. It is listed so a reviewer can check for a conflict; this change only adds to the `mod tests` block at the end of the file. No open or closed issue mentions a mask compare, `s_cmp_eq_u64`, `s_cmp_lg_u64` or per-lane SCC. - Replaces or overlaps: none found
`s_cmp_eq_u64`/`s_cmp_lg_u64` compare two lane masks, so their SCC is a
per-lane property, not a uniform one: equality sets it when every lane's
two bits are equal, inequality when some lane's differ, and
`s_cbranch_scc1`/`scc0` take the branch where it is set or clear. Every
other `s_cmp_*` in the suite compares numbers, so this per-lane SCC and
its exclusion from the uniform `scc_some` set were only ever reached by a
title program: a lane that took the wrong way would run exactly the region
the console skips, silently and in the wrong direction.

The test builds the four combinations (`eq`/`lg` by `scc1`/`scc0`) from
hand-written instructions and checks that the branch's condition is the
lanes' own two bits — two per-lane atoms in its support — rather than a
uniform value or an unknown. No GPU, no title, no fixture.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'structure-scc-test:qnjk-structure-scc-test'
git switch 'qnjk-structure-scc-test'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'qnjk-structure-scc-test'
git switch 'qnjk-structure-scc-test'
git rebase 'main'
git switch 'main'
git merge --ff-only 'qnjk-structure-scc-test'
git switch 'qnjk-structure-scc-test'
git rebase 'main'
git switch 'main'
git merge --no-ff 'qnjk-structure-scc-test'
git switch 'main'
git merge --squash 'qnjk-structure-scc-test'
git switch 'main'
git merge --ff-only 'qnjk-structure-scc-test'
git switch 'main'
git merge 'qnjk-structure-scc-test'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!432
No description provided.