shader: do not carry float/FP16 caches across DPP and SDWA moves #136

Manually merged
github merged 1 commit from github-bot/gh-135 into main 2026-12-05 17:25:39 +00:00 AGit
Owner

@⁠SovietBearz0r on GitHub · 2026-12-05 17:16 UTC · original
SovietBearz0r:dpp-sdwa-float-guard → main · +156 −0 · 4 files · 1 commits · merged 2026-12-05 17:22 UTC

The float and native-FP16 value caches were copied to the destination of a v_mov_b32 / v_cndmask_b32 whenever the destination was not SDWA-selected. DPP16/DPP8 lane permutations and SDWA moves that keep dst_sel:DWORD but select a different source word do change the value, so a later FP32/FP16 consumer read the stale cached bits instead of the lowered ones.

Fix

Guard the three propagation sites with v.dpp.is_none() && v.sdwa.is_none() (the plain-destination check stays for clamp/omod-style SDWA destinations). This is the same guard the RDNA3 fork added; upstream commit 985f2af9 ("keep native FP16 chains across v_cmp_f16, v_fma_mix, v_mov_b32, and v_cndmask_b32") is in main, so the bug is live here too.

Verification

  • cargo test -p victory-shader --lib: 323 passed, 0 failed, 2 ignored (~4.5 min), including three new regression tests with native FP16 forced on the test thread:
    • v_mov_b32_dpp_does_not_propagate_stale_float_caches (f32 and f16 DPP moves),
    • v_mov_b32_sdwa_dword_dst_does_not_propagate_stale_float_caches (f32 and f16 SDWA word select),
    • v_cndmask_b32_sdwa_and_dpp_do_not_propagate_stale_f16_vals.
  • Added TEST_NATIVE_FP16 thread-local test override (same pattern as the existing TEST_HW_BVH), so the native-FP16 path is actually exercised.

Source: ReVictory-RDNA3 PR #39 (guards + tests adapted; the tests use this tree's build/run helpers).

**@⁠SovietBearz0r** on GitHub · 2026-12-05 17:16 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/135) `SovietBearz0r:dpp-sdwa-float-guard` → `main` · +156 −0 · 4 files · 1 commits · merged 2026-12-05 17:22 UTC The float and native-FP16 value caches were copied to the destination of a `v_mov_b32` / `v_cndmask_b32` whenever the destination was not SDWA-selected. DPP16/DPP8 lane permutations and SDWA moves that keep `dst_sel:DWORD` but select a different source word do change the value, so a later FP32/FP16 consumer read the stale cached bits instead of the lowered ones. ## Fix Guard the three propagation sites with `v.dpp.is_none() && v.sdwa.is_none()` (the plain-destination check stays for clamp/omod-style SDWA destinations). This is the same guard the RDNA3 fork added; **upstream commit `985f2af9` ("keep native FP16 chains across v_cmp_f16, v_fma_mix, v_mov_b32, and v_cndmask_b32") is in main**, so the bug is live here too. ## Verification - `cargo test -p victory-shader --lib`: **323 passed, 0 failed, 2 ignored** (~4.5 min), including three new regression tests with native FP16 forced on the test thread: - `v_mov_b32_dpp_does_not_propagate_stale_float_caches` (f32 and f16 DPP moves), - `v_mov_b32_sdwa_dword_dst_does_not_propagate_stale_float_caches` (f32 and f16 SDWA word select), - `v_cndmask_b32_sdwa_and_dpp_do_not_propagate_stale_f16_vals`. - Added `TEST_NATIVE_FP16` thread-local test override (same pattern as the existing `TEST_HW_BVH`), so the native-FP16 path is actually exercised. Source: ReVictory-RDNA3 PR #39 (guards + tests adapted; the tests use this tree's build/run helpers).
The float and native-FP16 value caches were copied to the destination of a
v_mov_b32 / v_cndmask_b32 whenever the destination was not SDWA-selected.
DPP16/DPP8 lane permutations and SDWA moves that keep dst_sel:DWORD but
select a different source word do change the value, so a later FP32/FP16
consumer read the stale cached bits instead of the lowered ones.

Guard the three propagation sites on `v.dpp.is_none() && v.sdwa.is_none()`
(the plain-destination check stays for clamp/omod-style SDWA destinations),
and add tests for DPP and SDWA moves and cndmask, with the native-FP16
setting forced on the test thread.

From ReVictory-RDNA3 PR #38 (same guards; its tests adapted).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 17:18:29 +00:00
github manually merged commit 12e9777e4e into main 2026-12-05 17:25:39 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.