Skip to content

Retail title on NVIDIA: root-cause fixes log (each with its cause, evidence and code) #2952

Backlog

Description

@claudetools-gh

A running log of fixes for the retail title where the root cause is shown, the fix is on by default (not behind an env switch), and the result was measured in the world on our machine. Each entry is its own comment below, with the cause, the evidence, the fix (code in the comment when it is ours and small) and what was ruled out. This issue gets updated as entries land.

The goal is that others can take a fix as it is, instead of collecting switches. Workarounds that only hide a symptom (refusing programs, budgets that drop work, barriers added "because it stops hanging") do not go here. If you have an entry of that kind, or a correction to one of ours, please add it in the same format.

Machine: RTX 5070 Ti 16 GB (driver 621.01), Ryzen 7 9700X, 62 GB RAM, Windows 11 26300, render 2560x1440. Tree: nvidia-dev-based lab tree (MacieGx's lab plus our changes).

# Fix Area Effect measured here
1 Loading-art flicker: write guards for cold blocks title_textures.rs 96 flashes in 50 s → 0 in 85 s
2 Direct DXIL division: overflowed quotient gives ±Inf, v_div_fmas_f32 scales by VCC dxil/prelude.rs, dxil/lower_valu.rs GPU tests in both backends; no visual change in the cell
3 Preparation builds a split program's whole form first shaders.rs 0 chained dispatches in every world run
4 Single-record clamp without the 1,024-thread scan indirect_clamp.hlsl/.rs 137 → 135 ms a frame, byte-identical output
5 Map of GPU-written memory waits only for the copy backs it overlaps sparse.rs 5.2 → 7.3 fps (195 → 137 ms; corrected numbers)

AI-assisted.

Activity

  1. claudetools-gh commented on Nov 27, 2026

    @claudetools-gh
    Author

    1. Loading-art flicker: the first write to a cold block reaches the GPU unseen

    Symptom. On the loading art, single frames of black or of the background without the character layer, in a cycle of about 216 frames (96 flashes in 50 s here). Reported also on an RTX 4080 (#2572) and an RTX 3090 (#2917).

    Cause. 7c18bc41 (on nvidia-dev, not on main) makes each look for CPU writes before a submit take only the 2 MiB blocks written in the last hot_for (1,500 ms), while a background walk finds writes to the other blocks later. A block that has gone cold and gets written just before a submit is uploaded late: the GPU reads the stale copy for that frame. Evidence: XCL_WATCH_HOT=0 gives 0 flashes in 85 s, and XCL_WATCH_HOT_MS=10000 also removes them, at a cost in fps.

    Fix (ours, default on): write guards on cold blocks. A block that leaves the hot set is set PAGE_READONLY by a guard thread. The next look reads its write-watch bits one last time, then leaves it alone. The first write to it faults into a lock-free vectored handler, which makes the block writable again, puts it back in the hot set and lets the write retry. So the looks stay as cheap as with 7c18bc41, and no first write is missed.

    XCL's own writers have to open the blocks first: ReadFile (including OVERLAPPED), DirectStorage, physical-page copies and CLZERO emulation. The VirtualProtect/Alloc/Free/Query hooks and cpu_writes know about the guards too, and the title's protect/commit/free calls pin the blocks across the call. About 1,500 lines over 13 files, so we describe it rather than paste it. Ask if you want a part of it.

    Measured: 0 flashes in 85 s and 0 leaks (no block left writable without being hot), with no fps cost against hot looks. The simpler alternative, if you don't need the hot-look speed, is MacieGx's 240037e7, which turns hot looks off by default.

    AI-assisted.

  2. claudetools-gh commented on Nov 27, 2026

    @claudetools-gh
    Author

    2. Direct DXIL division: an overflowed quotient became NaN

    Cause. The direct translator's v_div_scale_f32 returns its source unscaled and clears VCC, so the f32 division sequence (rcp, Newton fmas, v_div_fmas, v_div_fixup) can overflow where the hardware's scaled sequence never does. q = n·rcp(d) becomes Inf, the next fma(-d, q, n) gives -Inf, and the step after that gives NaN. div_fixup then returned that NaN for finite operands. #1144 fixed div_fixup and v_div_fmas_f32 in the HLSL path only; with XCL_DIRECT_DXIL=1 the bug stayed. A NaN in HDR shows as black and spreads through bloom, so we checked it.

    Fix. #1144's rules, ported to dxil/prelude.rs (div_fixup). Each select wins over the ones before it:

    pub fn div_fixup(&mut self, q: Value, d: Value, n: Value) -> Value {
        let (qu, du, nu) = (self.bits(q), self.bits(d), self.bits(n));
        let abs = self.c(0x7FFF_FFFF);
        let (qa, da, na) = (self.and(qu, abs), self.and(du, abs), self.and(nu, abs));
        let x = self.xor(du, nu);
        let top = self.c(0x8000_0000);
        let sign = self.and(x, top);
        let inf = self.c(0x7F80_0000);
        let zero = self.c(0);
        let quiet = self.c(0x0040_0000);
        let signed_inf = self.or(sign, inf);
        let mut r = self.or(sign, qa);
        let q_nan = self.cmp(Pred::UGt, qa, inf);
        r = self.sel(q_nan, signed_inf, r); // overflowed quotient: ±Inf
        let ff = self.c(0xFF);
        let nsh = self.lshrc(nu, 23);
        let en = self.and(nsh, ff);
        let dsh = self.lshrc(du, 23);
        let ed = self.and(dsh, ff);
        let k150 = self.c(150);
        let en150 = self.add(en, k150);
        let under = self.cmp(Pred::ULt, en150, ed);
        r = self.sel(under, sign, r); // exponent gap under -150: ±0
        let d_inf = self.cmp(Pred::Eq, da, inf);
        let n_zero = self.cmp(Pred::Eq, na, zero);
        let to_zero = self.lor(d_inf, n_zero);
        r = self.sel(to_zero, sign, r); // x/Inf, 0/x
        let d_zero = self.cmp(Pred::Eq, da, zero);
        let n_inf = self.cmp(Pred::Eq, na, inf);
        let to_inf = self.lor(d_zero, n_inf);
        r = self.sel(to_inf, signed_inf, r); // x/0, Inf/x
        let zz = self.land(d_zero, n_zero);
        let ii = self.land(d_inf, n_inf);
        let invalid = self.lor(zz, ii);
        let nan = self.c(0xFFC0_0000);
        r = self.sel(invalid, nan, r); // 0/0, Inf/Inf
        let d_nan = self.cmp(Pred::UGt, da, inf);
        let dq = self.or(du, quiet);
        r = self.sel(d_nan, dq, r);
        let n_nan = self.cmp(Pred::UGt, na, inf);
        let nq = self.or(nu, quiet);
        r = self.sel(n_nan, nq, r); // NaN operands, the numerator's first
        self.f(r)
    }

    In dxil/lower_valu.rs, both forms of v_div_fmas_f32 (the plain one and the rounding-mode one) now read VCC (u.get(3), Src::Pair) and select ldexp_f(r, 32) for lanes where it is set, as the HLSL path does since #1144.

    Tested: #1144's gpu_div_fixup_f32_special_cases_and_sign and gpu_div_fmas_f32_scales_by_vcc pass with and without XCL_DIRECT_DXIL=1 (3/3 in each). The VCC test failed on the direct path before the change.

    Not a fix for our dark cell. The black window stayed the same. A follow-up for quotients that come out as 0 or Inf from an unscaled reciprocal will be its own entry once it is measured in the world.

    AI-assisted.

  3. claudetools-gh commented on Nov 27, 2026

    @claudetools-gh
    Author

    4. Single-record clamp: no 1,024-thread scan for one 12-byte record

    Cause. Each two-pass mesh draw of this title (~3,700 a frame, all single-record ExecuteIndirect(DispatchMesh) with no count buffer) bounds its record with indirect_clamp.hlsl's main: one group of 1,024 threads, a prefix scan and about 23 group syncs, all for one record.

    Fix. A second entry point in indirect_clamp.hlsl, chosen in bound_within when max == 1 && count_buf == 0. Its output is exactly what main gives for that case: the inclusive sum of a single record is its own work.

    [numthreads(1, 1, 1)]
    void single_record() {
        for (uint k = 0; k < stride; k += 4)
            bounded.Store(k, source.Load(source_at + k));
        uint3 a = source.Load3(source_at + action_at);
        uint work = clamp_args(a);
        if (work > budget) {
            if ((kind & 0xFF) <= 1)
                a.y = 0;
            else
                a = uint3(0, 0, 0);
        }
        bounded.Store3(action_at, a);
    }

    The pipeline is made on first use from the same root signature, and falls back to main if it fails.

    Tested: a GPU test runs both entry points over 8 cases and compares every output byte: a normal record, garbage (0xFFFFFFFF), zero, over budget, exactly at budget, fold, and draws with fields outside the action.

    Measured: in the world, frames 3000–3600 take 134–135 ms against 137 ms. It is small, but it holds across runs.

    AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions