Repository navigation
Conversation
…ave64 masks Bring Direct DXIL pixel shaders and wave64 HLSL pixel shaders in line with 6ec402b (first_lane_live) and 8fcc111 (mask_live): - Direct DXIL v_readfirstlane_b32 now calls Lw::first_lane_live, intersecting EXEC with ballot(true) in pixel shaders when any live lane is active so helper-lane zeroing inside loops on AMD drivers cannot spin to LOOP_BUDGET. - Wave64 HLSL pixel shader s_and_b64 / s_andn2_b64 with EXEC or VCC now tests live lanes only via mask_live64, matching mask_live for wave32 pixel loops. Assisted-by: Antigravity (Gemini 4 Neon High)
…)) wrong) amdxc64 on RDNA4 folds Bfrev(Countbits(K)) for a constant K to Bfrev(n) | n (0x80000001 for K = 2). Fold Countbits of constants in bit_count so the driver never sees that pattern. Fixes fuzz seed 1599 on the RX 9070 XT (xcl-dev#2115). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In a Wave32 pixel shader a VALU mask write (a carry or compare SDST) and a scalar SAVEEXEC / WREXEC write one dword: write_mask calls write32 when the program is not wave64. The liveness that decides whether a mask needs the helper lanes' quad reads (x64_masks) took its kill sets from the ISA tables, which describe the wave64 pair. So `v_add_co_u32 v3, s20, ...` was taken to overwrite s21 as well; an earlier carry into s21 that `v_bcnt_u32_b32 v4, s21, 0` reads later was taken for a lane-local mask and built with ballot_px_local, and with WQM on its helper lanes' bits were missing at triangle edges (xcl-dev#2584). For Wave32 pixel shaders those writes now kill one dword, and a mask write takes the full ballot when either this liveness or the existing pair rule says its destination can be read whole, so no mask that took the full ballot before loses it. Split wave64 and wave64 pixel shaders keep the pair rule; the direct DXIL path (by_pc) is unchanged. Tests: x64_masks::tests::wave32_carry_into_s20_preserves_a_whole_read_of_s21 and gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges, which draws the issue's program on two triangles. Fix and tests by akimfomin (akimfomin/xcl@d3e7725), carried onto main without its README line. Refs xcl-dev#2584 Co-authored-by: akimfomin <akim.fomin@mail.ru> Assisted-by: Google Antigravity CLI (Claude Opus 5.5 (High))
This takes out e964ad2, which kept the table limit of 8,192 words on a GPU with 64-lane waves. It was added after a run on an RX 9070 XT at cbc296a, where neither form of the program it let in built within 24 GB and the compact form reached that sooner. Since xcl-dev#2174 the compact form nests its dispatch by default, and on the same card model with 64 GB that program's nested compact form built in 159 to 203 s at about 34 GB with heap memory windows, where its plain form, which the guard kept, passed 48 GB (komglebissarov on xcl-dev#2088, 1 run per form). With the default switch windows both forms passed 48 GB, so that path does not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit b6df9a7) Port onto nvidia-dev: the table limit lives in automatic_plan (this branch's form of `wanted`, which also takes split-wave atomic programs), so its `tables` argument goes and it checks MAX_TABLE_WORDS; the `wave32_only` argument of translate_compute_rodata goes the same way.
In Direct DXIL mubuf and buffer_atomic (stride == 0), off = voff + OFFSET and e = off + bytes were compared against d2 without checking for 32-bit unsigned wraparound (xcl-dev#1893). A large voff near 2^32 wrapped below d2 and passed the OOB guard while 64-bit buffer_window() carried into the adjacent 4 GiB UMA window. Check unsigned carry in pure 32-bit arithmetic (off >= voff when OFFSET != 0, and e >= off) before comparing e <= d2, avoiding i64 promotion while closing the wraparound bypass. Assisted-by: Antigravity (Gemini 4 Neon High) (cherry picked from commit 70e600d) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes two Direct DXIL correctness bugs (xcl-dev#1894, xcl-dev#1890): - Module::uses_double_extensions now iterates live instructions in self.blocks (matching insts_use_type) instead of all self.insts, preventing DCE-removed f64 ops from spuriously setting DoubleExtensions shader flags. - Lw::top_vgpr now incorporates Lw::max_vgpr precomputed across all decoded instructions (init.touched is empty outside Entry::Kernel), and v_movrels / v_movreld / v_movrelsd mask M0 to M0[7:0] (& 0xFF) per RDNA2 ISA. Assisted-by: Antigravity (Gemini 4 Neon High) (cherry picked from commit 2c33f9f) Port onto nvidia-dev: only `max_vgpr` is added to Lw; the `barrier_uav_fence` field next to it upstream belongs to 85a9480, which this branch does not have. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port xcl-dev#1818's constant-CFG terminator and path-fact folding onto Direct DXIL and fix the stale shader-flag validation gap that blocked it: 1. Resolve CSE and trivial-PHI replacements before CFG folding, propagate dominating branch/switch path facts (bounded to 16 RPO passes so large shaders stay linear), fold constant CondBr/Switch terminators, drop newly unreachable blocks and obsolete PHI edges (preserving loop backedges), and rerun trivial-PHI simplification (opt-out via XCL_DXIL_NO_OPT=cfg). 2. Reconcile Int64Ops, Doubles, DoubleExtensions (including f64 FMA), ResourceHeapIndexing, SamplerHeapIndexing, AtomicInt64*, and TypedUavLoadAdditionalFormats in Shader::infer_type_features() against surviving reachable instructions after optimize(), preventing stale shader flags when dead branches are pruned. Adds unit tests covering constant branches/switches, dominated branch facts, reconvergence, loop PHI backedges, and pruned i64/heap shader flags. Assisted-by: Antigravity (Gemini 4 Neon High) (cherry picked from commit f4b0706) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cks, and IR opts Large console compute shaders previously exceeded 1 MB of DXIL bitcode (>136k instructions, 15k interned table constants, 84 switches) and stalled or OOM-spiked amdxc64 during pipeline creation on AMD RDNA4. - Bitcode encoding (bitstream.rs, module.rs, bitreader_tests.rs): emit LLVM DEFINE_ABBREV records for hot instruction/constant opcodes, emit compact lookup tables via CST_CODE_DATA (ConstDef::DataI32), and prune dead constants in write_bitcode (~6.88 -> 4.31 B/inst). - Compact form (compact.rs, lower.rs, kernel.rs): isolate repeated heavy memory ops (ENC_MUBUF/MTBUF/SMEM/MIMG/FLAT) into standalone micro-blocks, run backward SGPR+SCC liveness to strip dead far-jump veneers and dead SCC/SGPR slot stores, strip pure no-ops and bypass empty non-header jump blocks while preserving fallthroughs, add TargetPool successor encoding, and support single-literal / S_GETPC_B64 parameterization on large shaders. - IR optimization (opt.rs, lanes.rs, prelude.rs, lower_valu.rs, pso.rs): multi-iteration fixed-point optimize() with intra-block scalar alloca store->load forwarding + DSE, entry hoisting of repeated ReadNone system intrinsics (keeping createHandleFromHeap unshared and annotateHandle / getDimensions block-local for AMD RDNA4 amdxc64 stability), dominator branch-fact propagation, adjacent redundant barrier elimination, chained select collapse, constant EXEC lanebit folding, single-instruction f32 IEEE-754 fcmp predicates, XCL_RDNA_FLOAT native op::FRC + mul/fma_legacy constant fast-paths, and XCL_HEAP_WINDOWS default ON. Verified: 201/201 gpu::dxil + gpu_bvh unit/validator/GPU tests pass with 0 dxcompiler 1.8.2502.11 errors; 95cc13288a27a96e shrinks from 1,238 KB (1,036.8 KB w/ heap windows) -> 230.8 KB (236,320 B DXBC, 37.6s amdxc64 compile) and 958400d2caf07244 -> 139.4 KB (142,740 B DXBC, 9.86s compile). Assisted-by: Antigravity (Gemini 4 Neon High) (cherry picked from commit 46aecbf) Port onto nvidia-dev: - XCL_HEAP_WINDOWS stays opt-in (`=1`), as on this branch: the default flip is not part of the size work, and two NVIDIA setups failed with heap windows on. - compact.rs: this branch's automatic_plan (which also takes split-wave atomic programs) counts the micro-blocks the same way `wanted` does upstream, against the new MAX_TABLE_WORDS. - lanes.rs keeps the launch-EXEC shortcut (`live_exec`) before the new constant-mask folds; lower.rs keeps the code region's high word (`code_hi`, constant data after the program) for s_getpc_b64. - opt.rs keeps the test-only XCL_SAMPLE_PHI_CSE arm. - Left out: the test edits for 9c4a921 (split.rs) and 324193c (heap_window_tests.rs), commits this branch does not have. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
inst_sreg_scc_use_def now treats all S_CMOV* as conditional writes and S_ADDK_I32/S_MULK_I32/S_BITSET* as read-modify-write on SDST, and clamps Wave32 VALU 64-bit mask defs to 1 SGPR so live s[v+1] slots are not killed. Assisted-by: Antigravity (Gemini 4 Neon) (cherry picked from commit a523305) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…compile commit spikes compact::large() previously only checked reachable non-terminator instruction count (>= 20_000), ignoring both terminating branches and basic-block count. Branch-heavy unrolled compute shaders just below 20k non-terminator instructions (for example, cs 56c0cd3b82a00c6e) skipped compact lowering and emitted >2.6 MiB monolithic DXIL (~588k IR lines, ~32k blocks, ~36k PHIs), causing the driver compiler to commit >36 GiB of virtual memory and stall compilation. In compact form the same shader shrinks to ~160 KiB (~975 blocks, 108 PHIs). Lower the non-terminator threshold to 10_000 and add a reachable basic-block threshold (>= 2_000) in compact::large(); compact::wanted() still gates adoption on >70% deduplication and bounded table size. (cherry picked from commit 5399542) Port onto nvidia-dev: `large` is asked by automatic_plan here (this branch's form of `wanted`); its doc says so instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Snapshot of uncommitted work inherited from the previous agent session: ps_masks, rt_leave_out, ambient, format_alias, gpu_awake, vram_small and related d3d12x/dxil/recomp changes. Local safety commit, not for review. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Work in progress from the 2026-11-27/28 sessions on an RX 9070 XT (one retail title), saved as one commit. Not split into PRs, not rebased: origin/main has moved on (31 commits, the shader preparation and pipeline library work) and origin/nvidia-dev / origin/amd-dev differ. What was wrong and what changed: - The title makes every state transition through command list xcl-dev#146, Barrier(groups) (enhanced barriers). XCL answered it with a UAV barrier only, so no PC texture left the state it was made in and the world was dark. New hle/d3d12x/barrier_groups.rs turns the groups' texture barriers into legacy transitions through resource_barrier_x (depth twins and format aliases see them); `legal` drops what the PC would refuse (an illegal one fails Close with E_INVALIDARG and the title stops). XCL_BARRIER_GROUPS=0 off, XCL_BARRIER_LOG=1 logs kinds. - Tiled lighting tests depth EQUAL against a class buffer (console D16S8, PC R24G8) that only compute writes through a UAV. Depth UAV twins are on by default (depth_uav DEFAULT_ON), and the stencil plane's twin is now copied to and from the plane through a buffer (StencilCopy, list_x::stencil_copies_on). - ambient.rs: the stand-in no longer keeps the title's own probe resolve while XCL_RT_LEAVE_OUT leaves out the programs that feed it (that kept garbage: a flat green wash and bright bands); XCL_AMBIENT_KEEP overrides. A frame-based estimate from CS_CacheScreenSpaceRadiance (64x36 cells, slow mean; credit in THIRD_PARTY.md) raises the fill: XCL_AMBIENT_FRAME (default 0.8, 0 off). - sRGB textures with unordered access made typeless (opt-in, XCL_SRGB_UAV=1); XCL_DUMP_TARGETS also writes each depth twin as a picture of its raw bytes; XCL_RAM_MB=auto (ram_budget.rs), XCL_MEM_MAP=1 (mem_map.rs), lazy-level texture uploads. Measured (guarded runs, 200 s, intro to the first world scenes): exit 0x0, no device removal, no crash, no TDR; the world is lit; 5-7 presents per 2 s in the world; peak commit about 21 GB. Still wrong: round hard-edged patches where one lamp lights everything inside a screen circle (made inside the class-0 tiled lighting shaders; the class buffer itself is right), characters lit only inside such patches, dark scenes, small dark triangles on diagonals. Most likely cause: the title ray-traces lamp shadows and bounce light, and CS_RaytracingResolve / CS_ScreenProbes_ActivateRays are left out here (XCL_RT_LEAVE_OUT); with them allowed, world entry compiles push title commit from about 10 to 21 GB and a 32 GB PC runs out (the shader preparation work on origin/main targets this). Tests: cargo test --release -p xcl --lib -- --test-threads=4 ambient barrier_groups depth_uav format_alias: 42 passed, 0 failed. Whole suite not run. Written with Claude Code (Claude Mythos 5.2, then Claude Opus 5.5). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… barriers with console flags
…apture, and retained base PSO shaders
A title list's extra segments (mid-list splits) are parked as spares at the list's next Reset, and the segments KickoffX takes back become spares too. A spare records again only after its own later Reset, but alloc_pool still counted it as a user of the PC allocator it last recorded on, so that allocator was never free: each later Reset of the title's allocator while those were "in use" put another PC allocator aside, and none was ever reused or released. The previous recording a stand-in replaces at Reset pinned its allocator the same way. alloc_pool::park_list drops the list from its allocator's users (its submit marks stay, so the allocator is reused only once the GPU is past them). title_list::reset parks the moved segments and the replaced recording; KickoffX parks its reclaimed segments after both submits. Measured on the title (RTX 5070 Ti, Series X profile, 240 s untimed runs, object counts from 100 to 240 s): PC allocators 1,137 -> 1,928 without, 728-753 -> 862-897 with; non-local video memory 6.2 -> 9.6 GB without, 5.0 -> 5.4-5.5 GB with (about 4 GB less at 240 s). Timed pairs showed no frame-rate cost (late window 11.99 / 10.76 fps without, 10.76 / 11.76 with; run-to-run spread ~10 %). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit bf42a6e)
…acements A sampled texture the shared 64 KiB pages do not take (vram::place_pages refuses it; a 1D texture cannot be a reserved resource) was a committed resource, which takes at least 64 KiB of video memory. On the title the committed fallback held 8,361 x 64 KiB = 523 MiB (XCL_COMMITTED_AUDIT), mostly ~5k Texture1D RGBA8_SRGB textures of 4 KiB or less. With the switch, such a texture goes on a 4 KiB placement in a 4 MiB DEFAULT heap of XCL's own (ALLOW_ONLY_NON_RT_DS_TEXTURES), made through the adopting CreatePlacedResource. Only when the PC allows it: no RT/DS/UAV flags, one sample, and GetResourceAllocationInfo returning 4 KiB alignment for the description asking for it (most detailed level within 64 KiB). Otherwise, and when no heap can take it, it is committed as before. Its units are free again where late_release lets its last reference go (the queues are past the work before it); with XCL_LATE_RELEASE=0 the switch does nothing (logged once), as uploads of XCL's into a texture could still be in flight at the title's release. XCL asks no residency priority for the heaps, as for a committed texture (logged per heap). Measured on the title (RTX 5070 Ti, one 480 s run per arm, same base and env, with and without the switch): 8,192 small textures live in 58 MiB of 15 heaps, against at least 512 MiB as committed resources; local video memory over 250-310 s 18,332 vs 18,793 MB (-461 MB) with equal sparse pools and target pages. Still 3.1 GB over the budget there, and the frame rate did not move. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 24fdb7b)
NVIDIA adaptation of CallMeBrado's xcl-dev#1916 at e2aa856. Keep storage-only homes CPU-backed until explicitly mapped, then replay preserved bytes even when ordinary storage write hints are disabled. Based directly on nvidia-dev 54225f5, without the separate physical-page liveness, alias-identity or owner-sampler integration. Preserves NVIDIA's existing free/title mapping behavior. Prepared from integration abc027544; source-reviewed independently. Added fixtures are unrun, no native or build results claimed. Assisted-by: Codex (GPT-6) (cherry picked from commit 6330fba)
Correct PageSize=2 rounding while preserving explicit alignment, checked sizes, and recorded allocation/free accounting. Update the test title's alignment and zeroing-tail probes to the same 2 MiB contract, keeping the tail read inside its allocation. Three focused tests passed on the earlier preserved patch; restoring the old 4 MiB grain failed all three controls. The new squashed head has not been run individually. Full-suite and retail merge checks remain pending. Assisted-by: Codex (GPT-6) (cherry picked from commit f00e1c4)
…roll `ballot_px_quad` took its quad's four members in an `[unroll]` loop. It is called in most translated pixel shaders, often hundreds of times, and DXC unrolls every inlined copy: on a 395 KB one with 84 calls, `-ftime-report` put 22 % of its pass time in "Dxil Loop Unroll" and 9 % more in "Unroll loops" and LCSSA. The four members are now written out, in the form thehollowedone gave in review. On a retail pack, 282 pixel shaders compiled in-process on 8 threads took 72.1 s instead of 125.1 s on Windows (Ryzen 7 5700X3D). 980 of them through dxc.exe took 505 s instead of 854 s with DXC 1.9 and 575 s instead of 961 s with DXC 1.8. Under Wine, XCL's own pass over the 980 took 59 s instead of 116 s with xcl-dev#688's private DXC heaps; without them it was slower (428 s against 387 s). Co-authored-by: thehollowedone <36892342+thehollowedone@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 2dad32e)
sparse.rs previously stored free pool tiles in a flat Vec and popped the oldest cooled tile from cooling in FIFO order before checking free. When tiles freed across multiple 64 MiB pools cooled, reuse_tile handed out tiles from nearly-empty draining pools instead of packing fuller ones, keeping sparse pools pinned so retire_free_pools could not reclaim them and splitting UpdateTileMappings calls across more heaps. Partition free sparse pool tiles by heap in FreePools. reuse_tile drains cooled tiles into their heaps and takes from the fullest partially-used heap (fewest free tiles in 1..POOL_TILES, lowest heap index on ties), leaving nearly-empty and all-free heaps untouched for retirement unless no partially-used heap has a free tile. retire_free_pools drains cooling and checks heap counts in O(pools) instead of scanning all free tiles, and before_execute_on passes free.has_empty_heap() to retire_due so an all-free heap completed by take_tile's drain_cooling still retires even when cooling is empty. Measured on RTX 5080 (180 s Series S XCL_DEVICE_TYPE=lockhart A/B vs nvidia-dev af2cecc): peak commit 22042 -> 21818 MB (-224 MB), steady sparse pools 5440 -> 5376 MB (-64 MB), UpdateTileMappings calls 891 -> 736 (-17.4%) for 120k mapped tiles, 0 device removals, 0 crashes. sparse::tests: 61 passed, 0 failed, 1 ignored. Assisted-by: Antigravity (Gemini 4 Neon (High)) (cherry picked from commit 8cf249e)
…d textures drawn again Work in progress on the visual defects of a retail title on an RX 9070 XT (direct DXIL), not split into single changes yet: - ambient: the resolve's light and depth are taken from their own slots; the estimate is made in space from the depth (cells placed, gathered at 160x90 points, raised along a normal rebuilt from the depth), the air's light is held to the light around, magenta is rejected in the reflection clamps. Switches: XCL_AMBIENT_SPACE, XCL_AMBIENT_SPLIT, XCL_AMBIENT_MOST, XCL_AMBIENT_SKY. Credit in THIRD_PARTY.md. - shadowed textures a draw's tables name are made active again (after open PR xcl-dev#2956): video frames no longer come up green. - draws of bake pipelines (drawn once and kept) wait for their pipeline and make the shadowed textures they pick by index active again (XCL_KEPT_DRAWS, XCL_BAKE_SOURCES). - diagnostics: XCL_TRACE_LATE, XCL_TRACE_SLOT. - earlier fixes of this branch: vertex buffers kept out of the alias space, the PS export patch table for all pixel shaders, ambient levels. Tested: cargo test -p xcl --lib -- ambient stage_name placements title_textures pso_async bcpack rt_leave_out: 117 passed, 0 failed (RX 9070 XT, release build runs of 300 s without device removal). Not tested: the whole suite, scripts/smoke.ps1, other GPUs. Open: black heads at a distance, dotted diagonals, 3-5 fps in the world. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
The existing row-factorized detiler still visited swizzled textures one element at a time and recalculated block placement for every element. Large CPU-written textures therefore consumed milliseconds on the submit path even after persistent detile workers. Adapt raylitebull's 032c661 block-slab algorithm: cache the largest provably contiguous horizontal run for each immutable GFX10 layout, keep one 4 KiB/64 KiB block hot at a time, bulk-copy complete runs, and retain element-wise bounds checks for a truncated source. Low-bit base swizzles shorten runs safely; thick 3D single-slice helpers retain their former path. On this AMD EPYC 7R13 Linux host, an isolated release benchmark against 032c661's parent reduced 1920x1080 R8 mode-5 detile from 8.8-10.3 ms to 0.76-0.87 ms and tile from 28-31 ms to 0.64-0.78 ms. A 2048x2048 RGBA8 mode-10 detile fell from 28-31 ms to 9.7-11.8 ms and tile from 59-67 ms to 5.8-6.9 ms. All 17 isolated pure tiling tests passed. The Windows GNU library/test cross-check passed with the existing warnings; Windows MSVC, GPU, and smoke tests were unavailable. Source algorithm: 032c661 by raylitebull, assisted by Antigravity (Gemini 4 Neon High). Assisted-by: Codex (GPT-5.6-sol) (cherry picked from commit 95f12a0)
Every mirrored vertex or index bind and draw searched the append-only mirror table behind one global mutex. Once a title created a mirror, repeated hot-path lookups serialized even though existing entries never change. Keep a complete ordered mirror snapshot per thread and answer positive lookups locally. Misses still lock and refresh from the authoritative table, preserving first-match range selection and immediate discovery before creating a mirror; the no-mirror case rejects from the existing byte counter. Assisted-by: Codex (GPT-5.6-sol) (cherry picked from commit 66f0ea5)
|
This merges amd-dev (f9e3172) into main and then main 86e86fc on top. #3554, which merged the same main commit into amd-dev the other way, was closed without merging. This branch now also has amd-dev's three newest commits (3a3a8e9, 4d6d4a7, 41aa60c) and conflicts with main again. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
graphics_stages_emit_a_repeated_load_once (from amd-dev, xcl-dev#2446) counts rawBufferLoad calls in vertex and pixel programs whose loaded SGPRs are never observed: a VS or PS writes no SGPRs back at its end. Main's xcl-dev#3503 (6ff86e3) made rawBufferLoad eligible for dead-code elimination and keeps a single raw load only so the shader flags stay valid, so in the merge every program in the test compiled to exactly one load. The store case then failed (1 vs 1 + 4), and the repeat case passed only because both sides were that one surviving load. Neither side's lowering is wrong and the merge did not combine the reload or window code badly: reload.rs, the follow_loads stages and the s_load path are amd-dev's as is. Each program now stores the sum it computes, so the loads it reads stay live and both assertions measure the reload again.
xcl-dev#3442 (main) made startup preparation build only a split program's ABI whole when its driver blob is kept on disk, and tested it with a scratch cache_dir on an NVIDIA adapter, where the driver-blob cache is on. amd-dev's 0481ad6 gates the same function on whole_form_kept() (XCL_PSO_DISK_CACHE or XCL_PSO_LIBRARY), both off on AMD by default: there the title never takes the ABI whole, so preparation builds the pieces, and the chain-root wholes only for programs dispatched indirectly. The merge kept both, correctly: xcl-dev#3442's path when wholes are kept, amd-dev's otherwise. But xcl-dev#3442's test never set up the kept condition, so on AMD it took amd-dev's path and found the chain blobs. The test now forces the pipeline library on (its existing test hook; the driver-blob cache has none) for xcl-dev#3442's cases, and adds amd-dev's case without kept wholes, asserting the blobs it builds per indirect prewarm. That case is skipped where the driver-blob cache is on. No production code changes.
|
Thanks. On the open points:
The head is now 87edfef: amd-dev 41aa60c and main d0832e6 merged, plus a VFS fix from the merge and two test fixes (#2446's reload test with #3503, #3442's startup-preparation test on AMD). A regression run against plain |
process_memory() read PROCESS_MEMORY_COUNTERS_EX::PrivateUsage, which
Wine leaves 0, so under Wine every --measure-pso commit figure was 0
and the_peak_memory_counts_what_was_given_back failed ("peak 0 MB,
before 0 MB"). kernelx::process_private_bytes() already falls back to
PagefileUsage when PrivateUsage is 0 (the same number on Windows), so
use it here instead of a second copy of the query; any later fix to
that fallback then covers the measurement too.
a_released_allocator_keeps_its_chains_until_the_gpu_is_done records a split ExecuteIndirect on a list it never adopted. execute_indirect binds the slicer through bind_pipeline_exact, whose slot!(list, "SetPipelineState") looks the list's vtable up among XCL's classes, so the test panicked with "adopted class" whenever no earlier test had filled that call site's slot cache. The panic happened under the CLASSES lock and poisoned it, which then failed failed_binding_keeps_indirect_commands_until_allocator_reset in the same process. Set the list up the way the sibling test does: adopt it, register it with list_x, and close it through the PC slot. Nothing changes in non-test code.
private_physical_pages_reach_the_gpu_on_mapping came to amd-dev with 87e900b (the NVIDIA adaptation of xcl-dev#1916, xcl-dev#3123) unrun. Unlike xcl-dev#1916's fixture it sets XCL_SPARSE_LAZY=1, so the untouched middle page is committed as a LAZY tile with no video memory. A copy back skips such a tile (nothing to copy, the window reads zeros there), which leaves the fixture's own 0xdd CPU overwrite in place, and the zero check failed every time. Check what lazy commits promise instead: the middle tile has no video memory and the CPU's bytes stay. Without lazy commits the old zero check still applies. The written pages are checked as before. This matches the diagnosis on xcl-dev#3123 (thehollowedone, vasanex).
…ault Four alias tests rely on the first write through a view of a page never used faulting into `lazy`, which commits the page and sets its commit bit; the guards, reads by number and moves all key off that bit. Under Wine 11.21 that write does not fault: it lands in the section, `VirtualQuery` still reports the view as MEM_RESERVE, the lazy mark stays, and the bit is never set. So the views are never guarded and a read by number or a move sees zeros. The code is right on Windows, where these tests pass; the building blocks (sections, guards, lazy) pass under Wine too. Probe the behaviour itself rather than sniffing for Wine, and skip with the reason when it does not hold.
The slicer moved its commands to INDIRECT_ARGUMENT | VERTEX_AND_CONSTANT_BUFFER. vkd3d-proton only counts a transition to exactly INDIRECT_ARGUMENT as a write to indirect arguments; without one it hoists an ExecuteIndirect's preprocessing to the start of its command buffer, or of the whole submit. So the pieces' ExecuteIndirects read the commands before the slicer wrote them: zeros, or the groups and slab origins of an earlier split dispatch recorded with the same storage, run with this program's pieces. On RADV that is a TCP page fault and a gfx ring timeout where the world finishes loading, the removal seen at about 170 s on main and on the guard branch alike. The commands now go to INDIRECT_ARGUMENT alone (the root-constant chain ABI needs no constant buffer state). The split-chain test now also counts the groups the pieces run: 0 before this, 6, 0 and 2 now. (cherry picked from commit 373e22e) Assisted-by: Codex (gpt-6.2-sol)
Wine's D3DCompile cannot compile the guard's Load3 on a raw UAV. Cache the DXC shader before taking GUARD and fall back to D3DCompile if the device rejects DXIL. Keep the existing DRED label and the inline root-SRV path, which now gets checked counts under Wine. Port the guard's DXC tests. Run a split chain against the guard's root SRV in the slicer test and assert that out-of-range counts produce zero groups and that the pieces run the valid groups. (adapted from 9181dd3) Assisted-by: Codex (gpt-6.2-sol)
vram's mapping queue raised its value and then signalled it, ignoring the result. When that Signal failed, the value was one no Signal would reach: every queue's next submit waited for it (before_execute) and a retired texture's NULL unmap counted as done although nothing marked it. The value now moves only when the Signal was queued. A mapping or unmapping whose Signal failed is marked, and gets a later Signal before anything counts on it: before_execute queues one and has the title's queue wait for it, and a retired texture stays out of the pool until one completes. When none can be queued either, before_execute says so, and the submission stops with that cause (MappingUnmarked) instead of going out with mappings nothing covers. Tests: a failed Signal leaves the value a Signal reached; with the mapping queue held behind a test fence, a bind, a held unmap released inside before_execute and a retired texture's unmap whose Signals fail each get a later mark, and the work waits for it or does not go. (cherry picked from commit 6970034) On amd-dev, flush recycled zero-fill tiles before marking. A failed zero-fill Signal also leaves its ring slot unmarked. Keep the allocator and alias buffers in use until a later Signal covers the copy. Assisted-by: Codex (gpt-6.2-sol)
amdgpu, the Linux kernel driver, runs a process's page-table updates in order on one queue, and every unmap and every sparse rebind (REPLACE frees the old range) waits for all command submissions of the VM first. While a frame is in flight, a reserved texture made after its submit has no page-table entries, not even the PRT ones, until that frame is done. A console title may write a descriptor of a texture it has just placed that work it already submitted reads; on the console the memory is there, here the read is a GPU page fault (TCP, PERMISSION_FAULTS 0x3) and the device is lost. RADV_DEBUG=bo_history and the kernel log put the faulting virtual BO 32-38 ms after its creation, by a new placement, with the hung IB older than the texture. A texture from the pool has had its entries since before: its rebind still lands late, but the work in flight reads a NULL tile meanwhile. So: - the pool also takes render targets, depth and UAV textures and those with a clear value, keyed by its meaningful bytes; - every placement tops its description up to XCL_RESERVED_SPARES (default 2) spares made ahead, reserved under the pages lock and pooled only once a Signal of the mapping queue after them completes; - a placement that still has to make a new texture waits up to XCL_PLACE_MAP_WAIT_MS (default 1000) for such a Signal, polling the fence; when no Signal can be queued for it, the placement fails as a failed creation does. It is one change because the parts only work together: without the wait a burst of new textures outruns the spares and faults; without the spares every new placement waits a frame. It builds on the marks for mappings whose Signal failed (the commit before): spares and new placements count on a Signal reaching their mappings. On by default only under Wine with an AMD GPU, judged by the Vulkan physical device vkd3d-proton drives (DXVK's DXGI may report an NVIDIA GPU as AMD), else by the DXGI adapter: Windows drivers do not order page-table updates like this, and the extra creations and waits cost time on the title's thread (the log says how much: the placements, the spares made and the time spent making them, and the waits). XCL_LIVE_RESERVED=1/0 forces it either way. Tests: the gate and the vendor source, clear keys, the fence wait, placements with the gate on and off, concurrent placements and their spares, spares and a cold lazy placement whose Signal fails, and spares kept out of dump tracking. (cherry picked from commit ee13d5a)
vkd3d-proton keeps every command buffer an allocator needed in one cycle (recycled up to 256 per pool, never freed by a Reset), and RADV keeps each one's IB (80 KiB, growing to 640 KiB) and 16 KiB upload buffer in host-visible VRAM. GTA VI records 40-110 lists on one allocator in a world frame (4 while loading). alloc_pool's swaps spread those frames over hundreds of PC allocators, and every one that hosted a heavy frame kept its ~80 command buffers for good. That is the world's growing "other" video memory. Evidence (RADV uprobes via bpftrace plus amdgpu_gem_info): - live VkCommandBuffers 3016 vs 80K+160K+320K+640K USWC BOs 2989, 16 KiB upload BOs the same count; vkFreeCommandBuffers was never called. - ~1000 new command buffers a minute in the world, 5.0k of 5.25k in title-namespace pools. Each pool sat at ~6, took one burst of ~80 within 30 s while still being reset, and kept them. - every heavy cycle (42-112 recordings between two driver Resets of one PC allocator) is title list Resets; 39 of the first 66 were on the title's own allocators, 27 on ones alloc_pool made. So the title's own allocator now records only until its first Reset; after that alloc_pool records on allocators it made. Up to XCL_ALLOC_HEAVY_KEEP (16) allocators made here whose cycle reached XCL_ALLOC_HEAVY (16) recordings stay alive as spares, and a swap in a heavy namespace prefers one of them, so it does not grow a fresh allocator to ~80 command buffers again. An idle heavy allocator above that budget is released, and its command buffers go with it. reset_list pins the backing across the unlocked native list Reset, so a concurrent reclaim of the namespace can neither Reset nor release it under the recording that starts. Bundle allocators are left alone: vkd3d-proton keeps no command buffers for them. XCL_ALLOC_RETIRE=0 restores the old behaviour.
A GPU queue wait that outlasts the watchdog stops the title, and on RADV the kernel's ring timeout and a full GPU reset follow, with no page fault to point at the work. Only the device-removed path printed the ring of recorded draws and dispatches, so these stops named no pipeline. Print it here too, before the stop (and with XCL_WAIT_TIMEOUT_CONTINUE=1).
The amd-dev merge only reached stable 600 s runs when level pages, small textures, vram-small placements, zero-target-page fills and format aliasing were all turned off. Keep the merge head on main's opt-in defaults for these five switches so milestone-1 stability does not depend on per-user ENV edits. The feature code stays in place and can be re-enabled per run with =1 while the A/B and vendor coverage catches up.
The merge keeps XCL_ZERO_TARGET_PAGES off by default to match main, but `a_recycled_page_is_zeroed_before_a_new_texture_uses_it` validates the zero-fill path itself. Add a test-only AtomicBool override for `zero_target_pages()` and use a restore guard in that test so it can enable the path without depending on process env or leaking state to other tests.
…main-v3 # Conflicts: # crates/xcl/src/gpu/dxil/kernel.rs # crates/xcl/src/gpu/recomp/ps_masks.rs # crates/xcl/src/hle/d3d12x/bind.rs # crates/xcl/src/hle/d3d12x/indirect_guard.rs # crates/xcl/src/hle/d3d12x/real.rs # crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs # crates/xcl/src/hle/d3d12x/vram.rs # crates/xcl/src/hle/kernelx.rs
Draft for moving
amd-devintomain. Opened to see the full diff and to collect review; not ready to merge.What it brings
amd-devis 165 commits (157 without merges) ahead ofmain, 104 files, +28.4k/−1.3k. After #3444,amd-devalready containsmainup to the point of that merge. The main areas:ambient.rs), format aliasing, depth UAVs, the memory work (level pages, small textures in VRAMvram_small.rs, sparse pools and tile mappings, mirrors), two-pass mesh reuse, bake-at-submit, unlocked CPU readback.alias.rs).Open before this can leave draft
main(86e86fc) in afeb3e5. 27 files conflicted and were resolved keeping both sides. Wheremaindeliberately changed something (e.g.late_releasesignalling outside the lock, the indirect path indispatch_chain),main's version is kept withamd-dev's additions on top. It builds and the non-GPU unit tests pass, apart from tests that need a D3D12 device and a few Wine-environment failures in code identical on both sides. Not yet run in a game.amd-devand opt-in onmain(e.g. flat heap reads, see Recompiler: NVIDIA compute programs take flat heap windows by default #2428). Which of them stay on for every GPU needs to be agreed.amd-devruns a retail title into the world on an RX 7800 XT (RADV). Known open issue: an intermittent GPU page fault on reserved textures, which plainmainshows too (texture descriptors written for work already submitted before the texture's mapping exists). Results on NVIDIA and on Windows are still needed.🤖 Generated with Claude Code