Shaders: round scaled and normalized D16 buffer loads to nearest even #2843
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!2843
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2843"
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?
@dooprazol on GitHub · 2026-11-25 22:02 UTC · original
dooprazol:fix/d16-buffer-rounding→main· +58 −8 · 2 files · 3 commits · openUse the existing bitwise narrowing implementation for scaled and normalized D16 buffer loads. For example, 2051 rounds to 2052. The synthetic shader regression failed before the fix and passed afterward. On
b2a97b1, cargo test --locked -p victory-shader passed on Linux with 166 passed and 3 ignored. On the initial base, cargo test --workspace failed during Linux compilation on both clean and patched trees.The Windows shader tests were type-checked. No RX 9060 XT dispatch or gameplay was tested. The device-loss reports remain open.@oni-swr on GitHub · 2026-11-25 22:29 UTC · original
Independent Windows verification of
a0a2e525against currentmain(f3578e38).main, the assertion failed because the lowering still emittedlegacyF32ToF16. This check inspects the emitted code.0x1414:0x008c, software flag0x2) with the SDKdxil.dllconfigured. The full suite was not rerun with this harness change.Claude Code (claude-opus-5-5) ran the shader suites and rebuilt the PR after detecting stale Cargo artifacts. Codex (gpt-6.2-sol) checked the corrected logs, ran the targeted main comparison and verified the adapter with the focused WARP run. Synthetic data only.
@fuzeofficlal on GitHub · 2026-11-25 22:47 UTC · original
Reviewed and verified
a0a2e525on Windows 11 (RTX 5090 + WARP +dxil.dll) againstmain(f3578e3):narrow16intonarrow16_bits(f, rtz)and routingd16_channels(Uscaled | Sscaled | Unorm | Snorm) throughnarrow16_bits(f, false)cleanly enforces portable IEEE round-to-nearest-even (including±0.0,±Inf, quiet NaN payload, subnormal sticky bit, andUSCALED65520..=65535 -> +Inf) regardless ofVALU MODE, while keepingUint/Sint(& 0xFFFF) andFloat(legacyF32ToF16) intact.cargo test --locked -p victory-shader --lib d165/5 passed (includingd16_scaled_buffer_load_uses_portable_roundingand the updatedtbuffer_d16_loads_pack_two_channels_per_dword),emit::lower::tests34/34 passed,cargo clippy --locked -p victory-shader --all-targets -- -D warnings0 warnings,cargo xtask policy(190 files ok).crates/victory-shader/src/emit/lower.rsis at521,634bytes (2,654bytes under the 512 KiBxtask policycap).a0a2e52) that also adds#[cfg(windows)]on 3Validator::loadsites inlower.rs— rebasing ontomainwould keep the history linear.d16_channels); image D16 paths are untouched.@dooprazol on GitHub · 2026-11-25 22:51 UTC · original
Confirmed on Windows 11 with a Radeon RX 9060 XT 16 GB at
a0a2e525. The focused tbuffer_d16_loads_pack_two_channels_per_dword test passed (1 passed, 0 failed). Local DXGI logging identified the physical adapter as warp=false name=AMD Radeon RX 9060 XT. WARP also ran separately.The numerical checks included 2051 → 2052, −2051 → −2052, and 2049 → 2048. This run used synthetic buffer data only.
@Marvisak on GitHub · 2026-11-26 03:24 UTC · original
Automated triage for the maintainers.
Verdict: needs work. The code does what the title says. In
crates/victory-shader/src/emit/lower.rs,narrow16is split intonarrow16_bits(f, rtz), and the D16 packing loop sendsUscaled/Sscaled/Unorm/Snormchannels throughnarrow16_bits(f, false)instead oflegacyF32ToF16.FloatkeepslegacyF32ToF16and the integer formats keep the mask. It merges cleanly.What is missing is evidence for the console behaviour it encodes. This changes emulation results, and the tests (
tbuffer_d16_loads_pack_two_channels_per_dword's new rows,d16_uscaled_keeps_nearest_even_in_valu_rtz_mode) check the emitted conversion against the values the PR expects (2051 to 2052, and RNE under MODE RTZ), not against the console. Please point to something that shows the console's D16 format conversion rounds to nearest even and ignores the VALU MODE round bits: a hardware capture, the public ISA documentation, or the title's own data depending on it. Two further points: why shouldFloat(f32 data narrowed to f16) still use the host'slegacyF32ToF16rounding when the scaled and normalized formats do not? And the#[cfg(windows)]additions on the threeValidator::loadtest sites are unrelated, so they would fit better in a separate PR.CI: not run on this head yet (awaiting workflow approval).
Generated by Claude Code
@kotekompotek on GitHub · 2026-11-25 22:11 UTC · original · reviewed
Correct: D16 conversions of scaled/normalized formats are always round-to-nearest-even in the ISA — VALU MODE's rtz applies only to explicit v_cvt_f16_f32. narrow16_bits parameterizing the direction keeps the MODE-sensitive path and the fixed-RNE path sharing one implementation. The legacy_half_conversion test flag checks the right observable. LGTM.
@AwsAli05 on GitHub · 2026-11-25 23:15 UTC · original · reviewed
The focused portable-rounding test passed on Windows at
a0a2e525. The distinction between fixed D16 rounding and VALU's configurable rounding is the part I would pin with a second case. Run the same halfway USCALED load after selecting round-toward-zero with the existing MODE fixture. 2051 should still produce 2052. That would catch accidentally routing this path through mode-sensitivenarrow16, which would still satisfy the current check for absence of the legacy DXIL conversion.AI-assisted review and test.
@Jackster on GitHub · 2026-11-26 16:06 UTC · original · edited 2026-11-26 16:08 UTC
AMD check on a Radeon RX 7900 XTX (gfx1100, 32.0.32029.2010),
victory-shaderbuilt with--features host:63bcca4: 2 of 6d16_cases fail on the hardware backend (format 9 of0x00000803→0x00006801, want0x00006802).Synthetic only. AI-assisted.
@kilolimaVI on GitHub · 2026-11-26 20:53 UTC · original · edited 2026-11-26 20:55 UTC
NEW-284 verification on current head, Windows 11, toolchain 1.98.1,
--test-threads=1, AMD Radeon 780M (RDNA3 iGPU) and WARP (VICTORY_WARP=1).cargo test -p victory-shader -p victory-gpu --locked --no-fail-fast: no failures on the 780M; on WARP only the four synthetic_tests failures main63bcca4also has (fixed by #2225).d16_scaled_buffer_load_uses_portable_rounding,d16_uscaled_keeps_nearest_even_in_valu_rtz_mode.AI-assisted (Claude).
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.