Shaders: preserve round mode changes in whole-wave sections #2884
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2886"
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?
Imported from Marvisak/VIctory. Originally posted by yumaste on 2026-11-25T23:04:58Z.
## Summary
Whole-wave sections use a separate lowering path for their body. A rounding-mode write inside that body was skipped by the block's instruction-by-instruction tracking, so later FP16 conversions in the same block could use a stale mode.
Apply the existing
round16_aftertransfer function to instructions in the section as well. Add a synthetic compute regression that selects round-toward-zero withs_round_modeand restores round-to-nearest-even withs_setreg_imm32_b32in a second section. Both conversions run after EXEC is restored.Validation
0x3c00instead of truncating to0x3bff. The negative case also failed.victory-shaderwith all targets and features and warnings denied.AI-assisted (Codex). Validation used synthetic shaders only.
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T23:34:37Z.
Review: COMMENTED
Correct: a MODE write inside a whole-wave section must take effect for the remaining section instructions — tracking round16_after per j while walking the section does that, and the test covers both s_round_mode and s_setreg restoring default. The before-behavior (entry mode for the whole section) was observably wrong for sectioned mode changes. LGTM.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T23:10:35Z.
Reviewed and verified
2aa17674on Windows 11 (RTX 5090 + WARP +dxil.dll) againstmain(842b0cb):self.mode16 = round16_after(&p.blocks[b].insts[j], self.mode16)right aftersection_instinside the whole-wave section loop preserves exact post-instruction rounding-mode semantics (s_round_mode/s_setreg_imm32_b32(HW_REG_MODE)).semantics_tests35/35 passed (includingwhole_wave_sections_keep_rounding_mode_changeson RTX 5090 + WARP +dxil.dll),emit::lower::tests33/33 passed,cargo clippy --locked -p victory-shader --all-targets -- -D warnings0 warnings,cargo xtask policy(191 files ok;emit/lower.rs=520,652bytes).Clean 1-line fix, ready to merge.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T04:28:45Z.
Automated triage for the maintainers.
Merge candidate. The lowering loop in
emit/lower.rsnow updatesmode16withround16_afterfor instructions inside whole-wave sections, so ans_round_modeor MODEs_setreginside a section is no longer lost for the rest of the block; this matches the block-entry analysisround16(), which already counts them. The test decodes correctly per the RDNA2 ISA and expectsv_cvt_f16_f32results to follow the mode per section.CI: passing.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T09:28:52Z.
Review: APPROVED
Verified on RTX 5090 & WARP against
origin/main(63bcca4):cargo test -p victory-shader --lib whole_wave_sections_keep_rounding_mode_changes -- --test-threads=1: passed on RTX 5090 and WARP.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Clean one-line fix preserving rounding mode updates across whole-wave sections.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T10:32:34Z.
Review: APPROVED
Updating
self.mode16 = round16_after(&p.blocks[b].insts[j], self.mode16)inside the whole-wave section loop (emit/lower.rs:1372) aligns in-block lowering with the existinground16()block-entry analysis, and the regression verifies boths_round_modeands_setreg_imm32_b32mode changes before restoringEXEC.git merge-treeagainst currentmain(63bcca43) is clean, andemit/lower.rsis520,652bytes (under the 512 KiB limit).Verified locally on Windows 11 x64 (RTX 5090 + WARP +
dxil.dll,2aa17674):cargo run --locked -p xtask -- policy: passed (191 files ok)cargo clippy -p victory-shader --all-targets --locked -- -D warnings(default and--all-features): cleanwhole_wave_sections_keep_rounding_mode_changes -- --test-threads=1(RTX 5090 andVICTORY_WARP=1): 1 passed, 0 failed on bothView 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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.