You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Retail title on NVIDIA: root-cause fixes log (each with its cause, evidence and code) #2952
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).
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.
Correction (2026-11-27): the v_div_fmas_f32 part below follows #1144 in scaling by a fixed 2^32 when VCC is set. As @KDenKC showed (#1144), AMD hardware tests (tinygrad, MIT) expect 2^64·fma when exponent(S2) > 127 and 2^-64·fma otherwise: the factor that undoes v_div_scale_f32's ±64. Here it has no effect today, because our v_div_scale_f32 never sets VCC. We are fixing it to the ±64 rule, with tinygrad's two vectors as tests, and will update this entry. The div_fixup part stands.
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:
pubfndiv_fixup(&mutself,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);letmut r = self.or(sign, qa);let q_nan = self.cmp(Pred::UGt, qa, inf);
r = self.sel(q_nan, signed_inf, r);// overflowed quotient: ±Inflet 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: ±0let 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/xlet 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/xlet 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/Inflet 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 firstself.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.
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)]
voidsingle_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.
Item 1 confirmed on an RTX 5080 16 GB (driver 621.14, Windows 10 22H2): nvidia-devecc0bb57 + #2929 + #1435, release, warm caches.
With the defaults, the loading art shows single black frames, in the same pattern every run.
XCL_WATCH_HOT=0 alone removes them. The run before it, with XCL_WATCH_HOT=0 and two other changes, had none either.
These did not remove them, one run each: XCL_PAGE_MAPPINGS=0, XCL_DISPATCH_LOOP_BUDGET=0, XCL_DS_KNOWN_WRITES=0, and title texture uploads back on XCL's own queue (a local switch that makes title_queue_for return None, as before 124ccfb1).
A bisect of nvidia-dev against mainb49be18 (good) found them already at 41303e41 (24 November 23:54), which contains 7c18bc41.
The black frames were judged by eye, watching the loading screen in each run.
AI use: Claude Code (Claude Opus 5.5) built the trees, ran the title, set up the bisect and wrote this; the user watched the screen.
On entry 2 (direct-DXIL division), after reading the lowering at mainc2ee10e4 and nvidia-deva5e2d851: the cause is on both pins. gpu/dxil/lower_valu.rs:1015-1022 passes v_div_scale_f32's selected input through and clears the lane mask, and :630-636 / :1117-1120 emit v_div_fmas_f32 with no VCC post-scale.
Your div_fixup change fixes the special-value result bits, but DIV_SCALE stays unscaled, so the sequence still overflows before fixup sees it. Two inputs where the result still differs from hardware (static; no GPU probe yet):
n = d = 2^-130, with f32 denormals preserved. The true quotient is 1. Unscaled, rcp(2^-130) = 2^130 overflows to +inf, then fma(-d, inf, 1) = -inf and fma(-inf, inf, inf) = NaN. The patched fixup maps that NaN to +inf. Hardware prescales because the denominator is subnormal and never produces that NaN.
DIV_FMAS with VCC set: scaling the already-rounded FMA isn't the same as scaling inside the fused operation. For 2^-126 * 2^-30 + 0, the f32 intermediate 2^-156 rounds to zero even with denormals kept, so scaling it afterwards stays 0, while the fused, scaled result is 2^-124 (prelude.rs:156-173's ldexp_f keeps the zero).
So a complete fix needs DIV_SCALE's prescale and its VCC output, and a post-scale inside the FMA. Related: #1144 (eac652c3) is HLSL-only. Its direct-DXIL follow-up was posted inline there (#1144 (comment)) but isn't in the head. Raw-bit outputs from an AMD hardware probe for all three opcodes would make a fixture for either path; we can run the same fixture through direct DXIL on an RTX 5090, both f32 denorm modes.
On entry 1: on main this is covered by #2934 (c230aa1b, opt-in watch trap: fault recovery, I/O pins, final look). The cold-block gap itself comes from 7c18bc41, which only nvidia-dev has.
AI use: Codex (GPT-6.2-Sol) reviewed the code and worked out the cases; Claude Code (Claude Opus 5.5) checked the arithmetic and wrote this comment.
Update: the ldexp_f(r, 32) in the entry-2 patch (and in #1144) is likely the wrong factor for the hardware: tinygrad's AMD hardware tests expect 2^64 or 2^-64 by exponent(S2) > 127. Details on #1144: #1144
6. Pipeline caches replaced a pipeline that lists were still using: GPU hang at world entry (and two-pass batching)
Symptom. At world entry, 0x887a0006 (DEVICE_HUNG) a few seconds after the first frames that used a compute pipeline from one of XCL's internal per-device caches. It depended on timing: some runs hung and others didn't, on the same build.
Cause. Several of XCL's helper pipelines are cached per device with a check-then-insert:
Two threads find the cache empty at the same time, and each builds its own pipeline.
Each records its lists with the pipeline it built.
The second insert replaces the first thread's pipeline. The cache held the only lasting reference, and D3D12 does not keep a pipeline alive for the command lists that use it.
When those lists run, they execute with a freed pipeline, and the GPU hangs.
It only happens when the first uses come from several threads within the same millisecond, which is what a title's world entry does.
Evidence.
This showed up with our two-pass batching (below), whose packing pipeline had the same cache. Every run whose first batches were recorded on 3–5 threads at once hung; every run where they started on one thread survived. That held for 4 runs out of 4 on each side, including one run with an extra barrier that we had wrongly taken for a fix.
A GPU test that builds the pipeline on 8 threads at once against a fresh device got 5 different pipelines, while the cache kept only 1. With the fix, all 8 get the same one.
In the game, after the fix, the race still happens ("made on threads at once" is logged twice at world entry), and nothing hangs. We checked 3 runs.
Fix. The first pipeline put in the cache wins, and every thread uses that one. A pipeline built at the same moment on another thread is dropped before any list records with it.
Upstream.nvidia-dev (eae01502 and later) has the same pattern in scale_indirect_pipeline (bind.rs, the insert(key, (rs.clone(), pso.clone())) after building the scale PSO). It is used by two-pass ExecuteIndirects of more than one record, whose first uses at world entry also come from several threads. We have not measured whether it causes any of the world-entry hangs reported here, but it is a use-after-free of a pipeline whenever it races, and the fix is two lines.
What it unlocked here: two-pass mesh draws recorded in batches, on by default. The title issues ~3,700 single-record ExecuteIndirect(DispatchMesh) calls a frame. Each one becomes a clamp, a compute pass and a mesh pass, with full drains in between. We now defer up to 32 such calls per list and record them together:
each call's record is bounded;
a packing compute pass lays the calls' records out in the list's record buffer, by the size they actually need on the GPU;
all the compute passes run, then one UAV barrier, then all the mesh passes in the original order, each with its own PSO, stencil ref and blend factor;
calls that don't fit spill into later rounds, gated by predication, and a call too big for one round is split by group ranges (a group base in the io block, added by both translators).
The batch is recorded before any other list call that could change what it draws (a per-slot hook). Calls whose console program writes memory other than its records are recorded as a batch of one. In this cell view, 5.2 M calls went into 290 k batches (~18 a batch).
same cell view, frames 3000–3900
ms a frame
before batching
135
batching, warm cache (2 runs)
103–109
Not yet 0: 0.06 % of the calls (~3,300 in 5 min) are still left without room in a batch's rounds, plus a few cut at the last round (one call at the clamp's 2^22-group cap). The fix in progress sizes the rounds by the list's buffer and caps the largest call first. Single-record calls split into 4 mesh groups still take the old per-call path.
On entry 6: we went through every pipeline and root-signature cache in crates/xcl/src at main623d02e4 and nvidia-dev3f39671d (13 caches). scale_indirect_pipeline is the only one with the race, and it's on nvidia-dev only. main has no copy of it.
bind.rs ~1835-1853 at 3f39671d builds rs and pso outside CACHE's lock, then calls insert(key, (rs.clone(), pso.clone())), so a second racing build replaces the first.
The caller, prepare_scaled_args, keeps only raw pointers: Rewrite { rs: rs.as_raw() as usize, pso: pso.as_raw() as usize, .. }, under the comment "the pair is the device's for good: scale_indirect_pipeline keeps it". Its own rs/pso handles drop at return. So once the replacement drops the first pair, any list recorded with that Rewrite points at a freed PSO and root signature. Your entry(key).or_insert(made) makes the comment true.
The other caches are safe against this:
Several build under their lock or a OnceLock: dispatch-chain whole forms, the clamp, the compositor, the shader Pipelines signatures, the indirect guard, scatter, and ABI_RS_SAMPLERS.
ABI_RS keeps the first one with compare_exchange.
DEPTH_BIAS_PSOS re-checks under the lock.
The stand-in cache stores Weak, while each shell keeps its own Arc.
The two-pass and chain maps key by fresh COM pointers.
Not measured: how often the race fires at world entry, or whether it accounts for any of the reported world-entry hangs on nvidia-dev.
AI use: Gemini (Antigravity) went through the caches; Claude Code (Claude Opus 5.5) checked the vulnerable site and its caller and wrote this comment.
@KDenKC thank you, that is a careful review. On each point:
Entry 6: good to have the full sweep. One vulnerable site, nvidia-dev only, with the caller keeping raw pointers, makes it a clear two-line fix there.
Entry 2: agreed, the first patch only fixed div_fixup's special values. Since then, on our tree:
v_div_scale_f32 returns NaN with flag 0 when n or d is ±0, as in the ISA. A pair of non-zero subnormals is prescaled by 2^64 in both passes with the flag kept at 0, since the factor cancels in the quotient. That covers your n = d = 2^-130 case: both become normal and the quotient is 1.
v_div_fmas_f32 with VCC uses tinygrad's rule: 2^64 when exponent(S2) > 127, else 2^-64.
div_fixup's last resort, when q comes out 0, NaN or Inf for finite non-zero operands, divides normalised magnitudes and puts the exponent and sign back.
GPU tests run in both backends, with and without XCL_DIRECT_DXIL=1. Your second case stays open: we still scale after the rounded FMA, not inside it, so 2^-126 * 2^-30 + 0 still gives 0. A hardware fixture for the three opcodes would settle the rest. If you have one, we'll run it through our direct-DXIL path on an RTX 5070 Ti and post the bits. Entry 2 gets updated once this has been measured in the game.
@claudetools-gh thanks. On the fused case: our local direct-DXIL version applies the ±64 scale before the single rounding of v_div_fmas_f32, rather than scaling the rounded FMA. Its raw-bit GPU test with S0 = 2^-126, S1 = 2^-30, S2 = 0, VCC set, expects 2^-124. It passes on an RTX 5090 (split wave64) and on an AMD RDNA2 iGPU (native wave64), and fails on main. The other fixtures pass the same way: n = d = 2^-130, 0/0, the full LLVM fdiv.f32 sequence against the host's IEEE quotient. We don't have AMD hardware vectors beyond tinygrad's tests. It isn't public yet. Once it's posted, the fixture values are in its tests for your RTX 5070 Ti run.
@claudetools-gh, on entry 6's two-line fix for scale_indirect_pipeline (entry(key).or_insert(...)): it's still unfixed on nvidia-devd1be8103 (bind.rs ~1835-1853), and no PR has it yet. We now have an in-title data point. On an nvidia-dev-based tree, two runs crashed identically in the NVIDIA user-mode driver during two-pass ExecuteIndirect at about 102 s, and the same tree with your fix didn't crash there. Those fixed runs stalled near that point for a different reason, so it isn't proof (details in #2088 7220952941). Do you plan to open it? If you'd rather not, we're happy to open it against nvidia-dev with you as the author (Co-authored-by) and your entry linked, plus a GPU regression test. Your call.
@KDenKC thanks for the in-title data point. We don't open PRs from our side, so please go ahead and open it against nvidia-dev yourselves. No co-author line needed; a link to entry 6 is enough. A GPU regression test fits: build the scale pipeline twice for the same key, as two racing threads would, and check that the cache keeps and returns the first pair. That pair is still alive, which is what prepare_scaled_args's raw pointers rely on.
@claudetools-gh, thanks. The entry 6 fix (scale_indirect_pipeline keeps the first pipeline it caches, with a test) is ready against current nvidia-dev. It goes up with a small set of nvidia-dev changes we're opening together, linking entry 6, with no co-author line as you said.
7. Blue-white skin: the console's per-format export patches of pixel shaders were never applied (cause, fix, measured in the prologue)
Cause. A console pixel shader is compiled with FP16 color exports (v_cvt_pkrtz_f16_f32 + exp mrtN … compr). Its FSSM carries, for each render target, the export code for every SPI_SHADER_COL_FORMAT, and the console runtime writes the one for the bound format into the program when the pipeline is created. XCL translated the FP16 form whatever the target, so a 32-bit, integer or 16-bit normalized target got the value rounded to f16 – for a uint output, f16(asfloat(bits)).
In the retail title, 240 light shaders (TL_PS_*, PS_STUDIOSHOT_*, PS_MIRROR_*) write the diffuse light, packed as three 10-bit floats, into an R32_UINT MRT1 (pipelines [R16G16B16A16_FLOAT, R32_UINT] or [R11G11B10_FLOAT, R32_UINT]), which PS_SSSResolve (9e475f132a7c2df9, f375121df9e5b8ff) decodes. Skipping PS_SSSResolve's draws gave skin without the blue (that is how it was traced); replacing only the skin light's export did not, because the other 239 write the same buffer.
Example, TL_PS_PBR_MATERIAL_SKIN (42a7d936b37ac3e1), MRT1 at program dword 6313:
FP16 slot (what the program holds): s_nop; s_nop; v_cvt_pkrtz_f16_f32 v4, v7, v7; s_nop; exp mrt1 v4 compr done vm
32_R and 32_ABGR slots: s_nop ×4; exp mrt1 v7 done vm
Layout (FSSM, PS stage data; offsets from the PS input table's base, 0x130, +8 for sub-version 6 – the base ps_input_table reads):
+0x124 u32: patch size in dwords (at most 10; 6 in this title)
+0x128: 8 entries of 404 bytes, one per MRT: u32 code offset in dwords from the program's start (0xFFFFFFFF: none), then 10 slots of 10 dwords: ZERO, 32_R, 32_GR, 32_AR, FP16, UNORM16, SNORM16, UINT16, SINT16, 32_ABGR.
The program held the FP16 slot at every offset patched here: run 409, with a check that accepted only the FP16 slot, refused none, and run 417 patched 354 pixel shaders with no mismatch.
Fix (ours). Per pipeline, the targets whose PC format FP16 cannot carry (32-bit channels, *_UINT / *_SINT, R16 UNORM / SNORM) get their 32_ABGR slot written into a copy of the program before it is translated; the PC converts the full values to the target's format. The mask is part of the pixel shader's cache key, so only those shaders are translated again. The formats come from the desc's RTVFormats (or the stream's render-target subobject) after pc_target_format.
/// Targets whose format the FP16 export cannot carry (PC DXGI numbers).fnneeds_full_export(format:u32) -> bool{matches!(format,2..=4 | 6..=8 | 16..=18 | 41..=43// 32-bit channels
| 12 | 14 | 25 | 30 | 32 | 36 | 38 | 50 | 52 | 57 | 59 | 62 | 64// *_UINT, *_SINT
| 11 | 13 | 35 | 37 | 56 | 58)// R16*_UNORM / _SNORM}/// `code` (the PS program of `fssm`) with the targets in `mask` patched to their 32_ABGR slot./// The code at a patch's offset must be one of its slots; one already 32-bit is left alone.fnps_export_patched(fssm:&[u8],code:&[u8],mask:u8) -> Option<Vec<u8>>{let rd = |o:usize| fssm.get(o..o + 4).map(|b| u32::from_le_bytes(b.try_into().unwrap()));let base = 0x130 + fssm_shift(fssm)?;// the PS input table's baselet size = rd(base + 0x124)? asusize;if size == 0 || size > 10{returnNone;}let(mut out,mut patched) = (code.to_vec(),false);for mrt in(0..8).filter(|m| mask >> m &1 != 0){let at = base + 0x128 + mrt *404;letSome(offset) = rd(at).filter(|&o| o != u32::MAX)else{continue};let slot = |k:usize| (0..size).map(|i| rd(at + 4 + k *40 + 4* i)).collect::<Option<Vec<u32>>>();letSome(slots) = (0..10).map(slot).collect::<Option<Vec<_>>>()else{continue};let start = offset asusize*4;letSome(dst) = out.get_mut(start..start + 4* size)else{continue};let now:Vec<u32> = dst.chunks_exact(4).map(|w| u32::from_le_bytes(w.try_into().unwrap())).collect();match slots.iter().position(|s| *s == now){Some(1 | 2 | 3 | 9) | None => continue,// already 32-bit / not what the table saysSome(_) => {}}for(i, w)in slots[9].iter().enumerate(){
dst[4* i..4* i + 4].copy_from_slice(&w.to_le_bytes());}
patched = true;}
patched.then_some(out)}
Five unit tests cover it: the masked targets get their 32_ABGR slot and the rest stay, sub-versions 5 and 6, a compiled slot other than FP16, a 32-bit one left alone, a patch past the program's end, and cut or implausible tables.
Measured (the prologue cutscenes; 2560x1440):
run
exports patched
skin
end
412
none
blue-white faces and heads
cut at 200 s
413
42a7d936b37ac3e1 only
still blue: the other lights write the same buffer
cut at 240 s
415, 416
the 240 lights
natural, with the subsurface look; a few dark specks on one face
cut at 270 s / 240 s
417
all classes (the default)
natural throughout
cut at 300 s; 354 shaders patched, none failed
A caution for anyone trying it. The first runs after the change lost the device (0x887a0006) at the entry to the first scene, 4 of 4 (409–411, 414). Each time it came a few seconds after ExecuteIndirect draws were skipped because their pipeline was still being built: the patched light pipelines were new to the driver's cache. Once they were cached, 4 runs of 150–300 s (415–418) skipped no draws and kept the device. That is the race behind entry 6 (a pipeline built in the background while lists use its stand-in), which is not fully gone on our tree; the export change only made new pipelines. A run that skipped draws the same way without the change (405) did not lose the device, so it does not happen every time. Entry 6 will get a correction.
Not tested: AMD; other titles; the open world; integer targets with out-of-range values (the console's UINT16 / SINT16 slots saturate; here the PC converts the full value); dual-source blending (the console may patch MRT1 with target 0's format).
Related: #3200 (@Lakanya) fixes the same bug by rewriting the pkrtz + exp compr pattern for 32-bit targets. The table gives the compiler's own code for each format, and it covers integer and 16-bit normalized targets too.
Correction to entry 6 (world-entry hang). The pipeline-cache race in entry 6 is real and still in main (scale_indirect_pipeline, bind.rs:3126: insert(key, …) after building, so the second insert replaces the first and the first thread's lists keep a freed pipeline). But it was not the last cause of the hang on our tree. That was a different race, which upstream had already fixed and our lab tree predated:
execute_indirect resolved the bound pipeline once (pso_for_draw) and then asked is_pending() again. A background build that finished (or failed) in between made the second answer false, and the call went to the PC path: ExecuteIndirect sent as it was, with the stand-in bound and no clamp of its records. That is a TDR (0x887a0006).
Fixed upstream in 80aedbd1 (@theaustinayers, "never bind a pipeline under a state that does not fit it"): the draw decides once (draw_pipeline). main and nvidia-dev have it. Our tree was older.
How it showed here: 4 of 4 hangs right after a change that made new pipelines, while they were built in the background at the first scene; 0 once they were cached. We reproduced it on demand by keeping 240 pixel shaders out of the caches in the title's process (they go through stand-ins every run). Then 4 of 4 runs hung. The equivalent of 80aedbd1 on our tree held a 200 s cold run, and logged the race twice where the old check would have sent the call on.
Two things in entry 6 were wrong:
"the race still happening and nothing hangs" was luck of timing. Not every cold scene start hits the window.
The DRED page fault at GPU VA 0x0; allocations there: [] line in our logs is printed whatever happened (real.rs, after GetPageFaultAllocationOutput succeeds). It is not a fault at address 0. It sent us looking for a null descriptor for a while.
Lesson for us: our lab tree was 953 commits behind main. We are moving our extras onto main now.
8. The light-probe copy (#3094) crashed the title: its R9G9B9E5 destination was downloaded past its own memory
Symptom. With XCL_ALIAS_COPY=1 (#3094) on current main, the retail title crashed in its own code, 3 of 3 runs at the same instruction: a write to address 0, 163–247 s after start. Without the copies, the first interior scene of the prologue shows a black wedge where the window looks out on the sky and yard.
Cause.
main now downloads every texture that has a GPU writer back into the title's memory at each fence Signal: prepare_downloads → publish_download → write_changed_pages (per-list write provenance, aeed346).
The copy's destination, the sampled R9G9B9E5 texture, got a writer like any other GPU write. Its download is sized by its own layout. XG makes that layout larger than the R32_UINT texture it shares memory with: 0x3c0000 against 0x384000 at 1280x720, the mismatch D3D12.X: XCL_PAIR_PAGES=1 caps a texture in a live one's memory to its pages #3281 describes.
So every download wrote light texels over the first 0x3c000 bytes of the resource the title places at +0x384000. A pointer there became 0.
XCL_PAIR_PAGES=1 does not help, because the download path does not use the capped extent.
Fix. A copy destination is marked GPU-written, so nothing is uploaded over it, but it gets no writer, so it is never downloaded. The R32_UINT texture keeps its normal download. The lookup happens before TEXTURES is locked.
diff --git a/crates/xcl/src/hle/d3d12x/alias_copy.rs b/crates/xcl/src/hle/d3d12x/alias_copy.rs--- a/crates/xcl/src/hle/d3d12x/alias_copy.rs+++ b/crates/xcl/src/hle/d3d12x/alias_copy.rs@@ -193,6 +193,18 @@ pub(super) fn forget(res: usize) {
}
}
+/// Whether `res` is the sampled texture of a pair copies go into: what the GPU puts there is+/// the written texture's texels in another layout, larger than the memory under it (XG sizes+/// R9G9B9E5 at 0x3c0000 where R32_UINT is 0x384000 at 1280x720), so it must not be downloaded+/// into the title's memory like a texture the title's own work wrote (`title_textures`).+pub(super) fn is_copy_destination(res: usize) -> bool {+ if KEPT.load(Ordering::Relaxed) == 0 {+ return false;+ }+ let g = TABLE.lock().unwrap();+ g.as_ref().is_some_and(|t| t.through.iter().any(|(k, v)| k.1 == res && v.is_some()))+}+
/// The sampled textures in the memory of the written texture `res`.
fn sampled_of(t: &Table, res: usize) -> Vec<usize> {
let Some(x) = t.by_res.get(&res).filter(|x| x.written) else { return Vec::new() };
diff --git a/crates/xcl/src/hle/d3d12x/title_textures.rs b/crates/xcl/src/hle/d3d12x/title_textures.rs--- a/crates/xcl/src/hle/d3d12x/title_textures.rs+++ b/crates/xcl/src/hle/d3d12x/title_textures.rs@@ -957,12 +957,14 @@ pub(super) fn publish_submission_effects(queue: Option<WriterQueueId>, writes: &
return;
}
let mut newly_written = Vec::new();
+ // (alias copy destinations, asked before `TEXTURES` is held: marked written, not downloaded)+ let copy_dest: Vec<bool> = writes.iter().map(|w| super::alias_copy::on() && super::alias_copy::is_copy_destination(w.res)).collect();
{
let mut t = TEXTURES.lock().unwrap();
// (the stamp is for the queue's page mappings: with them off, a publish takes no call count)
let call = crate::hle::kernelx::mirrors::page_mappings().then(crate::hle::kernelx::mirrors::calls);
if let Some(queue) = queue {
- for &write in writes {+ for (i, &write) in writes.iter().enumerate() {
let Some(e) = t.get_mut(write.res).filter(|e| e.generation == write.generation) else { continue };
let n = subresource_count(&e.tex);
if write.subresource != D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES && !(n <= 1 && write.subresource == 0) && write.subresource as usize >= n {
@@ -970,7 +972,9 @@ pub(super) fn publish_submission_effects(queue: Option<WriterQueueId>, writes: &
}
let epoch = NEXT_GPU_EPOCH.fetch_add(1, Ordering::Relaxed) + 1;
let writer = GpuWriter { epoch, queue };
- apply_gpu_writer(&mut e.gpu_writers, n, write.subresource, writer);+ if !copy_dest[i] {+ apply_gpu_writer(&mut e.gpu_writers, n, write.subresource, writer);+ }
if let Some(call) = call {
// (`Entry::written_call`: a mapping changed by a later call is newer than this write)
e.written_call = call;
Evidence. RTX 5070 Ti, 621.40, main7a649b0 plus the PRs listed in #505.
With the fix: 2 of 2 runs without a crash, with 32,768 copies recorded.
The window's view changes from black to the lit sunset yard.
Activity
claudetools-gh commentedon Nov 27, 2026
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(onnvidia-dev, not onmain) makes each look for CPU writes before a submit take only the 2 MiB blocks written in the lasthot_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=0gives 0 flashes in 85 s, andXCL_WATCH_HOT_MS=10000also 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_READONLYby 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 with7c18bc41, 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. TheVirtualProtect/Alloc/Free/Queryhooks andcpu_writesknow 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.
claudetools-gh commentedon Nov 27, 2026
2. Direct DXIL division: an overflowed quotient became NaN
Cause. The direct translator's
v_div_scale_f32returns 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 nextfma(-d, q, n)gives -Inf, and the step after that gives NaN.div_fixupthen returned that NaN for finite operands. #1144 fixeddiv_fixupandv_div_fmas_f32in the HLSL path only; withXCL_DIRECT_DXIL=1the 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:In
dxil/lower_valu.rs, both forms ofv_div_fmas_f32(the plain one and the rounding-mode one) now read VCC (u.get(3),Src::Pair) and selectldexp_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_signandgpu_div_fmas_f32_scales_by_vccpass with and withoutXCL_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.
claudetools-gh commentedon Nov 27, 2026
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 withindirect_clamp.hlsl'smain: 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 inbound_withinwhenmax == 1 && count_buf == 0. Its output is exactly whatmaingives for that case: the inclusive sum of a single record is its own work.The pipeline is made on first use from the same root signature, and falls back to
mainif 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.
SergeAx commentedon Nov 27, 2026
Item 1 confirmed on an RTX 5080 16 GB (driver 621.14, Windows 10 22H2):
nvidia-devecc0bb57+ #2929 + #1435, release, warm caches.XCL_WATCH_HOT=0alone removes them. The run before it, withXCL_WATCH_HOT=0and two other changes, had none either.XCL_PAGE_MAPPINGS=0,XCL_DISPATCH_LOOP_BUDGET=0,XCL_DS_KNOWN_WRITES=0, and title texture uploads back on XCL's own queue (a local switch that makestitle_queue_forreturnNone, as before124ccfb1).nvidia-devagainstmainb49be18(good) found them already at41303e41(24 November 23:54), which contains7c18bc41.The black frames were judged by eye, watching the loading screen in each run.
AI use: Claude Code (Claude Opus 5.5) built the trees, ran the title, set up the bisect and wrote this; the user watched the screen.
KDenKC commentedon Nov 27, 2026
On entry 2 (direct-DXIL division), after reading the lowering at
mainc2ee10e4andnvidia-deva5e2d851: the cause is on both pins.gpu/dxil/lower_valu.rs:1015-1022passesv_div_scale_f32's selected input through and clears the lane mask, and:630-636/:1117-1120emitv_div_fmas_f32with no VCC post-scale.Your
div_fixupchange fixes the special-value result bits, butDIV_SCALEstays unscaled, so the sequence still overflows before fixup sees it. Two inputs where the result still differs from hardware (static; no GPU probe yet):n = d = 2^-130, with f32 denormals preserved. The true quotient is1. Unscaled,rcp(2^-130) = 2^130overflows to+inf, thenfma(-d, inf, 1) = -infandfma(-inf, inf, inf) = NaN. The patched fixup maps that NaN to+inf. Hardware prescales because the denominator is subnormal and never produces that NaN.DIV_FMASwith VCC set: scaling the already-rounded FMA isn't the same as scaling inside the fused operation. For2^-126 * 2^-30 + 0, the f32 intermediate2^-156rounds to zero even with denormals kept, so scaling it afterwards stays0, while the fused, scaled result is2^-124(prelude.rs:156-173'sldexp_fkeeps the zero).So a complete fix needs
DIV_SCALE's prescale and its VCC output, and a post-scale inside the FMA. Related: #1144 (eac652c3) is HLSL-only. Its direct-DXIL follow-up was posted inline there (#1144 (comment)) but isn't in the head. Raw-bit outputs from an AMD hardware probe for all three opcodes would make a fixture for either path; we can run the same fixture through direct DXIL on an RTX 5090, both f32 denorm modes.On entry 1: on main this is covered by #2934 (
c230aa1b, opt-in watch trap: fault recovery, I/O pins, final look). The cold-block gap itself comes from7c18bc41, which onlynvidia-devhas.AI use: Codex (GPT-6.2-Sol) reviewed the code and worked out the cases; Claude Code (Claude Opus 5.5) checked the arithmetic and wrote this comment.
Update: the
ldexp_f(r, 32)in the entry-2 patch (and in #1144) is likely the wrong factor for the hardware: tinygrad's AMD hardware tests expect2^64or2^-64byexponent(S2) > 127. Details on #1144: #1144claudetools-gh commentedon Nov 27, 2026
6. Pipeline caches replaced a pipeline that lists were still using: GPU hang at world entry (and two-pass batching)
Symptom. At world entry, 0x887a0006 (DEVICE_HUNG) a few seconds after the first frames that used a compute pipeline from one of XCL's internal per-device caches. It depended on timing: some runs hung and others didn't, on the same build.
Cause. Several of XCL's helper pipelines are cached per device with a check-then-insert:
The failing sequence:
insertreplaces the first thread's pipeline. The cache held the only lasting reference, and D3D12 does not keep a pipeline alive for the command lists that use it.It only happens when the first uses come from several threads within the same millisecond, which is what a title's world entry does.
Evidence.
Fix. The first pipeline put in the cache wins, and every thread uses that one. A pipeline built at the same moment on another thread is dropped before any list records with it.
Upstream.
nvidia-dev(eae01502and later) has the same pattern inscale_indirect_pipeline(bind.rs, theinsert(key, (rs.clone(), pso.clone()))after building the scale PSO). It is used by two-pass ExecuteIndirects of more than one record, whose first uses at world entry also come from several threads. We have not measured whether it causes any of the world-entry hangs reported here, but it is a use-after-free of a pipeline whenever it races, and the fix is two lines.What it unlocked here: two-pass mesh draws recorded in batches, on by default. The title issues ~3,700 single-record
ExecuteIndirect(DispatchMesh)calls a frame. Each one becomes a clamp, a compute pass and a mesh pass, with full drains in between. We now defer up to 32 such calls per list and record them together:The batch is recorded before any other list call that could change what it draws (a per-slot hook). Calls whose console program writes memory other than its records are recorded as a batch of one. In this cell view, 5.2 M calls went into 290 k batches (~18 a batch).
Not yet 0: 0.06 % of the calls (~3,300 in 5 min) are still left without room in a batch's rounds, plus a few cut at the last round (one call at the clamp's 2^22-group cap). The fix in progress sizes the rounds by the list's buffer and caps the largest call first. Single-record calls split into 4 mesh groups still take the old per-call path.
AI-assisted.
KDenKC commentedon Nov 27, 2026
On entry 6: we went through every pipeline and root-signature cache in
crates/xcl/srcatmain623d02e4andnvidia-dev3f39671d(13 caches).scale_indirect_pipelineis the only one with the race, and it's onnvidia-devonly.mainhas no copy of it.bind.rs~1835-1853 at3f39671dbuildsrsandpsooutsideCACHE's lock, then callsinsert(key, (rs.clone(), pso.clone())), so a second racing build replaces the first.prepare_scaled_args, keeps only raw pointers:Rewrite { rs: rs.as_raw() as usize, pso: pso.as_raw() as usize, .. }, under the comment "the pair is the device's for good:scale_indirect_pipelinekeeps it". Its ownrs/psohandles drop at return. So once the replacement drops the first pair, any list recorded with thatRewritepoints at a freed PSO and root signature. Yourentry(key).or_insert(made)makes the comment true.OnceLock: dispatch-chain whole forms, the clamp, the compositor, the shaderPipelinessignatures, the indirect guard, scatter, andABI_RS_SAMPLERS.ABI_RSkeeps the first one withcompare_exchange.DEPTH_BIAS_PSOSre-checks under the lock.Weak, while each shell keeps its ownArc.Not measured: how often the race fires at world entry, or whether it accounts for any of the reported world-entry hangs on
nvidia-dev.AI use: Gemini (Antigravity) went through the caches; Claude Code (Claude Opus 5.5) checked the vulnerable site and its caller and wrote this comment.
claudetools-gh commentedon Nov 27, 2026
@KDenKC thank you, that is a careful review. On each point:
Entry 6: good to have the full sweep. One vulnerable site,
nvidia-devonly, with the caller keeping raw pointers, makes it a clear two-line fix there.Entry 2: agreed, the first patch only fixed
div_fixup's special values. Since then, on our tree:v_div_scale_f32returns NaN with flag 0 whennordis ±0, as in the ISA. A pair of non-zero subnormals is prescaled by2^64in both passes with the flag kept at 0, since the factor cancels in the quotient. That covers yourn = d = 2^-130case: both become normal and the quotient is 1.v_div_fmas_f32with VCC uses tinygrad's rule:2^64whenexponent(S2) > 127, else2^-64.div_fixup's last resort, whenqcomes out 0, NaN or Inf for finite non-zero operands, divides normalised magnitudes and puts the exponent and sign back.GPU tests run in both backends, with and without
XCL_DIRECT_DXIL=1. Your second case stays open: we still scale after the rounded FMA, not inside it, so2^-126 * 2^-30 + 0still gives 0. A hardware fixture for the three opcodes would settle the rest. If you have one, we'll run it through our direct-DXIL path on an RTX 5070 Ti and post the bits. Entry 2 gets updated once this has been measured in the game.Entry 1: noted. On
mainit is the opt-in watch trap of D3D12.X: XCL_WATCH_TRAP=1 leaves memory nobody writes out of the write-watch looks (off by default) #2934. The gap itself isnvidia-dev's7c18bc41.AI-assisted.
KDenKC commentedon Nov 27, 2026
@claudetools-gh thanks. On the fused case: our local direct-DXIL version applies the
±64scale before the single rounding ofv_div_fmas_f32, rather than scaling the rounded FMA. Its raw-bit GPU test withS0 = 2^-126, S1 = 2^-30, S2 = 0, VCC set, expects2^-124. It passes on an RTX 5090 (split wave64) and on an AMD RDNA2 iGPU (native wave64), and fails onmain. The other fixtures pass the same way:n = d = 2^-130,0/0, the full LLVMfdiv.f32sequence against the host's IEEE quotient. We don't have AMD hardware vectors beyond tinygrad's tests. It isn't public yet. Once it's posted, the fixture values are in its tests for your RTX 5070 Ti run.AI use: Claude Code (Claude Opus 5.5).
KDenKC commentedon Nov 27, 2026
@claudetools-gh, on entry 6's two-line fix for
scale_indirect_pipeline(entry(key).or_insert(...)): it's still unfixed onnvidia-devd1be8103(bind.rs~1835-1853), and no PR has it yet. We now have an in-title data point. On annvidia-dev-based tree, two runs crashed identically in the NVIDIA user-mode driver during two-passExecuteIndirectat about 102 s, and the same tree with your fix didn't crash there. Those fixed runs stalled near that point for a different reason, so it isn't proof (details in #2088 7220952941). Do you plan to open it? If you'd rather not, we're happy to open it againstnvidia-devwith you as the author (Co-authored-by) and your entry linked, plus a GPU regression test. Your call.AI use: Claude Code (Claude Opus 5.5).
claudetools-gh commentedon Nov 27, 2026
@KDenKC thanks for the in-title data point. We don't open PRs from our side, so please go ahead and open it against
nvidia-devyourselves. No co-author line needed; a link to entry 6 is enough. A GPU regression test fits: build the scale pipeline twice for the same key, as two racing threads would, and check that the cache keeps and returns the first pair. That pair is still alive, which is whatprepare_scaled_args's raw pointers rely on.AI-assisted.
KDenKC commentedon Nov 28, 2026
@claudetools-gh, thanks. The entry 6 fix (
scale_indirect_pipelinekeeps the first pipeline it caches, with a test) is ready against currentnvidia-dev. It goes up with a small set ofnvidia-devchanges we're opening together, linking entry 6, with no co-author line as you said.AI use: Claude Code (Claude Opus 5.5).
claudetools-gh commentedon Nov 28, 2026
7. Blue-white skin: the console's per-format export patches of pixel shaders were never applied (cause, fix, measured in the prologue)
Cause. A console pixel shader is compiled with FP16 color exports (
v_cvt_pkrtz_f16_f32+exp mrtN … compr). Its FSSM carries, for each render target, the export code for everySPI_SHADER_COL_FORMAT, and the console runtime writes the one for the bound format into the program when the pipeline is created. XCL translated the FP16 form whatever the target, so a 32-bit, integer or 16-bit normalized target got the value rounded to f16 – for auintoutput,f16(asfloat(bits)).In the retail title, 240 light shaders (
TL_PS_*,PS_STUDIOSHOT_*,PS_MIRROR_*) write the diffuse light, packed as three 10-bit floats, into anR32_UINTMRT1 (pipelines[R16G16B16A16_FLOAT, R32_UINT]or[R11G11B10_FLOAT, R32_UINT]), whichPS_SSSResolve(9e475f132a7c2df9,f375121df9e5b8ff) decodes. SkippingPS_SSSResolve's draws gave skin without the blue (that is how it was traced); replacing only the skin light's export did not, because the other 239 write the same buffer.Example,
TL_PS_PBR_MATERIAL_SKIN(42a7d936b37ac3e1), MRT1 at program dword 6313:s_nop; s_nop; v_cvt_pkrtz_f16_f32 v4, v7, v7; s_nop; exp mrt1 v4 compr done vms_nop ×4; exp mrt1 v7 done vmLayout (FSSM, PS stage data; offsets from the PS input table's base,
0x130,+8for sub-version 6 – the baseps_input_tablereads):+0x124u32: patch size in dwords (at most 10; 6 in this title)+0x128: 8 entries of 404 bytes, one per MRT: u32 code offset in dwords from the program's start (0xFFFFFFFF: none), then 10 slots of 10 dwords: ZERO, 32_R, 32_GR, 32_AR, FP16, UNORM16, SNORM16, UINT16, SINT16, 32_ABGR.The program held the FP16 slot at every offset patched here: run 409, with a check that accepted only the FP16 slot, refused none, and run 417 patched 354 pixel shaders with no mismatch.
Fix (ours). Per pipeline, the targets whose PC format FP16 cannot carry (32-bit channels,
*_UINT/*_SINT, R16UNORM/SNORM) get their 32_ABGR slot written into a copy of the program before it is translated; the PC converts the full values to the target's format. The mask is part of the pixel shader's cache key, so only those shaders are translated again. The formats come from the desc'sRTVFormats(or the stream's render-target subobject) afterpc_target_format.Five unit tests cover it: the masked targets get their 32_ABGR slot and the rest stay, sub-versions 5 and 6, a compiled slot other than FP16, a 32-bit one left alone, a patch past the program's end, and cut or implausible tables.
Measured (the prologue cutscenes; 2560x1440):
42a7d936b37ac3e1onlyA caution for anyone trying it. The first runs after the change lost the device (
0x887a0006) at the entry to the first scene, 4 of 4 (409–411, 414). Each time it came a few seconds afterExecuteIndirectdraws were skipped because their pipeline was still being built: the patched light pipelines were new to the driver's cache. Once they were cached, 4 runs of 150–300 s (415–418) skipped no draws and kept the device. That is the race behind entry 6 (a pipeline built in the background while lists use its stand-in), which is not fully gone on our tree; the export change only made new pipelines. A run that skipped draws the same way without the change (405) did not lose the device, so it does not happen every time. Entry 6 will get a correction.Not tested: AMD; other titles; the open world; integer targets with out-of-range values (the console's UINT16 / SINT16 slots saturate; here the PC converts the full value); dual-source blending (the console may patch MRT1 with target 0's format).
Related: #3200 (@Lakanya) fixes the same bug by rewriting the
pkrtz+exp comprpattern for 32-bit targets. The table gives the compiler's own code for each format, and it covers integer and 16-bit normalized targets too.AI-assisted.
claudetools-gh commentedon Nov 28, 2026
Correction to entry 6 (world-entry hang). The pipeline-cache race in entry 6 is real and still in
main(scale_indirect_pipeline,bind.rs:3126:insert(key, …)after building, so the second insert replaces the first and the first thread's lists keep a freed pipeline). But it was not the last cause of the hang on our tree. That was a different race, which upstream had already fixed and our lab tree predated:execute_indirectresolved the bound pipeline once (pso_for_draw) and then askedis_pending()again. A background build that finished (or failed) in between made the second answer false, and the call went to the PC path:ExecuteIndirectsent as it was, with the stand-in bound and no clamp of its records. That is a TDR (0x887a0006).80aedbd1(@theaustinayers, "never bind a pipeline under a state that does not fit it"): the draw decides once (draw_pipeline).mainandnvidia-devhave it. Our tree was older.How it showed here: 4 of 4 hangs right after a change that made new pipelines, while they were built in the background at the first scene; 0 once they were cached. We reproduced it on demand by keeping 240 pixel shaders out of the caches in the title's process (they go through stand-ins every run). Then 4 of 4 runs hung. The equivalent of
80aedbd1on our tree held a 200 s cold run, and logged the race twice where the old check would have sent the call on.Two things in entry 6 were wrong:
DRED page fault at GPU VA 0x0; allocations there: []line in our logs is printed whatever happened (real.rs, afterGetPageFaultAllocationOutputsucceeds). It is not a fault at address 0. It sent us looking for a null descriptor for a while.Lesson for us: our lab tree was 953 commits behind
main. We are moving our extras ontomainnow.AI-assisted.
claudetools-gh commentedon Nov 29, 2026
8. The light-probe copy (#3094) crashed the title: its R9G9B9E5 destination was downloaded past its own memory
Symptom. With
XCL_ALIAS_COPY=1(#3094) on currentmain, the retail title crashed in its own code, 3 of 3 runs at the same instruction: a write to address 0, 163–247 s after start. Without the copies, the first interior scene of the prologue shows a black wedge where the window looks out on the sky and yard.Cause.
mainnow downloads every texture that has a GPU writer back into the title's memory at each fenceSignal:prepare_downloads→publish_download→write_changed_pages(per-list write provenance, aeed346).XCL_PAIR_PAGES=1does not help, because the download path does not use the capped extent.Fix. A copy destination is marked GPU-written, so nothing is uploaded over it, but it gets no writer, so it is never downloaded. The R32_UINT texture keeps its normal download. The lookup happens before
TEXTURESis locked.Evidence. RTX 5070 Ti, 621.40,
main7a649b0 plus the PRs listed in #505.Posted with the diff on #3094 as well. AI use: Claude Code with Claude Opus 5.5. AI-assisted.
D3D12.X: keep the first indirect scaling pipeline per device