Direct DXIL: size a compute program's LDS block from its LDS_SIZE #2148
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2158"
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?
Imported from ivall/xcl. Originally posted by grahamster2 on 2026-11-25T06:32:44Z.
Stacked on #2146; only the last commit (
55d06c1) belongs here, please review that one.The direct DXIL backend (
XCL_DIRECT_DXIL) declares itsxcl_ldswith 8192 words for every program, as the HLSL kernel did before #2146. This sizes it by the same rule: a compute program'sCOMPUTE_PGM_RSRC2.LDS_SIZEplus the same reserved top words, rounded up to a power of two. The exchange words,XCL_WTand the address mask inlds_indexmove to the new block's top. LDS_SIZE 0 and the other stages keep 8192 words.Part of #675.
What is in it
Lw::lds_words, set insetup_storagefrom the entry'slds_bytes(gpu/dxil/lanes.rs,kernel.rs,lower.rs), and used by the mask inlds_index(lower_mem.rs).gpu_compute_lds_ring_in_a_block_of_the_programs_sizealso runs the direct translation. It covers the kernelsdirect_orruns (wave32, and wave64 in the split form) and checks that@xcl_ldshas the HLSL block's size. With the old 8192-word block, the test fails.bench_compute_lds_block(ignored, next tobench_split_wave64): the 32 KB block against the LDS_SIZE block, in a loop with an LDS store and load and an exchange per iteration.Tested
cargo test --workspace -- --test-threads=4at55d06c1: 1156 passed, 0 failed, 47 ignored. The SKIPPED tests are the same as in #2146 (no wave64).XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- --test-threads=4: 1099 passed, 1 failed, 27 ignored. The failure,gpu_image_get_resinfo_1d_array, also fails withXCL_DIRECT_DXIL=1at52577f9, so it is not from this change.bench_compute_lds_block, 2^18 threads x 8192 iterations, 64-thread groups, 32 KB block -> LDS_SIZE block:256-thread groups: 1.0x to 1.27x.
Regression run
Both runs with
XCL_DIRECT_DXIL=1(the path this changes).main (
cbc296a):this PR (
55d06c1):Not tested
AI use
direct_orruns, and to matching@xcl_ldsexactly.Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T07:01:24Z.
Tested
PR #2158, stacked on #2146, was open at
55d06c1e02831b09a931d383b7f6ea4bb6793b9ebefore and after testing. The assigned checkout was clean and detached at that SHA. The initial GitHub API response and final public PR page agreed with the live Git pull ref. The PR describes same-head RTX 3080 coverage. The discussion contained no equivalent Arc A770 coverage.STOR-WINLAB ran Windows 11 Enterprise Evaluation 26200.9974 on a Ryzen 7 3800X with an Intel Arc A770, driver
32.0.101.9175. Rust and Cargo were1.100.0onx86_64-pc-windows-msvc(rustc0ef1bc386). Both runs loaded DXC and DXIL1.9.2609.5from%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64.Cargo used the unoptimized test profile with
CARGO_BUILD_JOBS=2,CARGO_INCREMENTAL=0,CARGO_PROFILE_DEV_DEBUG=0,CARGO_PROFILE_TEST_DEBUG=0and the exclusive targetL:/XclTooling/pr1947-1831ec4-t3-97236edf/target.TEMPandTMPboth usedL:/XclTooling/pr2158/temp. The build finished outside the Arc mutex in 59.47 s. The invocation used-NoProfile -ExecutionPolicy RemoteSignedfor that PowerShell process.XCL_DIRECT_DXIL10The fixture explicitly compiles HLSL through DXC and translates direct DXIL under both environment settings. The two invocations therefore repeat the same assertions. The existing STOR-WINLAB A770 capability log records a D3D12 wave-lane range of 8 to 32, so the fixture exercised wave32 and split wave64 for 64×1×1, 256×1×1 and 8×8×1 thread groups. For each of the six configurations, the fixture checked the direct DXIL
@xcl_ldsdeclaration against the HLSL block size and compared each backend’s per-thread ring and first-lane exchange result to the expected integer arithmetic. This exercises the fixture’s one-word exchange slot.The executable SHA-256 was
896E8C588C18A5363FF54AD4B25C76842C9B260409AA28D89C9772E0825B74D9before waiting for the Arc mutex, after acquiring it and after both runs. The Arc mutex and target were released after testing.Combined: 2 passed, 0 failed, 0 ignored, 0 skipped.
Not tested
Native wave64, other adapters, other exchange layouts, negative cases, runtime backend selection, broader test suites, benchmarks, retail titles and smoke/regression runs.
AI use
T3 Code / Codex (
gpt-6.2-sol) ran the checked-in fixture, verified its assertion coverage and prepared this report.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T07:20:25Z.
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!
Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-25T07:33:50Z.
Tested:
gpu_compute_lds_ring_in_a_block_of_the_programs_sizepasses on AMD with native 64-lane waves (the case the PR lists as untested), and on an RTX 3060.gpu::filter: 586 passed, 2 failed, 23 ignored. The 2 failures are the AMD fuzz seeds 722 and 1599 tracked in #2115, which fail the same way onmain.Head
55d06c1applied onmain568e7db, debug,cargo test -p xcl --lib -- gpu:: --test-threads=4withXCL_ADAPTERset to each card. The HLSL half (#2146) passed the same way on this card earlier.Not tested: occupancy or speed on AMD (correctness only), a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-25T21:14:57Z.
Independent AMD RDNA4 (native wave64) test report on exact head
55d06c1e02831b09a931d383b7f6ea4bb6793b9e(clean detached checkout, no local changes).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1154 passed, 2 failed, 47 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpurefused by per-lane form;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.gpu::recomp::tests::compute_lds_block_takes_the_programs_lds_size.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1seed 722 andfuzz_validate_and_gpu_3seed 1599) are pre-existing on unmodifiedmainon this GPU.Regression run (60 s retail-title smoke,
XCL_NETWORK=0, release)(Matched
main68a284abaseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T09:04:06Z.
Independent desktop NVIDIA verification of PR #2158 at head
55d06c1e02831b09a931d383b7f6ea4bb6793b9e(2commits stacked on PR #2146:52577f993895afe1cc3e492a063b6f73821ee57c->55d06c1e02831b09a931d383b7f6ea4bb6793b9e; exact parent & merge-base:cbc296ab65a2661a61e3e2da109134bcd5319f60, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
55d06c1e)cargo test --release -p xcl --lib compute_lds_block_takes_the_programs_lds_size -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1126 filtered out× 3 (0.00s× 3,0skipped)cargo test --release -p xcl --lib gpu_compute_lds_ring_in_a_block_of_the_programs_size -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1126 filtered out× 3 (0.60s,0.53s,0.54s,0skipped; live RTX 4060 execution across HLSL and direct-DXIL backends)cargo test --release -p xcl --lib gpu::dxil:: -- --test-threads=4(3 consecutive runs)122 passed; 0 failed; 3 ignored; 1002 filtered out× 3 (4.08s,4.19s,4.35s,0skipped)cargo build --release -p xcl1m 28s, exit0,0new warnings)Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
cbc296ab65a2661a61e3e2da109134bcd5319f60, cached baseline on the same machine):PR #2158 (
55d06c1e02831b09a931d383b7f6ea4bb6793b9e):Limits of coverage
xcl_ldsblocks fromCOMPUTE_PGM_RSRC2.LDS_SIZEplus top-reserved runtime words (matching stacked HLSL PR #2146) was directly verified on desktop RTX 4060 viacompute_lds_block_takes_the_programs_lds_size(3/3),gpu_compute_lds_ring_in_a_block_of_the_programs_size(3/3, live GPU execution), andgpu::dxil::(122/122× 3).bench_compute_lds_blockmicrobenchmark was not run; the 60 s retail smoke confirms zero runtime regression ontitle: 29640639(single-run frame/commit delta vs. cached parent reflects normal startup variance, not this PR).AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by voiceovarian1-max on 2026-11-27T11:14:18Z.
A retail measurement of the same idea, not of this PR's head: our tree sizes the LDS block from LDS_SIZE the same way (direct DXIL and HLSL; our commit), and we compared it with the 32 KB block inside one run of a retail title's world.
Setup: RTX 4070 Ti 12 GB (32-lane waves only), NVIDIA 620.73.04, Linux + Proton Experimental (Wine 11.0) + vkd3d-proton 3.1,
XCL_DIRECT_DXIL=1, the GPU profile on (it serialises the queues). Each of 13 hot compute programs ran its fitted pipeline on odd frames and the 32 KB one on even frames; 5 of them have an LDS size that changes.Result (30 windows of 2 s)
Written with Claude Code (Claude Opus 5.5) from our run records.
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T14:42:12Z.
Two contributors checked independently and found that #2937 solves the same problem in a different way: #1607, group D149. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T03:30:51Z.
merge-check claim
head:
55d06c1e02Imported from ivall/xcl. Originally posted by throny on 2026-11-28T03:57:15Z.
merge-check
base:
e429936chead:
55d06c1e02merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> does not compile: 15 errors E0063 "missing field lds_bytes in initializer of CsInterface" in test code main has gained since this PR's base (the first at gpu/dxil/robustness_tests.rs:106). No test ran.
review: blocking: the PR adds the field CsInterface::lds_bytes and does not update the full struct literals in tests that main has since (the library builds, the tests do not). Otherwise, by reading: a size of 0 keeps the old block, the maximum is capped at it, the exchange base cannot underflow, and the split and safe-barrier forms clamp accesses. Not blocking: in the plain wave32 form without the safe barrier an access just past the declared size is masked, not clamped, so it now lands on other words of the smaller block, where the console would read 0 and drop the write (before, it hit spare space). Not verified: the 512-byte granularity of the declared size. The diff contains #2146, which this PR is stacked on. For the maintainer: #2937 (open) solves the same problem as an opt-in switch.
performance: default for every compute program that declares LDS, not opt-in: a smaller shared block, no added ALU work found. It changes translator sources: every tester re-translates all shaders once.
verdict: not yet: rebase and update the test literals (or give them a default); I will rerun on the new head.
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T15:16:58Z.
merge-check claim
head:
55d06c1e02Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-29T19:39:29Z.
merge-check
base:
0fe06eb0f0head:
55d06c1e02merge: conflicts: crates/xcl/src/gpu/dxil/kernel.rs, crates/xcl/src/gpu/recomp/tests.rs
build: not run (conflicts)
tests: not run (conflicts)
review: not run (conflicts). Note for the rebase: on the earlier main
309c3ec5the merge was clean but its test binaries failed with error[E0063] missing fieldlds_bytesin theCsInterfaceinitializers main added since this PR's base (d9403543,86a90eeb: robustness_tests.rs:106/146/160, recomp/pso.rs:1183, recomp/tests.rs:7110/7118/7125 and more); each needslds_bytes: 0or..Default::default().performance: not assessed (conflicts)
verdict: not yet: conflicts with
0fe06eb0hardware / tool and model: Windows 11 build 26300.9974, NVIDIA GeForce RTX 2070 SUPER 8 GB (driver 621.40, wave32 only), AMD Ryzen 5 3600XT; rustc 1.100.1 (20ddd0171 2026-11-25) x86_64-pc-windows-msvc. Claude Code: Claude Opus 5.5 (coordination, draft).
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:17:55Z.
Review (head
55d06c1e, diff read, not a merge-check; it conflicts with main, so not built or run):setup_storage(8189-8190) and main'slds_indexclamp (ada50ec5), sizes the block exactly instead of rounding to a power of two, and has an off switch (XCL_DECLARED_LDS=0) and aComputePolicyKeyfield.lanes.rs,kernel.rs,lower_mem.rsandtests.rs, has no barrier-word handling, is stacked on #2146, and addsCsInterface::lds_byteswhere #3478 addslds_dwordsfor the same data.Fine: the direct layout was right for its base, and
bench_compute_lds_blockplus the assertion that the direct block matches the HLSL one are worth carrying into #3478 or a follow-up. Recommendation: close in favour of #3478.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.