Repository navigation
Tests: time DXC on generated RDNA2 programs and write JSON / CSV (#1269) - #2100
Draft
BetterJdue wants to merge 3 commits into
Draft
BetterJdue wants to merge 3 commits into
BetterJdue wants to merge 3 commits into
Conversation
…#1269) The synthetic compile-time benchmark of xcl-dev#1269 needs console programs that anyone can build, CI included, without game data. This adds the generator it will measure: deterministic RDNA2 programs, assembled with rdna2::encode, from a seed and knobs for the number of operations, divergent ifs (v_cmp, s_and_saveexec, s_cbranch_execz) and how deep they nest, uniform loops (SGPR counter, backward s_cbranch_scc1) and how deep they nest, wave32 or wave64, the VGPR and SGPR pools, and the share of LDS and memory accesses. Knobs that would give more operations than asked for (fewer than two per loop level) are refused. Nothing is timed yet; that comes next, with DXC. The tests count what each knob does in the disassembly of the program, not in the generator: the operations, how deep the ifs and loops nest, that every s_cbranch_execz lands on its EXEC restore and every loop branch on the instruction after its counter is set, the EXEC instructions of each wave size, the LDS and memory shares, the highest VGPR. Every knob combination the tests use translates completely, structured and as the guarded block chain, with as many instructions as the disassembly. Negative control: ten mutations of the generator (seed ignored, loops not nested, loop and execz branch offsets off by one, wave32 using the 64-bit EXEC instructions, if depth ignored, VGPR pool one too large, LDS share ignored, operations miscounted, the operation-count check removed) each make at least one test fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Large synthetic loop bodies can exceed the signed SOPP displacement. The narrowing cast silently wraps the back edge and produces a different program. Check the displacement before encoding it; cover rejection and a large representable loop.
…-dev#1269) The compile-time benchmark of xcl-dev#1269 measures what DXC does with the recompiler's HLSL without game data. Each generated program is translated and compiled with DXC one at a time; its instructions, blocks, code, HLSL and DXIL bytes, translation time and DXC times go into compile_bench.json (with the commit, whether the tree was dirty, the DXC toolchain, the build profile and the CPU) and compile_bench.csv. Every test run compiles a small set of six programs, so CI goes through the same code; XCL_COMPILE_BENCH=full runs five shapes at four sizes up to 20 000 operations, each in the native form and in the split wave64 / 4-window form, plus controls whose effect is known (the guarded block chain, 1 against 4 memory windows). XCL_COMPILE_BENCH_OUT, _REPS and _DXC_ARGS set the output folder, the compiles per program and extra DXC arguments; without the latter dxc.rs picks the optimisation level from the source size, as it does for a title. Without DXC the test calls skip_test("no DXC"). A program that does not translate completely, that DXC refuses, or whose HLSL or DXIL differs between repeats fails the test; the times are recorded, not judged. The generator gets buffer (V#) and image (T#, S#) access knobs and a compute mode (64 threads, 4 user SGPRs). At zero they draw nothing, so the programs of the first version stay byte for byte the same, which a test checks against hashes computed with the generator of 5ae62c5. Negative control: six mutations (buffer or image share ignored, compute ignored, the draws changed, the CSV time separator, the knobs not flattened into the row) each make at least one test fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
BetterJdue
marked this pull request as ready for review
November 25, 2026 08:17
BetterJdue
marked this pull request as draft
November 25, 2026 08:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1763; only the top commit (
cc131b2) belongs here.Times the HLSL → DXIL compile of the programs #1763 generates, so the compile-time work in #1269 gets numbers that need no game data and can run in CI. Shader and pipeline compile time is the biggest obstacle to getting past world loading (#1833). Test-only: nothing in
crates/xcl/src.Part of #1269
What is in it
crates/xcl/tests/compile_bench/measure.rs: each program is translated (recomp::translate) and compiled withdxc::compile, one at a time; it records the HLSL and DXIL sizes and the DXC times (a repeat must give the same HLSL and DXIL size). A small set of 6 programs runs in every test run;XCL_COMPILE_BENCH=fullruns 44: five shapes at 500 to 20 000 operations, the four wave64 ones also in the split form (a GPU with only 32-lane waves) with 4 memory windows, and two controls.XCL_COMPILE_BENCH_OUTwrites JSON and CSV with the commit, DXC version, build profile and CPU.crates/xcl/tests/compile_bench/gen.rs: buffer, image and compute knobs. At zero they give Tests: generate RDNA2 programs for compile-time measurements (#1269) #1763's programs unchanged (a golden-hash test).crates/xcl/tests/compile_bench/main.rs: tests of the new knobs, of the JSON / CSV and the DXC run (SKIPPEDwithout DXC).Tested
cargo test --workspace --no-fail-fast -- --test-threads=4oncc131b2(debug): 761 passed, 3 failed, 41 ignored. The failures are not from this PR:placed_title_textures_share_vram_and_preserve_pixels,transitions_apply_when_their_list_is_submitted,d32s8_targets_take_their_own_size_of_video_memory; the first ("3D 64x64x64 4 mips: subresource 2 mismatch") also fails alone onmainb9b6ea6, and the other two fail on the lock it poisons (PoisonError). D3D12.X: map and unmap 3D texture mips separately #1028 is about the same failure. SKIPPED: none.cargo test -p xcl --test compile_bench: 13 passed, 0 failed.ae43075(this commit before its rebase onto0f257d1, plus one that adds scripts and a README section), 44 programs;0f257d1only refuses loops out of the branch range, so the programs are the same (the golden-hash test passes on both). Their medians add up to 693 s; the 5 slowest programs take 70 % of it. The split form (a 32-lane GPU) against the native one, DXC median:Sources over 1 MiB get
-O1and over 8 MiB-O0fromdxc.rs, so the 20 000-operation divergent programs are compiled at-O0.Not tested
scripts/smoke.ps1: none used; the change is test-only.AI use