Shaders: v_cmp_f and v_cmp_tru are the constants false and true (restores upstream 77053a0) #241

Open
murillojndem wants to merge 1 commit from upstream-pr/241 into main
murillojndem commented 2026-11-30 03:18:24 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by murillojndem on 2026-11-30T03:18:24Z.


v_cmp_f_f32 and v_cmp_tru_f32 (and their f16 forms, in the same arm of the lowering) are false and true whatever their operands. They were lowered as LLVM fcmp false and fcmp true. On WARP a dispatch of such a program removes the device ("the GPU device instance has been suspended"); the RX 7900 XT runs it and gives the right results. They are now the constants false and true, which is the same result on every host.

pred::FALSE stays in bitcode.rs with #[allow(dead_code)], as pred::ONE does for the same kind of reason.

This is the compare part of upstream Marvisak/VIctory 77053a0 (Marvis), which 570a941 removed with the rest of that commit.

Tests:

  • emit::valu_tests::float_compares_that_are_always_false_or_true_are_constants: v_cmp_f_f32 and v_cmp_tru_f32 of NaN and 1.0, 1.0 and 2.0, and NaN and NaN, the mask taken into v0 by v_cndmask_b32, on WARP and the RX 7900 XT. On main the first WARP dispatch removes the device; with this change it passes on both.
  • victory-shader --lib through hw-run (RX 7900 XT and WARP): 238 passed, 2 failed, 4 ignored; the two failures are emit::rect::tests (rectangles_are_drawn_whole, the_rectangle_stage_is_a_geometry_shader), which fail on main too.
  • Clippy with -D warnings, with and without --all-features (and for victory), and cargo xtask policy pass. rustfmt reports the same differences as on main. It merges with my open PRs.

Limits:

  • Only the f32 forms are tested; the f16 ones share the code.

Generated with Claude Code

<!-- greyfinch-sync:DexNom/VIctory:issue:5558349428 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/241). Originally posted by [murillojndem](https://github.com/murillojndem) on 2026-11-30T03:18:24Z. --- `v_cmp_f_f32` and `v_cmp_tru_f32` (and their f16 forms, in the same arm of the lowering) are false and true whatever their operands. They were lowered as LLVM `fcmp false` and `fcmp true`. On WARP a dispatch of such a program removes the device ("the GPU device instance has been suspended"); the RX 7900 XT runs it and gives the right results. They are now the constants false and true, which is the same result on every host. `pred::FALSE` stays in `bitcode.rs` with `#[allow(dead_code)]`, as `pred::ONE` does for the same kind of reason. This is the compare part of upstream Marvisak/VIctory 77053a0 (Marvis), which 570a941 removed with the rest of that commit. Tests: - `emit::valu_tests::float_compares_that_are_always_false_or_true_are_constants`: `v_cmp_f_f32` and `v_cmp_tru_f32` of NaN and 1.0, 1.0 and 2.0, and NaN and NaN, the mask taken into v0 by `v_cndmask_b32`, on WARP and the RX 7900 XT. On main the first WARP dispatch removes the device; with this change it passes on both. - victory-shader --lib through hw-run (RX 7900 XT and WARP): 238 passed, 2 failed, 4 ignored; the two failures are emit::rect::tests (rectangles_are_drawn_whole, the_rectangle_stage_is_a_geometry_shader), which fail on main too. - Clippy with `-D warnings`, with and without `--all-features` (and for `victory`), and `cargo xtask policy` pass. rustfmt reports the same differences as on main. It merges with my open PRs. Limits: - Only the f32 forms are tested; the f16 ones share the code. Generated with [Claude Code](https://claude.com/claude-code)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/241:upstream-pr/241'
git switch 'upstream-pr/241'

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 'upstream-pr/241'
git switch 'upstream-pr/241'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/241'
git switch 'upstream-pr/241'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/241'
git switch 'main'
git merge --squash 'upstream-pr/241'
git switch 'main'
git merge --ff-only 'upstream-pr/241'
git switch 'main'
git merge 'upstream-pr/241'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
DexNom/VIctory!241
No description provided.