Repository navigation
Conversation
`structurable` works on the layout: every backward jump is a loop to it. Code the console
compiler placed after the blocks it jumps back into, entered from before them, and loops
with several heads or exits made 3 325 of the retail pack's 26 698 programs fall back to
the `pc` dispatcher, about two thirds of their DXC time (every value of the dispatcher loop
is loop-carried; jump threading and the loop passes work on it).
`structure.rs` builds structured code for any reducible program from its dominator tree
(N. Ramsey, "Beyond Relooper"): a loop head becomes `for (;;)`, a merge is reached by
leaving a `do { } while (false)`, other blocks go inline, a loop's dominated exits go after
it, and a jump out of several constructs passes through `xcl_br`. It is used only where
`structurable` fails, after a dry run (a program it rejects is emitted as before), so
every other program's HLSL is unchanged. Left on the pc chain: 21 irreducible programs
and ES + GS pairs.
Checks: every structured program can be walked against its control flow graph with the
same random branch decisions (`XCL_RECOMP_CHECK=1`, the retail survey and the new tests do);
GPU tests compare the general form with the pc chain; `XCL_RECOMP_GENERAL=1` forces the
general form for every program (the GPU suite passes with it).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
AMD run (no retail data, so not XDefiant / the retail game): RDNA3 Radeon RX 7800 XT (16 GB, native 64-lane waves,
|
|
Tested ca66c4a (main 956a476 + this PR) on an RTX 3090 (driver 616.92, 32-lane waves), Windows 11 26300, Ryzen 9 5950X. AI-assisted test report (Claude); tests run locally as stated; the diff was read in full before running. |
|
With default settings this PR changes no existing program's HLSL. Every program main's synthetic recompiler tests translate (160 distinct bytecode/options pairs) gave byte-identical HLSL on
The PR's GPU differential passes for wave32 and split wave64 over six inputs per program. A small note: Tested
Not tested
🤖 GPT-6.2 Astra, Claude Opus 5.5 |
|
Retail NVIDIA driver numbers for this PR. Kalmarv showed that with default settings this PR leaves the HLSL of main's synthetic test programs byte-for-byte the same, and listed retail packs and driver time as not tested. On a retail compute program, the default path ( Setup: RTX 5070 Ti (16 GB), driver 616.92, Windows 11 26300, DXC from SDK 10.0.26100. The records come from the retail
The larger compute programs:
The run with this PR was stopped after its first two programs; I will add the other two. On main, the 5.3 MB Not tested: whether the retail programs' output matches on the GPU (this is compile time only), AMD, DXC 1.9. Each time is a single run. AI-assisted: Claude Code (Claude Opus 5.5) ran the measurements and wrote this comment. No game files attached. |
|
Tested Pass: 653 passed, 0 failed, 40 ignored. GPU skips: the same 2 as on Run and written with Claude Code (Claude Opus 5.5). |
Lane L6 of the compile-time handoff (emitter and DXC cost).
Update 19:35 UTC: measured again with
retail_translation_survey, the DXC gain is 6–8 %, and there is none on top of #174 (second table below).What was slow
3 325 of the retail pack's 26 698 programs fall back to the
while (pc …)dispatcher. On a 1-in-100 sample (4 memory windows) they are 13 % of the programs and about two thirds of DXC's time.-ftime-reporton the slowest one shows jump threading at 27 % and the loop passes (LCSSA, indvars, unroll, loop deletion) most of the rest: every value of the dispatcher loop is loop-carried.structurableworks on the layout: every backward jump is a loop to it. The common failing shape is not a loop at all: the console compiler puts blocks after the code they jump back into and enters them from before it (acyclic, the jumps only go backwards in memory). Loops with several heads or exits are the rest.What changed
gpu/recomp/structure.rsstructures any reducible program from its dominator tree (N. Ramsey, "Beyond Relooper", ICFP 2022):for (;;)(withLOOP_GUARD);do { … } while (false);xcl_br, and each construct passes it on.It runs only where
structurablefails, after a dry run: a program it rejects is emitted exactly as before. Unreachable blocks still go through the emitter (their text is dropped), so the registers, samplers and unsupported counts are those of the other forms. Left on the pc chain: 21 irreducible programs and the ES + GS pairs (58 programs in all, was 3 325).Measured (RTX 5070 Ti machine, 16 threads, DXC 1.9.2602.17, dxc.exe, 8 compiles at once, nothing else running)
DXC CPU time, 1-in-100 sample (253 programs, every 100th by name hash), translated with 4 windows. DXC got
-O1above 1 MB of HLSL, asdxc::compiledoes since 956a476. Runs interleaved:--precompile --limit 2650, cold cache, split wave64 form: main 276.1 s, this PR 284.2 s, 0 errors each. One run per side, so no spread. That slice holds only 5 of the 3 267 changed programs (11 s of their 21 326 s of DXC CPU), so it cannot show the change. An end-to-end run over a slice that holds them is not done yet.Measured again with
retail_translation_survey, alone and with #174 (19:05–19:32 UTC)Same machine, release build, the test's own DXC (4 threads):
XCL_SURVEY_EVERY=100,XCL_SURVEY_DXC=1,XCL_SURVEY_WINDOWS=4, two seeds. #174 was merged locally (it conflicts only at the end oftests.rs) and run with its linking off (XCL_LINK_MEM=0) and on. Runs interleaved; total DXC time the test prints:So if #174 is merged, what this PR still gives is fewer programs on the dispatcher loop. Whether that helps the driver's compile time or the GPU's run time is not measured.
Output and correctness
main. The 3 267 that differ were all on the pc chain.XCL_RECOMP_CHECK=1turns it on elsewhere.gpu_general_structure_matches_the_pc_chainruns synthetic programs with the retail shapes (bottom entries, a jump out of two loops, a two-entry loop, a plain loop) as wave32 and wave64 (split on this GPU). It compares SGPRs and VGPRs with the pc chain for 6 inputs each.XCL_SAMPLE_RPFand withXCL_SPLIT_WAVE64=1: 571 passed, 0 failed, 39 ignored each.XCL_RECOMP_GENERAL=1(the general form for every program with branches) the GPU suite passes. Only the three tests that look for the first form's text fail.Not tested
amdxc64.Also measured, not in this PR
v_cmpx); dropped.-opt-disable gvnis slower; licm / sink: no change.Gate A passed at 2026-11-23 17:59 UTC on main db5dc26; Gate B passed at 18:46 UTC on main 956a476. PRs read: #113, #134, #138, #139, #155, #162, #166 and the bmjask/playability branch: none structures control flow. Written with an AI assistant (Claude); measured on the owner's machine. No game material in this PR: the tests use synthetic programs.
🤖 Generated with Claude Code