D3D12.X: cap title texture upload batches by count and 32 MiB #1986
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1986
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1986/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@zondy1i on GitHub · 2026-11-25 00:24 UTC · original
zondy1i:d3d12x/title-textures-batch-cap→main· +41 −4 · 1 files · 1 commits · merged 2026-11-25 01:58 UTCBound each title-texture upload batch in
title_textures::upload_allto at most 256 textures and 32 MiB (down from 256 MiB with no item limit).Previously,
upload_allonly split batches at 256 MiB (BATCH_BYTES = 256 << 20). During heavy streaming of small textures (4–64 KiB mip tails / UI / cubemaps), thousands of textures could accumulate below 256 MiB and be recorded into a singleExecuteCommandListscall (2 * Ntransitions +N * mipscopies), risking a Windows 2 s WDDM TDR (DXGI_ERROR_DEVICE_HUNG). Becausegpu::texture::Uploader::stagingrounds the peak batch footprint up to a power of two and keeps that upload buffer permanently mapped, a single 256 MiB batch also pinned a 256–512 MiB persistent upload heap for the rest of the process lifetime.What is in it
BATCH_BYTESfrom256 << 20to32 << 20and addBATCH_ITEMS = 256incrates/xcl/src/hle/d3d12x/title_textures.rs.batch_fits()withsaturating_addso empty batches always accept their first upload (even if larger thanBATCH_BYTES, preserving progress), while subsequent uploads split atBATCH_ITEMS,BATCH_BYTES, or device changes.subresources_of_all/ upload dispatch when every remaining entry in a chunk was filtered out byunchanged_skip().batch_fits_caps_items_bytes_and_devicecovering oversized single textures, item-count splitting, exact/overflow byte bounds, and device switching.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), debug tests + release smoke.cargo test -p xcl --lib title_textures -- --test-threads=1: 14 passed, 0 failed, 0 ignored.cargo test -p xcl --lib gpu::texture -- --test-threads=1: 12 passed, 0 failed, 0 ignored.Regression run
main:
PR:
Not tested
AI use
batch_fits, added the unit test, ran the test/smoke verification, and drafted this description.@raylitebull on GitHub · 2026-11-25 01:12 UTC · original
Code review on
fb9d059:title_textures.rsupload batches by count and total byte budget cleanly caps per-batch staging growth and copy bursts.CIworkflow approved (currently running).Remaining before merge:
Build and test (Windows, no GPU)finishing green plus an AMD verification pass onfb9d059.@futurepro62 on GitHub · 2026-11-25 00:58 UTC · original · edited 2026-11-25 01:20 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
fb9d059(on its base80f4819).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 983 passed, 0 failed, 43 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.batch_fits_caps_items_bytes_and_device.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 993 passed, 0 failed, 45 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on main7994cd1too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests andconst_and_null_mask_operands_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
@JJAutoCompare on GitHub · 2026-11-25 01:32 UTC · original · edited 2026-11-25 02:42 UTC
Empirical verification — PR #1986 (
fb9d05910c783ee1999e5d57770ce37728d603fd)Tested clean detached PR head
fb9d05910c783ee1999e5d57770ce37728d603fd(git merge-tree --write-treeexited 0 againstorigin/mainat2bdf0477f84377d1b08e29424100c9bace4e530fand8f5fca5bb9ad6e695093d75294ad2cec023bba60).Environment
26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB (driver32.0.101.9175, wave lanes 8–32,DoublePrecisionFloatShaderOps=0,XCL_ADAPTER=A770,d3d12SDKLayers.dllabsent).rustc 1.100.0 (0ef1bc386 2026-11-09)(CARGO_INCREMENTAL=0, debug info 0); DXC/DXIL1.9.2609.5onPATH.Tested
cargo build --workspaceandcargo test --workspace --no-runboth exited 0 outside the GPU lock.cargo test -p xcl --lib batch_fits_caps_items_bytes_and_device: 1 passed, 0 failed, 0 ignored (969 filtered out; covers count/byte caps, oversized first upload, overflow, and device change).cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output(underInvoke-ArcTest.ps1, exited 101): 968 passed, 26 failed, 45 ignored across 20 test binaries, with 26SKIPPEDlines across 16 distinct tests (excluded from coverage).xcl --libDXIL/recompiler GPU tests (21CreateComputePipelineState0x80070057including FP64/fuzz/round/groupshared tests + 4 shader output assertions) and 1 ine2e(test_title_runs_and_game_folder_is_untouched, dynamic depth biasRSSetDepthBiasX#94 top-right blue vs expected green). None touch the texture upload batch path.0x887A002D), tiled tier < 2, missing D3D12 debug layer, and unavailable heap windows.Not tested
scripts/smoke.ps1), matchedmainbaseline,XCL_SAMPLE_*data (unset), AMD/NVIDIA GPUs, native wave64, and hardware FP64.AI use
gpt-6.2-sol,reasoningEffort: high) ran the build and tests and drafted the report. Coordinator #2 (T3 Code / Antigravity,gemini-4-neon) verified counts againstpr1986-suite.log, published, and compacted this comment in place.@DavidM1911 on GitHub · 2026-11-25 03:31 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!