Skip to content

xcl run: shader preparation in worker processes, only what earlier runs used; upstream main; sampler fix - #2624

Merged
theaustinayers merged 178 commits into
nvidia-devfrom
shader-prep
Nov 26, 2026
Merged

theaustinayers merged 178 commits into
nvidia-devfrom
shader-prep

Conversation

@theaustinayers

Copy link
Copy Markdown
Collaborator

Brings nvidia-dev up to upstream main (through #2371) and adds the faster shader preparation before a title starts.

What is in it

Tested

  • RTX 5090 (driver 621.14), Ryzen 9 9950X3D, Windows 11 26300, release build.
  • Software adapter, cargo test --release -p xcl --lib -- --test-threads=4 at fbfac4d0: 1538 passed, 0 failed, 25 ignored; 59 tests that open the hardware GPU not run. The four tests added after it (the_shaders_of_a_used_set_are_kept_for_the_next_run, the_key_of_one_shader_is_the_key_of_a_set_of_it, preparation_workers_leave_two_processors_and_follow_the_commit_left, static_sampler_set_before_a_branch_is_a_constant_after_it) pass at the head.
  • Retail title, preparation with 28 workers: a cold pipeline pass in 929 s, 0 of 28 workers failed; with warm caches the whole preparation in 43 s (translation 14 s, pipelines 29 s). One process before: 84 % of one pass after several minutes, then about two pipelines a minute.
  • Retail title, 16 minutes in the world without a device removal on the build before the sampler fix.

Not tested

  • The full suite at the head commit, the hardware-GPU tests and the integration tests.
  • The sampler fix and the used-shader list on a title: the first run with them is in progress.
  • Any GPU other than the RTX 5090.

AI use

  • Claude Code, Claude Fable 5.2: wrote the code, the tests and this description; ran the tests and the title runs.

🤖 Generated with Claude Code

Prime1997 and others added 30 commits November 23, 2026 16:18
A placement sweeps pages belonging to unrelated targets idle for two seconds. Comparing device-wide bytes before and after the second cube can therefore fail when those old targets expire. Snapshot the mapped title-page and extra-page pool/tile identities for the cube and require the new and original resources to share all of them. Keep the existing placement-growth, reclamation and pixel-readback checks.
The existing PendingWait checks construct the comparison directly, and the submission check manually pushes a 32-bit wait. Exercise wait64_x itself so interpreting the trailing flags slot as a mask cannot return unnoticed. Check high counter bits, garbage flag upper halves, unfinished and equal counters, and the unchanged Wait32 mask; an already satisfied Wait64 must keep the submitted batch together.

The production correction from Sr-0w PR #218 is already in upstream d4f17ca. This commit ports only the two original synthetic controls from42297943db3cfd4cf14ee37a7a0a53b8888d0d2c, byte-identical. Earlier separate negative controls captured both incorrect stored mask and a 2000ms false timeout/batch split with the old behavior. Fresh release focused run on official508a0c7 plus these tests:2passed,0failed,0ignored. Broader validation follows on this clean head.

Assisted-by: OpenAI Codex (exact model variant not exposed)
The title-texture and VRAM tests serialise on TEST_LOCK and VRAM_TEST_LOCK
and took them with .lock().unwrap(). When one holder panics (on main,
placed_title_textures_share_vram_and_preserve_pixels fails on RDNA2, the
packed-mip case #470 fixes), the mutex is poisoned and every later test
that takes it fails with PoisonError, though it passes alone:
transitions_apply_when_their_list_is_submitted and
d32s8_targets_take_their_own_size_of_video_memory.

The locks guard no data, so take them the way the crate's other test
locks already do (ASYNC_TEST_LOCK, READING_CB_TEST_LOCK):
unwrap_or_else(|e| e.into_inner()). Test code only.

Measured on an RX 6650 XT, cargo test --workspace -- --test-threads=4:
lib tests 647 passed, 3 failed before; 649 passed, 1 failed after.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…718)

The device-wide page count also drops when unrelated idle pages are swept, so this check compares that resource's extra-page tiles instead. The cubemap check in the same test stays with #447.

Assisted-by: Grok Build (Grok 4.7)
A DPP instruction's text stopped at its registers too: the control that
says which lane each lane's first source comes from (quad_perm, row_shl
/ shr / ror, row_mirror, row_half_mirror, row_share, row_xmask), the row
and bank masks, bound_ctrl, fi, the sources' neg / abs and the DPP8 lane
selects were left out, so `v_mov_b32_dpp v5, v1` stood for every one of
them. The recompiler reads all of these; only the printed line dropped
them.

The text follows LLVM's: all 2229 lines of its gfx10 DPP16 and DPP8
tests in tests/data/llvm-amdgpu now read the same (none did), apart from
the implicit vcc operands and the `_dpp8` suffix this disassembler has.
A control RDNA2 has no name for is printed as `dpp_ctrl:<number>`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
D3DMetal (macOS, CrossOver) has no WARP adapter: EnumWarpAdapter
returns 0x887A0004 (DXGI_ERROR_UNSUPPORTED), and the unwrap panics.
The test uses WARP to exercise write_frame's decoder without a
physical GPU, so it now reports "no WARP" through
runner::skip_test, like the other d3d12x tests that need a device,
and returns. Windows has WARP, so nothing changes there. (#258)

Assisted-by: Claude Code (Claude Opus 4.6 wrote the change; Claude Opus 5.5 rebased it onto 077ce40 and switched it to skip_test)
gpu_depth_buffer_created_for_unordered_access_is_placed (#1353) first checks
that a depth buffer without the UAV flag can't be placed in
UNORDERED_ACCESS. Microsoft's D3D12 runtime refuses that state;
vkd3d-proton under Wine does not validate it and creates the resource, so
the test failed on every Linux run although the state XCL asks for
(DEPTH_WRITE, from pc_initial_state) is accepted there too. The refusal is
now asserted only when not under Wine; the rest of the test is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add integration contract tests for the raw x64 thunks emitted by
crates/xcl/src/hle/d3d12x/guard.rs (make_guard, make_split,
make_layout_split, make_tracer, make_call_tracer) using a mapped
executable call trampoline so game-image caller paths are exercised
alongside non-game runtime callers.

Verified 3x via cargo test -p xcl --test d3d12x_guard_contract -- --test-threads=2 (5 passed, 0 failed, 0 ignored).
Adds host-driver parity integration tests for ID3D12Device::CreateCommittedResource (slot 27, Part of #480) comparing buffers, 2D/3D/RT/DS textures, invalid descriptors, and unknown console IID fallback against the unhooked PC driver on the same adapter.

Verified with cargo test -p xcl --test d3d12_create_committed_resource -- --test-threads=1 (2 passed, 0 failed on NVIDIA GeForce GTX 1660 SUPER).

Assisted-by: Antigravity (Gemini 4 Neon)
…gainst host D3D12

Adds host-driver parity integration tests for ID3D12Device::CreateDescriptorHeap (slot 14), GetDescriptorHandleIncrementSize (slot 15), and CreateFence (slot 36) (Part of #480) comparing descriptor layouts, increment sizes, fence values/Signal, ppv == null, invalid descriptor handling, and console IID fallback against the unhooked PC driver.

Verified with cargo test -p xcl --test d3d12_descriptor_heap_and_fence -- --test-threads=1 (3 passed, 0 failed on NVIDIA GeForce GTX 1660 SUPER).

Assisted-by: Antigravity (Gemini 4 Neon)
…est's heap

D3D12CreateDevice gives every test the process's one device. Once another
test adopted it (gpu_placed_console_depth_target_with_clear_value and
others), the buffer coherent_buffer_sanitizes_console_flags_and_state
places on its imported heap is adopted too, and its last Release goes to
late_release::hold. While a queue of a test running in parallel still has
work, the buffer is held, the heap pins the pages, and VirtualFree fails
with ERROR_INVALID_PARAMETER (87). The test now retries VirtualFree for up
to 10 s and still asserts that it succeeds.

Part of #1487.

Assisted-by: Claude Code (Claude Opus 5.5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add host D3D12 parity integration tests for ID3D12Device::CreatePlacedResource
(slot 29), extending #480 without requiring retail game files or console DLLs:

- Compare DEFAULT/UPLOAD/READBACK placed buffers (with Upload Map/Unmap write-read)
  against the unhooked PC driver on the same adapter.
- Compare non-RT/DS textures (R8G8B8A8, BC1) and RT/DS textures (RTV/DSV with clear
  values) against the host driver.
- Verify misaligned/out-of-bounds offset and null descriptor error parity, plus
  unknown console IID fallback to ID3D12Resource.

Verified locally with:
cargo test -p xcl --test d3d12_create_placed_resource -- --test-threads=1
(3 passed, 0 failed)

Assisted-by: Antigravity (Gemini 4 Neon)
…t D3D12

Add host D3D12 parity integration tests for ID3D12Device::CreateQueryHeap
(slot 39) and ID3D12Device::CreateCommandSignature (slot 41), extending #480
without requiring game files or console DLLs:

- Compare OCCLUSION, TIMESTAMP, PIPELINE_STATISTICS, and SO_STATISTICS query
  heaps against the unhooked PC driver, plus invalid descriptors and unknown
  console IID fallback to ID3D12QueryHeap.
- Compare DRAW, DRAW_INDEXED, and DISPATCH command signatures against the
  host driver, plus invalid strides/argument counts/node masks and unknown
  console IID fallback to ID3D12CommandSignature.

Verified locally with:
cargo test -p xcl --test d3d12_query_and_command_signature -- --test-threads=1
(2 passed, 0 failed)

Assisted-by: Antigravity (Gemini 4 Neon)
…3D12

Add host D3D12 parity integration tests for CreateCommandQueue (slot 8),
CreateCommandAllocator (slot 9), CreateCommandList (slot 12), CreateCommandList1
(slot 51), and CreateRootSignature (slot 16), extending #480 without requiring
retail game files or console DLLs:

- Compare DIRECT/COMPUTE/COPY queues and allocators against the host driver,
  including invalid descriptor parity and unknown console IID fallbacks.
- Compare CreateCommandList and ID3D12Device4::CreateCommandList1 across queue
  types, mismatched-allocator failure parity, and console IID fallbacks.
- Compare empty and parameterized serialized root signatures, console IID
  fallback, and XCL's empty root-signature fallback on malformed bytecode.

Verified locally with:
cargo test -p xcl --test d3d12_command_objects_and_root_sig -- --test-threads=1
(3 passed, 0 failed)

Assisted-by: Antigravity (Gemini 4 Neon)
Register a synthetic title caller to exercise the console path at slot 8.
Compare queue descriptions against the native call on the same device,
including console flag stripping and DMA-to-copy translation.

Part of #480.

Assisted-by: OpenAI Codex (GPT-6.2 Sol)
Add an integration test suite over the generated d3d12_layout.rs table and its layout.rs helpers: unique names/iids, non-empty parent/method lists with the IUnknown head, IID round-trip through parse_guid/guid_string, chain() most-derived-first ordering with no non-versioned siblings, slot() for known methods and rejected for unknown/misspelled, and find/slot/chain consistency. A generator regression (bad IID, duplicate slot, chain leaking a non-versioned sibling) now fails in CI instead of silently misaligning D3D12.X slots.
Pin the public contract of the console descriptor heaps from a new non-runtime test file (register / start / slot / words_at / write / copy_words / unregister): window-0 placement, per-slot arithmetic for non-shared view heaps (index 2k, pc_srv base+2k*inc, pc_uav base+(2k+1)*inc, pc_gpu_uav +1 slot), sampler slot arithmetic (one 16-byte slot per index), T# image copy renumbering (word 0 = destination index), buffer V# kept verbatim, sampler S# index-in-word-3-[11:0] renumbering, end-of-heap bounds, start stability across slot calls, unregister forgets the heap, and non-shader-visible heaps report no GPU UAV.
a_new_list_takes_no_copy_scratch_of_an_earlier_one asserted while it held
COPY_SCRATCH. When an assert failed, the lock was poisoned; the test's
command list was then dropped during unwinding, its Release hook
(real::cl_release -> on_release -> release_copy_scratch) panicked on the
poisoned lock, and a panic there is non-unwinding, so the whole lib test
binary aborted ("thread caused non-unwinding panic. aborting.", exit
status 9). Every test result of that process was lost.

Measured under Wine 11.22 + vkd3d-proton v3.1 on an RTX 5060 Ti, where
gpu_more_atomics_sub_dword_scratch_valu hangs the GPU and the device is
removed for later tests (the fence then reads as complete, so this test's
"stays until the fence" check fails): main aborted in 2 of 2 runs; with
this change the binary runs to the end and reports the failures.

The checks are now read under the lock and asserted after it is released.

Assisted-by: Claude Code (Claude Opus 5.5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gpu_raw_window_view_reaches_its_top compiles a cs_6_6 shader that indexes
ResourceDescriptorHeap, but checked only for a GPU and DXC. On a device
without SM 6.6 (Windows 10's inbox D3D12, no Agility SDK) the pipeline is
refused and the test failed with 0x80070057 at CreateComputePipelineState
instead of skipping like the runner's GPU tests. It now checks the shader
model first and skips with the same message (agility::format_no_sm66_message).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A panic was printed to stderr only. One of XCL's own threads that
panics is gone for the rest of the run, and `xcl.log`, the file a
report carries, had no line of it: in a retail title's run under Wine
(RTX 4060 Ti) `xcl-sync-watchdog` panicked as it started (the race
#1926 fixes) and the log reads like any other stall.

The host installs a panic hook that writes the thread's name, the place
and the message as an ERROR line, then calls the hook that was there.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
v_dot2_f32_f16 applied only NEG[2] to SRC2 and ignored NEG_HI[2]. SRC2
is an f32 operand, and for an f32 operand of a VOP3P instruction the
NEG_HI bit is its ABS modifier, as v_fma_mix* already decodes it:

- LLVM SIDefines.h, SISrcMods: "NEG_HI = ABS"
- AMDGPUISelDAGToDAG.cpp, SelectVOP3PModsF32 calls SelectVOP3Mods, which
  folds fabs into the ABS bit
- llvm.amdgcn.fdot2.ll, v_fdot2_abs_c: fabs(c) selects to
  "v_dot2_f32_f16 v0, v0, v1, v2 neg_hi:[0,0,1]"

So |c| was read as c, and -|c| as -c. With v1 = v2 = 0x3C003C00 and
v3 = -5.0, neg_hi:[0,0,1] gives 7.0 (was -3.0) and neg_lo:[0,0,1]
neg_hi:[0,0,1] gives -3.0 (was 7.0). ABS is applied before NEG, as in
v_fma_mix*.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…umulator

The direct DXIL translator (XCL_DIRECT_DXIL=1) ignored NEG_HI[2] of
v_dot2_f32_f16, the ABS of its f32 accumulator, as the HLSL path did
before #1286. Apply it before NEG[2], as #1286 does in the HLSL path.

#1286's GPU test failed with XCL_DIRECT_DXIL=1 on an RTX 5070 Ti
(neg_hi:[0,0,1] with c = -5.0 gave -3.0, not 7.0) and passes with this
change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Covers GetResourceAllocationInfo (slot 25) and GetCustomHeapProperties
(slot 26) through both the C++ and C ABIs, using a synthetic title-image
caller so the console hooks are reached. The zero-width buffer is compared
with the host's answer rather than UINT64_MAX, which vkd3d-proton does not
return.

Part of #480.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Compares XCL's hooked ID3D12Device::CreateReservedResource (slot 30) with
the unhooked driver slot on the same adopted device, so both paths use one
adapter even when XCL_ADAPTER selects a non-default GPU. Covers buffers and
2D/3D textures (GetDesc and GetResourceTiling, including a range starting at
subresource 1), invalid descriptors, the console IID fallback, clear values
and a null ppv. Skips go through runner::skip_test.

Part of #480.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
detect_wave64 tells the wave size from the code: 32-bit EXEC writes and no
64-bit ones mean wave32, anything else wave64. A wave32 program that never
writes EXEC has nothing in its code to tell, so it was translated as wave64:
its cross-lane reads (v_readfirstlane, v_readlane, permutes) then span 64
threads instead of 32.

The FSSM header has the answer: bit 5 of the flags word at +0xD4. Measured
on a retail shader pack (26 698 programs): the bit is set for all 2 608
programs the code shows to be wave32 and clear for all 24 036 the code takes
for wave64, except 54 compute programs with the bit set and no EXEC write in
their code. 27 of those 54 have cross-lane instructions (v_readfirstlane,
v_readlane, permutes, LDS). As wave32 all 54
translate completely and compile with DXC.

fssm_wave64 takes wave32 from the header and leaves everything else to
detect_wave64, so only those programs change. An unused field (0xDEADBEEF)
and other FSSM versions say nothing.

A compute program through the PSO hook (gpu_compute_e2e) shows the effect:
64 threads store v_readfirstlane of their thread id; with the flag threads
32..63 read thread 32, without it they read thread 0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
In crates/xcl/src/gpu/dxil/lower.rs, Lw::salu unconditionally called read64 on _b64 saveexec/wrexec forms even in wave32 (!self.wave64) and unconditionally read sreg(127) (EXEC_HI) before branching on (!self.wave64 || name.ends_with("_b32")). On 32-bit-only source encodings such as m0 (SSRC0 = 124), wave32 S_AND_SAVEEXEC_B64 failed translation with Err("...: op"), and on SGPR sources it spuriously touched s[n+1] and EXEC_HI (s127).

Move source reads and EXEC_HI handling inside the wave32/_b32 vs wave64 _b64 branches to mirror HLSL (#191), and add unit/disassembly and wave32 RTX 4060 GPU regression tests in lower.rs.

Part of #1269

Assisted-by: Google Antigravity (Gemini 4 Neon)
In `crates/xcl/src/gpu/dxil/lanes.rs`, `Lw::ballot` called plain
`WaveActiveBallot` even in pixel shaders (`self.gfx` with `ps: Some(_)`).
Under SM 6.6, `WaveActiveBallot` excludes helper lanes, whereas `Lw::rla`
already uses quad reads for pixel shader helper lanes and the HLSL path
uses `ballot_px` / `quad_bits` + `ballot_px_quad` (PR #134 / #105 item 1).
After `s_wqm_b32`/`s_wqm_b64`, dropping helper-lane bits from compare
masks corrupted `v_cndmask` / `s_and_saveexec` values read via DPP quad
derivatives and caused `v_readfirstlane` waterfall loops to spin until
the loop budget.

Port both parts of #105 item 1 and #134 to the direct DXIL translator:
- Split `Lw::ballot_ps_quad(q)` out of `Lw::ballot_ps(cond)` in
  `crates/xcl/src/gpu/dxil/lanes.rs`: four `WaveActiveBallot` passes
  spread each quad member's bit `p` from live lanes back to bit `4k + p`,
  preserving the wave32-in-wave64 `gfx_half` select, constant-false
  `(0, 0)` short-circuit, and live-lanes-only entry `EXEC` (`setup_pixel`
  calls `gfx_common_init` before setting `self.gfx`). Non-VOPC PS masks
  (such as `v_add_co_u32` carries) route through `ballot_ps` ->
  `ballot_ps_quad`.
- In `crates/xcl/src/gpu/dxil/lower_valu.rs`, evaluate plain pixel-shader
  VOPC compares per quad member (`p in 0..4`) by quad-reading VGPR source
  operands with `QuadReadLaneAt` (leaving SGPRs such as `v_readfirstlane`
  results and constants wave-uniform) and feeding the 4-bit quad mask to
  `Lw::ballot_ps_quad`, avoiding `QuadReadAcross*` on compare predicates
  that crash AMD RDNA2/3/4 `amdxc64` (#134).

Add CPU/DXIL-validator and CI-WARP-safe GPU draw regression tests in
`lanes.rs` (384/1024 wrong pixels pre-fix on RTX 4060 -> 0/1024 post-fix
for both wave64 and wave32 pixel shaders, with zero `dx.op.quadOp` in
VOPC pixel shaders).

Part of #1269

Assisted-by: Google Antigravity (Gemini 4 Neon)
theaustinayers and others added 16 commits November 25, 2026 19:56
Seven upstream commits. Conflicts in four files: the README keeps both
bullets; dxc.rs keeps the fork's compile_with (a compiler on a private
heap) under upstream's compile_whole and linked form; a dispatch chain's
refusal warning stays, with ComputeBuild::Chain; the split fixture keeps
the fork's optional chain with upstream's timing block inside it.
driver_cache::path is back: upstream's new test calls it.

Software adapter: cargo test --release -p xcl --lib: 1531 passed,
1 failed, 25 ignored; 59 tests that open the hardware GPU not run. The
failure, sparse's flush_parked_does_not_free_or_reuse_tiles_while_unmap_
is_in_flight, passed three times of three run alone (it reads the clock;
a shader build was using the machine). Not run on a title yet.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…copies without asking readable()

Taken as it is for a test on a title.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

# Conflicts:
#	crates/xcl/src/hle/d3d12x/list_x.rs
#	crates/xcl/src/host.rs
…ut their top mips while video memory fills up

Taken as it is for a test on a title. The memory line keeps the fork's
budget and commit text after the pull request's count of thinned textures.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The driver builds about two pipelines at a time for one process, so the
preparation before a title (#2555) stood for minutes on each stretch of
large compute programs. The stages are still translated in the host;
the compute pipelines are built by worker processes of the same program,
each on its own slice of the records: the processors less two, 16 at
most, 3 GB of the commit left for each (XCL_PREPARE_WORKERS; 1: as
before). With a list of the pipelines an earlier run used, only those
are built before the title starts. A worker that fails is logged and the
title starts; a worker ends when the host does. A worker reports every
record while a title waits on it, and the host logs its progress every
5 s.

Measured on a retail title, RTX 5090, 32 threads: the first 92 % of the
steps in 85 s (one process: 84 % of one pass after several minutes).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…groups meet at a group barrier by default

Taken as it is for a test on a title.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

# Conflicts:
#	crates/xcl/src/gpu/recomp/emit.rs
… a put-off dispatch waits for its pipeline at the submit instead of being dropped

From #2547: pso_async::wait_for_submit, called by record_deferred
(bind::wait_for_bound) before each put-off call is recorded; the
SUBMIT_WAIT_MOST bound with its WARN and SUBMIT_GAVE_UP count; the test
switches for the wait budget and the submit bound; catch_unwind around a
worker's build; the four tests.

Kept from the fork: Demand's waiters/by_submit/ahead counting (the submit
counts once among the waiters through `ahead`, also for a late pipeline,
and leaves with unwant_ahead when it gives up), waits_for/need_by_submit,
the split LISTS locks (no lock held across the wait), the own allocator on
the primary list, run_job (the panic catch wraps it and clears its
thread-locals), the Wait struct (submit wait counters, 1 s logs, title
held), BUILT_HERE/BUILT_AT_SUBMIT for a build the submit runs itself, the
dred pipeline mark (now after the wait, so it names the built pipeline)
and bound_pso. XCL_CS_PSO_WAIT_MS keeps its precedence: with it set,
wait_for_submit leaves the wait to the call's resolve_wait as before.
Without XCL_PSO_WAIT_MS and XCL_CS_PSO_WAIT_MS the submit's wait is the
unbounded resolve_wait_for it already made.

The list_x GPU test makes the pipeline late after the dispatch is put
off, since the fork does not put off a late pipeline.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… record

The two passes were added up (twice the records), and a worker's count
moved every 200 records, so the screen stood on one number for many
minutes. The workers' pass has its own heading and count, a worker
reports every record, and the line under the bar says a large pipeline
is compiling. Workers: the logical processors less four.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… put-off dispatches)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…iagnostic)

A shader whose S# is taken for a heap entry it is not samples through
entry 0: point, wrap, mip 0 only. With the switch that entry is linear,
clamp, every mip, so a picture that changes with it shows such shaders.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…e fork's put-off dispatches)"

This reverts commit 4eb70f0, reversing
changes made to 626459d.
A program's S# constants were known only inside the block that set them.
The console compiler sets an S# before a loop or an if and samples
inside it; those samples went through sampler-heap entry 0 (point, wrap,
mip 0): banded gradients, stepped glows, a lookup that wraps. The
constants are followed through the program's branches: a register is a
constant at a block's start when every block that leads there leaves it
with the same one.

On a retail title, RTX 5090: with entry 0 made linear
(XCL_ZERO_SAMPLER_LINEAR=1) the bands and steps went, which showed the
samples went through it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…go without their top mips while video memory fills up"

This reverts commit 5259083, reversing
changes made to 2870e10.
…or sync copies without asking readable()"

This reverts commit 2870e10, reversing
changes made to 6aa80e3.
A run keeps the shaders of the pipelines it uses, each by its own key
(used-shaders.txt beside the DXIL cache). With that list the preparation
before a title translates only those records; the title translates
another when it first uses it. XCL_PREPARE_ALL=1: every record, as
without the list. XCL_PREPARE=0: no preparation, the title builds what
it uses as it goes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…n the stages that draw

A program's S# constants were known only inside the block that set them.
The console compiler sets an S# before a loop or an if and samples
inside it; those samples went through sampler-heap entry 0 (point, wrap,
mip 0): banded gradients, stepped glows, a lookup that wraps. In vertex
and pixel programs the constants are followed through the branches: a
register is a constant at a block's start when every block that leads
there leaves it with the same one.

Not in the other programs: read this way on a retail title, compute
programs gave ExecuteIndirect 2 055 counts out of range in 75 s (none
before) and the device hung after 140 s. Why is not known yet.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@GodlyBDS

GodlyBDS commented Nov 26, 2026 •

Copy link
Copy Markdown

RTX 3090 Ti / 621.40 / Windows 10 / 32 GiB follow-up on e877812e. I used two local startup compatibility changes already tested on the older NVIDIA branch (Agility host-path scope and the XG extra argument), and the same per-executable 1 GiB shader heap reserve. The release build and six focused startup tests passed. This arm uses on-demand compilation (XCL_PREPARE=0, background PSO preload off) and starts from 8,426 prior native entries. The translated cache is regenerated so that the refreshed shader paths use their current outputs.

  • A separate earlier build with the 32 MiB two-pass record allocation path reached 3,737 MiB of tracked mesh buffer widths, 2,185 MiB waiting for allocator reset. It eventually stopped on low physical RAM. In the new run the highest logged mesh total through 630 s was 1,459 MiB, with 367 MiB waiting for reset, and zero refusals at the 4,096 MiB diagnostic mesh budget. These are different builds and rendering progress points, so the figures are allocation observations rather than a paired benchmark.
  • This run passed the device-removal point of the older NVIDIA branch, without a matching device removal or Windows driver reset through the sample. The transition went black after the loading artwork. At 630 s the scheduler still reported newly completed work. I left it running. Visible 3D remains unverified here. I have not tested this PR's worker-process preparation path in this arm.

The independent timing of PSO worker gate waits is in #2628. AI use: OpenAI Codex (GPT-6) ran the comparison and drafted the report.

Long-run update. One recording thread completed 37 large, cache-missing compute PSO builds in sequence between 773.010 and 1,443.620 s. Their logged driver durations total 670.124 s of that 670.610 s interval. The runtime stack samples caught the thread in nvgpucomp64.dll. There were no Presents in that interval and the run remained active. The verified seed held 8,426 native entries and the live cache had 10,565 files at this sample. The foreground sequence is separate from the worker-gate pressure described on #2628. This supports warming the demanded native PSOs on this GPU. It does not show that precompilation resolves the full world transition.

@pickles976

Copy link
Copy Markdown

Blocker for 16 GiB / capped Wine hosts (source-verified at exact head 82e4a9bbf3be583418b9df7825dd1430fd8b06d6): the default worker budget has a byte/MB mismatch.

crates/xcl/src/host.rs:13-22 documents and returns system_commit() total/limit in bytes (K32GetPerformanceInfo × PageSize). crates/xcl/src/shaders.rs:1683-1694 forwards limit.saturating_sub(used) unchanged to workers_for(cores, free_mb), which divides by 3072 assuming its input is MiB. On this laptop nproc=16; for an illustrative 6 GiB free commit, the intended three-GiB-per-worker rule is 2 workers, but the head's expression selects 12 (all 16-4 allowed CPU slots). Under the local 9 GiB Wine cgroup and 16 GiB physical RAM, this can trigger the external 2 GiB MemAvailable guard or an OOM before the title starts. XCL_PREPARE_WORKERS=1 avoids this risky default for local trials, not a shipping fix. Please make the argument explicitly bytes and divide by 3 * 1024 * 1024 * 1024 (or convert bytes to MiB before calling), add a regression with 6 GiB in bytes, and respect a smaller applicable process/cgroup memory limit if the application is launched within one; global commit alone does not enforce a 9 GiB scope cap.

I attempted the focused Windows-MSVC Wine test preparation_workers_leave_two_processors_and_follow_the_commit_left, but the head does not reach the test on this build setup: transitive windows-future 0.3.2 fails compilation against windows-core 0.62.2 / windows-threading (IMarshal, marshaler, submit missing), exit 101. Local log .compat-xcl/logs/verify-pr2624-wine-worker-budget.log. The existing synthetic workers_for cases pass fake numbers labeled MB and would not catch the bytes passed from the real caller. No worker processes or retail title were launched; the source-level unit mismatch is independent of the dependency build failure. Machine: RTX 4060 Laptop 8 GiB, Wine 11.0, 16 GiB host RAM.

@luckyteagirl luckyteagirl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With XCL_PREPARE_WORKERS=2, XCL_ADAPTER unset, and a title config such as d3d12_adapter = "1" on a two-GPU host, the parent captures progress.adapter but this child Command does not pass it on. Each worker enters the CLI shaders --precompile path with startup=None, so Pipelines::for_adapter("auto") selects the default adapter; the title runtime still selects adapter 1. That means the workers can warm driver PSOs for the wrong device, and matching-DXIL cache entries can later be rejected and rebuilt on the title's adapter. Could the spawn pass the resolved adapter to children (for example via XCL_ADAPTER only when no explicit environment override exists) and test the config-only secondary-adapter case? This is source review; I did not run a two-GPU preparation test, and this point concerns the worker pipeline path rather than all translation-only preparation.

@LocranKing

Copy link
Copy Markdown

Independent NVIDIA test report on exact head 82e4a9bbf3be583418b9df7825dd1430fd8b06d6 (clean detached checkout, no local changes), compared against nvidia-dev (c044dc6d).

Tested

  • Hardware: NVIDIA GeForce RTX 3060 Ti 8 GB (Ampere, wave32, driver 32.0.16.2140 / 621.40), AMD Ryzen 5 5500 (6c/12t), 32 GB RAM, Windows 11 Home (build 26300), Rust 1.100.0 (stable-x86_64-pc-windows-msvc), Windows SDK 10.0.26100.0.
  • cargo build --workspace + cargo test --workspace --no-fail-fast -- --test-threads=4 (debug):
    • nvidia-dev (c044dc6d): 1560 passed, 6 failed, 47 ignored (xcl --lib: 1490 passed, 2 failed, 27 ignored), 28 SKIPPED.
    • #2624 (82e4a9bb): 1721 passed, 6 failed, 48 ignored (xcl --lib: 1594 passed, 2 failed, 28 ignored), 28 SKIPPED.
    • 0 new failures vs nvidia-dev (+161 passing tests). All 6 failures match nvidia-dev:
      • hle::d3d12x::texture_upload::tests::{gpu_parts_of_a_texture_go_up_and_the_rest_stays, pieces_hold_the_texels_of_their_levels} (texture_upload.rs:990:17: attempt to multiply with overflow in debug)
      • d3d12_mesh_stream::console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly (expected AS-slot refusal in translation_errors: ["MS: no NGG hardware variant"])
      • gpu_compute_e2e::async_compute_pso_registers_real_pso_and_not_standin
      • gpu_two_pass_cache_e2e::two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (both test runs fail with disabled:)
    • 28 SKIPPED GPU tests on this adapter: 21 wave64-only (no wave64), 3 wave32 per-lane f16/f32 semantics, 1 no heap windows, 1 no heap windows (opt-in: XCL_HEAP_WINDOWS=1), 1 no D3D12 debug layer (0x887A002D), 1 cannot disable driver cache without Developer Mode (0x887A002D).
  • Shader preparation check (with used-shaders.txt = 11 shaders from the prior XCL_PREPARE=0 run):
    • Launched 8 worker processes on the 12-thread CPU (0 of 8 workers failed), checked 26,503 records and finished compute pipeline preparation in 6 s (total_elapsed_s=72.5 including the 60 s run), presentation window worked cleanly.

Regression run
scripts/smoke.ps1 -Seconds 60, release builds of nvidia-dev (c044dc6d) and #2624 (82e4a9bb):

nvidia-dev (c044dc6d):

xcl-smoke v1
commit: c044dc6d48d2b46a8ae77852df275c534681f3df
gpu: NVIDIA GeForce RTX 3060 Ti
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1552 (PresentX 1552)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15485 MB

PR (XCL_PREPARE=0):

xcl-smoke v1
commit: 82e4a9bbf3be583418b9df7825dd1430fd8b06d6
gpu: NVIDIA GeForce RTX 3060 Ti
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1566 (PresentX 1566)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15475 MB

PR (with worker preparation over used-shaders.txt, 8 workers, 6 s prep):

xcl-smoke v1
commit: 82e4a9bbf3be583418b9df7825dd1430fd8b06d6
gpu: NVIDIA GeForce RTX 3060 Ti
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1576 (PresentX 1576)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15585 MB

Not tested

  • Cold XCL_PREPARE_ALL=1 full-pack compute precompile pass; AMD / Intel / Linux GPUs; XCL_SAMPLE_* tests; the 60 s smoke run covers boot/intro/menus and does not enter the 3D world.

AI use

  • Antigravity (Gemini 4 Hydrogen) ran the builds, test suite, and smoke.ps1 commands on this machine and drafted this report from the captured outputs.

@itsSio

itsSio commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Dual-PC NVIDIA full-workspace test run (debug) and RTX 5080 retail smoke (release) at exact head 82e4a9bbf3be583418b9df7825dd1430fd8b06d6, covering the full suite, hardware-GPU tests, integration tests, and non-5090 NVIDIA hardware listed under Not tested.

Tested

  • Commit 82e4a9bbf3be583418b9df7825dd1430fd8b06d6 (base nvidia-dev), clean checkouts on both PCs, XCL_ADAPTER=NVIDIA, cargo build --workspace before running cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture.
  • PC 1: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro build 26200.9974, rustc 1.97.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug build.
    • Full workspace: 1720 passed, 6 failed, 48 ignored (lib: 1594 passed, 2 failed, 28 ignored; raw lines also print 3 single-test child reruns and a duplicate gpu_two_pass_cache print, excluded from totals).
    • SKIPPED: 27 lines (no-wave64 group, 3 refused wave32 per-lane f16 forms, no heap windows).
  • PC 2: NVIDIA GeForce RTX 2080 SUPER (driver 32.0.16.1088), AMD Ryzen 5 5600X, 16 GB RAM, Windows 11 Pro build 26200.8653, rustc 1.99.1 (stable-x86_64-pc-windows-msvc), Windows SDK 10.0.26100 DXC 1.8.2502.11, debug build.
    • Full workspace: 1721 passed, 5 failed, 48 ignored (lib: 1594 passed, 2 failed, 28 ignored).
    • SKIPPED: 30 lines (18 distinct tests: PC 1 skips plus pso_measurement_compiles_an_exact_synthetic_record, uploads_start_from_each_subresources_state, and 2 lower:: wave64 tests).
  • All 4 new #2624 tests pass on both PCs: the_shaders_of_a_used_set_are_kept_for_the_next_run, the_key_of_one_shader_is_the_key_of_a_set_of_it, preparation_workers_leave_two_processors_and_follow_the_commit_left, static_sampler_set_before_a_branch_is_a_constant_after_it.
  • Failures (5 pre-existing on nvidia-dev, reproduced on both PCs):
    1. texture_upload::tests::pieces_hold_the_texels_of_their_levels & gpu_parts_of_a_texture_go_up_and_the_rest_stays (texture_upload.rs:990:17, debug multiply overflow in test LCG).
    2. d3d12_mesh_stream::console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly (:96, expected AS-slot refusal, got ["MS: no NGG hardware variant"]).
    3. gpu_compute_e2e::async_compute_pso_registers_real_pso_and_not_standin (:535, TRANSLATED_COMPUTE cleanup vs late_release).
    4. gpu_two_pass_cache_e2e::two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (:649, two-pass state release left 3, right 0 vs late_release).
  • New failure on PC 1 only (e2e::test_title_runs_and_game_folder_is_untouched, e2e.rs:168):
    • The game folder snapshot gains empty NVIDIA Corporation\ and NVIDIA Corporation\umdlogs\ directories.
    • A/B on the same RTX 5080 and driver: #2624 (82e4a9bb) failed 4/4 runs; nvidia-dev (c044dc6d) passed 3/3 runs (where the VFS redirects those driver writes to the overlay because D3D12 init happens after VFS install, whereas preparation::before_guest opens D3D12 before VFS install while cwd is the game root). Passing on PC 2 (RTX 2080 SUPER does not create umdlogs).
  • Retail 60 s smoke on PC 1 (RTX 5080, release build, XCL_PREPARE=0, XCL_DXC_DIR = DXC 1.9.2609.5):
xcl-smoke v1
commit: 82e4a9bbf3be583418b9df7825dd1430fd8b06d6
gpu: NVIDIA GeForce RTX 5080
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1677 (PresentX 1677)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14970 MB

Not tested

  • Worker-process shader preparation (XCL_PREPARE=1) and used-shaders.txt reuse on a retail title, visual verification of the static sampler fix in 3D world rendering, AMD / Intel GPUs, and retail smoke on the RTX 2080 SUPER.

AI use
Ran via Samaritan:

  • Google Antigravity CLI (Claude Opus 5.5 (High)): ran the dual-PC workspace test suites, the e2e A/B check against c044dc6d, and the release build, and traced the before_guest cwd vs VFS ordering behind the umdlogs failure.
  • Google Antigravity CLI (Gemini 4 Neon (High)): ran the 60 s RTX 5080 retail smoke test and wrote this test report.

@theaustinayers
theaustinayers merged commit 82e4a9b into nvidia-dev Nov 26, 2026
0 of 2 checks passed
@KDenKC

KDenKC commented Nov 26, 2026 •

Copy link
Copy Markdown

+1 to @pickles976's byte/MB finding above (7182236787). I didn't see it before posting, sorry for the repeat. One new data point: it is still there at the current nvidia-dev head af2cecc4 (shaders.rs:1727 passes system_commit() bytes to workers_for, which divides by 3072). So on a 16-thread CPU the default is still 12 workers, whatever commit is free. We'll set XCL_PREPARE_WORKERS explicitly when we run the branch.

AI use: Claude Code (Claude Opus 5.5) checked the source at af2cecc4 and wrote this.

@pr1sm-dev

Copy link
Copy Markdown

@pickles976 confirmed by reading the current nvidia-dev head af2cecc: prepare_workers (crates/xcl/src/shaders.rs:1727-1728) still passes host::system_commit(), which is in bytes (host.rs:11-12), to workers_for(cores, free_mb), which divides by 3072 as MiB (shaders.rs:1732-1733). So the commit bound never applies, and the count is always the logical processors less four (capped at 32).

I'm taking the fix, as a small PR against nvidia-dev: convert at the call site, leave workers_for and its tests as they are, and add a regression test with byte values (6 GiB free on 16 threads → 2 workers). A process or cgroup memory cap that the commit figures do not show stays out of scope; I'll say so in the PR.

AI use: Claude Code (Claude Opus 5.5) read the source and wrote this comment.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.