Repository navigation
Conversation
The console's float mode reads f32 denormal operands of v_min/max/min3/max3/med3_f32 as zeros of their sign. The translation left that to the host, whose denormal mode varies, and v_med3_f32 took -0 and +0 in whatever order the host's FMin/FMax gave. Port of the min/max/med3 part of upstream Marvisak/VIctory 77053a0: `ftz` decides the flush on the bits, `max_min` flushes and orders -0 below +0, and `med3` is built from the same ordered minimum and maximum. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
towiice
left a comment
There was a problem hiding this comment.
Verified on Windows 11 (NVIDIA GeForce GTX 1650 SUPER, 4 GB Turing TU116, driver 610.88 + Microsoft Basic Render Driver / WARP):
- \cargo test -p victory-shader --lib min_max_and_med3_read_denormals_as_signed_zeros: 1 passed; 0 failed (111.77s)
Expanding the \�_min_f32\ / \�_max_f32\ / \�_med3_f32\ flush-to-zero check ((m.2 & 3) == 0) to also flush denormal operands when \�bs == 0 && neg == 0, and routing \�_med3_f32\ through pairwise \min/\max\ under \32 != 3\ so each input is flushed before comparison, behaves cleanly on Turing + WARP.
|
RTX 3070 Ti 8 GB (32-lane waves), Windows 11, Series X profile. Tree: this fork with Emiriley's With this PR the main character's hair breaks. In the prologue cell, with a warm cache and in steady state, the hair is drawn as scattered shards with a dark wedge through it, and draws per frame drop from about 5,100 to about 3,400. Reverting only this PR's merge (and nothing else) brings the hair back to normal on the same cache and camera position. Offline, the hair-strand program is where it changes. I translated the 70 programs whose names contain "hair" with So any operand whose exponent bits are zero is replaced by a signed zero. My guess is that this program runs A possible way forward: limit the flush to operands known to be floats, or put it behind a switch until the console's denormal mode for these instructions is confirmed. Hashes and counts only, nothing from the game. AI-assisted (Claude Code). |
…pload memory read together, on by default A list's fills of upload memory from title memory (constants a few hundred bytes long, some 12,000 a world frame) were each a kernel read of their own. Between two steps that write title memory, a submission's fills from all its lists are now gathered, sorted by where they read, and the ones less than 4 KiB apart are read by one kernel call (spans of 1 MiB at most) and handed out from there. A span the kernel cannot read whole goes fill by fill as before. Ordering against title writes is unchanged: the fills are done before any step that writes title memory and at the submission's end. On by default as PalmVIDev fxceless#245 ships it (EricPlayZ measured the submitting thread's copies at 37.5 -> 31.4 ms a frame on an RTX 2070 SUPER); VICTORY_JOIN_FILLS=0 turns it off. Ported into this tree's unsplit host.rs (PalmVIDev has it in host/list_ops.rs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017V7WBA8CxPD68KngjiMeJb
|
RX 7900 XTX (RDNA3), Windows 10 + #402, main |
Refs #136: the "fp32 denormals and the sign of a flushed zero (
v_min/max/med3_f32)" row.Problem. The console's float mode reads an f32 denormal operand of
v_min/max/min3/max3/med3_f32as a zero of its sign. The translation left that to the host's denormal mode, which varies. Andv_med3_f32didn't order -0 below +0 the wayv_min/max_f32already do here: it used the host'sFMin/FMaxdirectly.Change. A port of the min/max/med3 part of upstream Marvisak/VIctory
77053a0("accuracy fixes for discards, f16 rounding, denormals, med3 and signed zeros"). The fork's code here still matched upstream's from before that commit.ftz: an f32 denormal becomes a zero of its sign, decided on the bits.max_minflushes both operands, then callsmax_min_flushed, the existing -0-below-+0 ordering.med3flushes its three operands and is built frommax_min_flushed, so its median orders -0 below +0 too. The fork's NaN rule (the minimum of the three) is unchanged.The f16 forms (
v_max/min/med3_f16,v_pk_min/max_f16) go through the same helpers on values widened to f32.ftznever changes those, since the smallest f16 denormal (2^-24) is a normal f32.The rest of
77053a0is out of scope: discards, the f16 rounding mode, output modifiers, the FMA probe, and its test file.Test.
min_max_and_med3_read_denormals_as_signed_zerosruns all five instructions over every triple of seven values on the hardware adapter and WARP: ±0, ±denormal, the largest denormal, the smallest normal, and -1. Each result is compared bit for bit with a CPU reference that flushes and orders -0 below +0.Results on an AMD Radeon RX 7700 (RDNA3, 16 GB, driver 32.0.32029.2010) and WARP, Windows 11:
main(4e17478)v_min35,v_max35,v_min350,v_max337,v_med366Examples on
main(WARP):v_min_f32(-0, +denormal) = +0, want -0. WARP flushes the denormal, so the -0/+0 rule never sees two zeros.v_med3_f32(+0, +0, -0) = -0, want +0. No denormal is involved: the median ignored the zero ordering.This RX 7700 is not affected. It already gives the console's result in all 343 cases for all five instructions. The fix is for hosts that don't flush, plus CI's WARP adapter. Upstream's
77053a0names an RX 6700 XT (RDNA2) as one that doesn't flush, which suggests RDNA3 and RDNA2 drivers differ here. I haven't tested an RDNA2 card or NVIDIA.cargo test --workspace --locked: 497 passed, 0 failed, 7 ignored (main's 496 plus the new test).cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings: clean.cargo xtask policy: ok.cargo fmt --checkadds no differences in the two changed files beyond whatmainalready has.AI use: Claude Code (Claude Opus 5.5) found the upstream fix, wrote the port and the test, and ran them on my card; opened at my request.
🤖 Generated with Claude Code