victory-shader: flush denormal inputs in v_cube* instructions #623
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!623
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-623"
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?
@SalmanBarkat on GitHub · 2026-11-27 14:42 UTC · original
SalmanBarkat:fix/cube-ftz-denormals→a-publier· +75 −1 · 2 files · 1 commits · openThe DXIL lowering of \_cubeid_f32, \_cubesc_f32, \_cubetc_f32, and \_cubema_f32\ fed raw float coordinates into major-axis comparisons and coordinate arithmetic. Adapters that preserve 32-bit denormals treated subnormal axes as nonzero magnitudes and propagated un-flushed denormal results, diverging from the console's FTZ float mode.
Summary
Verification
@lvndrpup on GitHub · 2026-11-27 15:38 UTC · original · reviewed
Tested on an RTX 3060 Ti (Windows 11, debug build), base
4eb6cfdagainst head144e1ed.4eb6cfd144e1edcube_denormal_coordinates_flush_to_zero, copied onto basehardware: v_cubesc_f32 case 0 got 0x80000001(thev_cubeid_f32cases pass)cargo test -p victory-shader --libcargo clippy -p victory-shader --all-targets -- -D warnings, with and without--all-featuresOn this card the base already picks the face you expect for a denormal axis, but it passes the denormal through to the coordinate:
v_cubesc_f32of(-denormal, 0, 0)comes out-denormalinstead of-0. So the card treats it as zero in the comparisons and keeps its bits where the value is only moved. With the flush, the two agree.One question about the premise. Whether the console flushes these inputs depends on the program's float mode, which the translator doesn't model:
lower.rs:5803says so ("MODE is not modelled").valu_tests.rs:1694was measured "with f32 denormals kept".s_denorm_modeis dropped atir.rs:1486.The program's
FLOAT_MODEis inCOMPUTE_PGM_RSRC1, whichnative.rsalready reads for the VGPR count. For a program that runs with f32 denormals kept, this flush would makev_cube*differ from the console. I can't check here which mode titles use.It conflicts with #618, #611, #578 and #502, all in
valu_tests.rs. With #618, both PRs add a test at the end of the file.@SalmanBarkat on GitHub · 2026-11-27 16:06 UTC · original
That is a good distinction to call out. Two notes from checking the tree:
@lvndrpup on GitHub · 2026-11-27 16:57 UTC · original
@SalmanBarkat Your comment stops partway through note 1 ("…comparisons treated that axis as"), and note 2 is missing. Could you post the rest? Note 1 matches what I saw on the RTX 3060 Ti:
v_cubesc_f32gave0x80000001for that input before this PR and-0with it.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.