Shaders: apply bitwise modifiers to v_cmp_class_f32 source operands #1327
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1327
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1327"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@fuzeofficlal on GitHub · 2026-11-24 17:28 UTC · original
fuzeofficlal:fix/shader-cmp-class-f32-modifiers-830→main· +121 −16 · 2 files · 1 commits · openFixes #830.
Summary
Lower::compare(class) forv_cmp_class_f32/v_cmpx_class_f32, apply SDWA sub-word selection (Self::sdwa_src+select_bits), and performabs(& 0x7FFF_FFFF) andneg(^ 0x8000_0000) bitwise ini32, matching the existingf16path.v_cmp_class_f32throughfsrc(FAbs/fsub -0.0, x), which flushes denormals to±0.0under FTZ and quiets signaling NaNs before IEEE-754 class testing.Verification
valu_tests::v_cmp_class_f32_matches_rdna2testing all 10 IEEE-754 binary32 classes (±sNaN,±qNaN,±inf,±normal,±denormal,±0.0) acrossplain,neg,abs,abs+neg, andv_cmp_class_f32_sdwa(-word0preserving-denormalclass 4 instead of flushing to-0.0class 5):dxil.dllvalidation: passedcargo test -p victory-shader,cargo clippy --workspace --all-targets --all-features, andcargo xtask policy: passed.@marquezinii on GitHub · 2026-11-24 18:10 UTC · original
Ran on an RTX 5070 (desktop, driver 621.40, the only adapter), Windows 11 26300, Rust 1.98.1 at
4f2eee6.cargo test -p victory-shader --lib -- --test-threads=1gives 121 passed, 0 failed, 1 ignored.v_cmp_class_f32_matches_rdna2passes on the hardware adapter and WARP, with the sNaN and denormal rows included.This is the case where the old
fsrcpath could differ per driver:FAbsand the-0.0 - xnegate may flush denormals or quiet sNaNs. Doingabs/negas integer ops on the raw bits avoids that. The class numbering in the test (bit 0 sNaN through bit 9 +inf) matches the ISA.@Marvisak on GitHub · 2026-11-25 01:22 UTC · original · edited 2026-11-26 01:19 UTC
Automated triage for the maintainers.
Merge candidate (unchanged). The new head is one commit on current
mainand merges cleanly. The change is the same as before. Inemit/lower.rs::Lower::compare(class),v_cmp_class_f32reads the raw operand throughoperand, applies the SDWA selection (sdwa_src+select_bits), and appliesabs/negas bit operations (& 0x7FFF_FFFF,^ 0x8000_0000). The f16 path now shares that modifier code. This keepsfsrc's floatabs/negate from flushing denormals or quieting sNaNs before the class test (#830).v_cmp_class_f32_matches_rdna2invalu_tests.rscovers all ten classes with each modifier combination, plus an SDWA case.CI: passing (
check).Generated by Claude Code
@sinan-cmyk on GitHub · 2026-11-25 02:09 UTC · original
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count change against
main.Offline. I merged head 4f2eee6 onto
mainffe310e(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 21,724 onmain, 21,724 with this PR.No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on
main. The count shows that the change rejects nothing. It does not show whether the output is right.Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 121, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.