Repository navigation
Conversation
|
Independent Windows GPU check of commit Tested
Not tested Retail output, cold compile timing, Intel, or Linux. The combined check forced the packing and grouping through AI use OpenAI Codex (GPT-6 family, exact variant unavailable) adapted and ran the temporary tests, verified the logs, and wrote this report. |
|
@nnonno91 thanks. Your report covers one of the PR's Not tested points: the nested form with a packed table. You ran it on the GPU and it matched the flat dense form on AMD and NVIDIA, in wave32 and in native wave64 on AMD. That's a check the 4090 here can't make (no wave64). The other points are still open: retail programs on the GPU, AMD timing, and the merge order with #1548. AI use: Claude Code (Claude Opus 5.5) wrote this reply. |
|
Tested ActivateRays (
Not tested: This comment was AI-assisted. |
|
@brothernog thanks, that's the first run of #1692 on a retail program on a small card. In the heap form, the driver went from 312 s to 31.8 s and its peak from 3,962 to 850 MB, and both pipelines were accepted. That is about 10× here against 4.4× on the 4090, so the small cards gain the most. On the 4090, the grid in #1269 (7142472413) puts the driver's time at about merge operands^0.8 × blocks. Yours looks steeper than that on this card. I'll use your table as the 8 GB data point when PR 2 (on by default above a case count) is measured. Note: #1692 is now in conflict with AI use: Claude Code (Claude Opus 5.5) wrote this reply. |
|
Rebased onto #1448's new head
The description has the new counts and both blocks. AI use: Claude Code (Claude Opus 5.5) rebased and wrote this comment. A Claude Sonnet 5.5 subagent ran the suite and the smoke runs. |
|
@Pipodi a clarification for the compatibility note in the description: #1548 at AI use Codex (gpt-6.2-sol) checked the source and merge tree and drafted this note. |
|
@t4l03 thank you, you're right. #1548's own commits on top of #1448 ( AI use: Claude Code (Claude Opus 5.5) checked the merge tree and #1548's commits, and wrote this comment. |
…nslate No behaviour change: the decoding, block leaders and emitter set-up at the start of translate() move into prepare(), so a second form of the program (the compact form) is built from exactly the same decoded program and emitter state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DXC inlines every helper of a cs_6_x target, so a retail compute shader with thousands of equal blocks (ActivateProbes 56c0cd3b82a00c6e: 88,863 instructions, 3,281 buffer_load_format_x) becomes 29.75 MB of DXIL that the driver needs minutes for. translate_compact() cuts the program into blocks (leaders, plus every instruction whose HLSL exceeds 600 B on its own), emits each instruction with emit::Em as translate() does, temporaries numbered from t1 per instruction, and shares equal block texts as cases of one dispatch loop. Branches go to a block at an offset from their own (part of the text), so a static table only holds every block's case, packed. The table is capped at 8,192 words: on an RTX 5070 Ti, CreateComputePipelineState of this program's compact form with an added 12,288-word static array succeeded; with 15,360 words it failed with E_OUTOFMEMORY. Back edges spend the loop budget (65,536 per lane); once it is spent the program ends, where the structured form leaves the loop and runs what follows. compact_wanted() picks programs of 20,000+ instructions whose distinct blocks hold under 30 % of them. Not called yet. Measured on 56c0cd3b82a00c6e (4 memory windows, split wave64, RTX 5070 Ti, a local merge, 31be310): 723,453 B HLSL, DXIL 1,053,264 B in 12.5 s, CreateComputePipelineState 9.7 s from a new exe with no cached blob. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tests_compact translates each program with translate and with compact::translate_compact and runs both on the same inputs. The kernel programs assert byte-identical SGPRs, SCC, VGPRs of all lanes, exports and the split form's upper-half SGPRs, plus flat memory or the first 64 KiB of each memory window; the compute dispatch compares memory. Programs: nested execz regions, divergent and scalar backward loops, one block repeated at five addresses, far jumps (s_getpc_b64, add or sub, s_setpc_b64) forward and backward, v_mul_lo_u32, buffer_load_format_x in twelve formats and repeated as a block of its own, a cross-lane block (ballot, readfirstlane, readlane) repeated under four exec masks, s_endpgm before the last block, a loop through four memory windows with loads, stores and per-lane atomics, a compute dispatch, and 200 forward jumps that xcl-dev#1307's bound sends to pc blocks in translate (gpu_compact_against_the_pc_block_fallback). The kernel programs run in each form forms() lists for the adapter (wave64 split or native, wave32; with branches also unstructured), and in the wave64 forms with mem_windows: 4; the compute dispatch runs in wave64 (split where the adapter needs it) and wave32. Every program here except one has a branch, and the tests assert that translate_compact gives it the compact form: they read its dispatch loop back from the HLSL. translate_compact keeps translate's form for a program without branches, so the two straight-line programs start with a branch to the next instruction. For the repeated blocks, the exchange block, the buffer loads, the window loop, the far jumps and s_endpgm they also assert the shape: fewer cases than blocks, one case for the four copies of the exchange block and one for the block after the load, the load a case of its own, the far jumps' block offsets, two program ends before the last block. The exception is the memory-window program of gpu_memory_windows_above_4_gib (no branch): it gets translate's form from both, so its test compares translate with itself; the window loop runs the compact form through the windows. The atomics in the memory-window programs add to a dword per lane. On an RTX 5070 Ti (split wave64, 4 windows), with all 64 lanes adding to one dword, 40 runs of the same DXIL returned two different lane 0 values (5 and 35 runs): the split halves' atomics land in either order. gpu_compact_sample_big_cs (XCL_SAMPLE_BIG_CS=<code file>) runs a retail program both ways. A program translate_compact refuses (e.g. its table limit) is SKIPPED; when the driver cannot create translate's pipeline (e.g. E_OUTOFMEMORY), the A/B comparison is SKIPPED and the compact form must still compile and run. Needs the compact backend (compact.rs and `pub mod compact`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…PACT_CS) The switch XCL_COMPACT_CS: unset / auto = the programs compact_wanted picks, 0 = none, 1 = every compute program; another value logs a warning and acts as auto. `translate_routed` gives a compute program to translate_compact where the switch says so and uses `translate` when that returns an error or an incomplete translation. The PSO path (console_translation, both FSPX and FSSM), `xcl shaders` statistics and precompile, and the shader dump's recompile use it. The on-disk translation cache names an entry of a program routed to the compact backend `..._c.bin`, so a compact and a normal translation of one program never share a file; the file name of a normal entry is unchanged. compact.rs is added to the translator sources that identify compatible cache entries (this commit changes that identity, so existing entries are translated again once). One INFO line per compute program routed to the compact backend, the first time: instructions and HLSL bytes, or why it fell back. When dxc::compile_cached fails on a compute program's compact-form HLSL, the program is compiled in the normal form (or taken from the normal form's translation-cache entry when that is on disk), and the result is kept under the normal entry, never the `_c` one; one WARN line is logged before that. A cached-only attempt is not retried: its DXIL is not refused, only not made yet. A refusal is not remembered between runs. A driver (CreateComputePipelineState) rejection of a compact pipeline is not retried in the normal form. With XCL_DIRECT_DXIL (xcl-dev#1426) on, a compute program XCL_COMPACT_CS routes to the compact form goes to the HLSL path's compact form first, not to the direct translator; if DXC refuses that HLSL, the retry in the normal form goes to the direct translator first, then to translate. Every other compute program goes to the direct translator as before, and to the HLSL path when that falls back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Test report for #1692 with
Setup
The two programs, nested, in the title
The title: 5 runs
Not tested
AI use
|
|
Test report for #1692 Tested
The rest of the run
Not tested: other AI use: Claude Code (Claude Opus 5.5) built the trees and vkd3d-proton, ran the offline conversion, read the logs and wrote this report. |
|
Verification on RTX 3060 Ti (Windows 11): merge conflict with current |
The compact form keyed a block's case on its text with the branch offset in it, so blocks with the same code but different targets were separate cases. ActivateRays (95cc13288a27a96e) has 19,949 blocks and got 11,909 cases. Its table was over MAX_TABLE_WORDS, so the program fell back to the normal form. A case is now keyed on the block's code and branch condition, and the target is data. A case whose blocks all jump by one offset keeps `xcl_b +/- K`. Otherwise it takes the offset most of its blocks jump by and sets each other block's target with `xcl_t = select(xcl_b == k, target, xcl_t)`. ActivateRays has 2,516 cases. At 12 bits, the usual packing (two cases to a word) still needs 9,975 words, so a table over MAX_TABLE_WORDS is now packed across words: bits from bit `xcl_b * bits`, two reads, one word of padding. ActivateRays fits in 7,482 words. A case evaluates at most MAX_SELECTS (32) of those selects. Past that, the list is split by `[branch] if (xcl_b < pivot)` until each leaf has at most 32. `xcl_b` is wave-uniform, so the branch is too. Without the bound, a case that 1,799 blocks share runs 1,799 selects on every visit: on milesah3ad's probe (a8eebfd, 3,600 rounds, targets that differ per copy) a dispatch took 13.5 ms against 9.8 ms on the parent, and 10.4 ms with the bound. DXC keeps the branches (92 conditional branches in the DXIL against 36). Cases with 32 or fewer differing targets emit the same text as before. Which programs take the compact form does change: ActivateRays had 11,909 cases and a 9,975-word table, so it fell back to the normal form, and it now takes the compact form through the across-word table. ActivateProbes and ActivateProbesTarget were compact before and keep the usual packing. Measured on an RTX 4090 (driver 617.42), release, a fresh DXIL cache and a new exe path per run (so the driver's cache missed): - ActivateRays: DXC 20-24 s, 2.89 MB DXIL. The driver made it in 175, 190, 215 and 233 s (peak private 8.1 GB). The same build without the bound: 2.85 MB, 162, 162, 164 and 201 s, interleaved with those runs. K = 64 took 200-216 s, no better. - ActivateProbes: 751 cases (906 before), 0.94 MB DXIL, driver 12.6 s. - ActivateProbesTarget: 698 cases (851 before), 0.85 MB DXIL, driver 9.9 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013qV4hiM5Sx9hBkPpgAarKX
The compact form's dispatch loop is one switch over every case, so the merge block after it has one predecessor per case and a phi operand per predecessor for each of the ~147 loop-carried registers. On one retail compute program (ActivateRays, RTX 4090) that is 436,656 merge operands, 2,848,780 B of DXIL, a cold driver build of about 165 s and a peak of 8.2 GB. XCL_COMPACT_NEST=<P> (a power of two; off when unset or 0) switches on `case >> log2(P)` first, and each group has its own inner switch and ends in `xcl_nb = min(xcl_nb, <blocks>u)`. The min is what stops DXC from folding the group merges back into one (without it the 147 x 2,910 operand merge returns). Measured with a throwaway build of the same emission, P = 32: merge operands 436,656 -> 93,531, DXIL 2,848,780 -> 1,037,876 B, cold driver build about 165 s -> 38 s, peak 8.2 -> 1.5 GB (issue xcl-dev#1269, comment 7141317244). Off by default: with the variable unset the HLSL is the flat form as before (the selector expression is only factored out). `compact_with` takes the group size so tests do not depend on the environment; an invalid value logs a warning and leaves the nest off. The translated-shader disk cache names a compact entry `_c`, and now `_c_n<P>` when the nest is on, so a warm flat entry is not loaded for a nested run or the other way round; names with the nest off are unchanged. P is limited to 2^16: a shift of 32 or more is masked to 0 by HLSL. Tests: the HLSL shape on a synthetic program (ceil(cases/P) inner switches, every case once, one min per group, the off text is flat); the parsing of the size and the cache file name; a GPU A/B against `translate` with the nest on (results are compared there, on synthetic programs); and, on XCL_SAMPLE_BIG_CS, DXC only: nested DXIL under 80 % of the flat compact form's. Measured 36 % (ActivateRays), 64 % and 64 % on two other programs; folded back it would be about 100 %. The samples' own dispatch does not finish in the runner's 10 s with zero inputs, so their results are not compared. The tests' reader of the compact HLSL (`Dispatch::of`) reads the nested form too, so the compact tests pass with XCL_COMPACT_NEST set and then check the nested form (in a run with it set to 32, a tester found 15 of them stopping at the flat switch line before). Stacked on xcl-dev#1448. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013qV4hiM5Sx9hBkPpgAarKX
|
New head
Whole suite on Turning the nest on by default is a separate step, claimed on #1269, after measurements on the ~700-case programs. AI use: Claude Code with Claude Opus 5.5. |
|
Back to draft: since AI use: Claude Code with Claude Opus 5.5. |
Stacked on #1448 (
57d7574, itself on #1316964f5ed); only the top commit (9c09c8f) belongs here.The compact form's dispatch loop is one
switchover every case. All cases fall through to one merge block, which has a predecessor per case and a phi operand per predecessor for each of the ~147 loop-carried registers. OnActivateRays(2,516 cases), that is 436,656 merge operands. The NVIDIA driver's time and memory follow them: about 165 s and 8.2 GB for one cold pipeline build (#1269 result).XCL_COMPACT_NEST=<P>(a power of two up to 65536; off when unset or 0) switches oncase >> log2(P)first. Each group of P cases has its own innerswitchand ends inxcl_nb = min(xcl_nb, <blocks>u). Theminstops DXC from folding the groups' exits back into one merge. Without it, the 147 × 2,910 merge comes back. This PR adds the switch, off by default. Turning it on above a case count is a separate PR, after measurements on more programs and GPUs. Part of #1269.What is in it
crates/xcl/src/gpu/recomp/compact.rs:compact_withtakes the group size, andcompact()reads it fromXCL_COMPACT_NESTonce.crates/xcl/src/gpu/recomp/pso.rs: the translated-shader disk cache names a nested compact entry_c_n<P>instead of_c, so a warm flat entry is never loaded for a nested run, or the other way round. Names with the nest off are unchanged.compact::tests::nested_dispatch_groups_the_cases: P = 2, 4, 8, 16, with ceil(cases/P) inner switches, every case once, oneminper group, and the flat text with P = 0.tests_compact::gpu_compact_nested_dispatch: the GPU A/B againsttranslatewith P = 2 and 4, on the synthetic programs (now with Recompiler: compact cases share code whose branch targets differ #1448'smany_targets, whose case has the[branch] iftree of selects), in every form the adapter runs.compact_sample_big_cs_nested_dxilon the existingXCL_SAMPLE_BIG_CShook: DXC only, nested DXIL under 80 % of the flat compact form's.Dispatch::of) reads the nested form too. WithXCL_COMPACT_NESTset for the whole run, the compact tests now check the nested form instead of stopping at the flat switch line (@einfachama found 15 of them doing that).Tested
rustc 1.100.0.9c09c8f(onmain266b845through Recompiler: route compute programs through a compact backend (XCL_COMPACT_CS) #1316964f5edand Recompiler: compact cases share code whose branch targets differ #144857d7574), debug:cargo build --workspace && cargo test --workspace -- --test-threads=4gave 990 passed, 0 failed, 42 ignored, in 20 result blocks.cargo test -p xcl --lib compact -- --test-threads=4withXCL_COMPACT_NESTunset,=32and=2: 33 passed, 0 failed, 0 ignored each (SKIPPEDgpu_compact_native_wave64_form: no wave64).gpu_compact_native_wave64_form,gpu_wave32_program_in_wave64_hardware,gpu_geometry_wave32_prefix_count_over_a_maskand 16lower/lower_dxilGPU cases (no wave64); 3lower_dxilper-lane f16/f32 cases (refused by the per-lane form, frommain);heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows);pso_measurement_compiles_an_exact_synthetic_record(cannot disable the driver cache: Windows Developer Mode is required).compact_withmade to ignore the group size,nested_dispatch_groups_the_casesandgpu_compact_nested_dispatchfail. The GPU test fails on its HLSL-shape assert; its results would be equal either way.xcl shaders <record> --precompile --only cs, a newXCL_DXIL_CACHEper run, on records of three compute programs from the retail title:XCL_COMPACT_NEST=32b370923)b370923. These DXIL numbers were measured at00f10ee, the same patch before the rebase onto Recompiler: compact cases share code whose branch targets differ #1448's select bound. The bound changes the text ofActivateRaysin both forms (Recompiler: compact cases share code whose branch targets differ #1448: 2.85 → 2.89 MB flat), so the table is not this head's; it was not rerun.compact_sample_big_cs_nested_dxilon two of these programs (the test's options differ from the precompiler's) gave 874,064 → 566,372 B (65 %) and 811,152 → 516,816 B (64 %). Both pass.ActivateRaysat P = 32 built cold in 37.7–38.2 s with a 1.5 GB peak, against 163–169 s and 8.2 GB flat, on this GPU (#1269 result). That was not rerun on this commit.Regression run
The retail title, 60 s,
XCL_PRESS_AT=16:A, a new emptyXCL_DXIL_CACHEper run,XCL_COMPACT_NESTunset (this PR's default). Themainblock is the one made tonight for #1448's regression run (same commit ofmain, title and settings).main689f2db:This PR, head
9c09c8f:The PR's run got 89.6 % of
main's frames and 60.3 % of its peak commit. Neither log has acompact backendline.Not tested
ActivateRaysin the heap form in 31.8 s against 312 s flat. On Linux / RADV (RX 9070 XT), @St5sz2Jk found the nested form slower in the driver: 244 s and a 45.5 GB peak, against 70 s for the flat form with @0naku's switch-tree patch. On an RTX 4060 8 GB, @einfachama builtActivateRaysnested in a title run in 24.9 s from cold. On AMD and RTX 5090, @nnonno91 ran the GPU tests, including the packed table.9c26337, stacked on Recompiler: compact cases share code whose branch targets differ #1448's old head42b2f11): it builds the dispatch from the decoded instructions, not from the HLSL (@t4l03's correction). Both PRs changecompact.rsandpso.rsand conflict there (git merge-treeof9c26337and7123faa), so whichever merges second has to reconcile the dispatch emission and the cache names. The two have not been run together.AI use
🤖 Generated with Claude Code
https://claude.ai/code/session_013qV4hiM5Sx9hBkPpgAarKX