Skip to content

Recompiler: the compact form's larger tables on a 64-lane GPU with heap windows - #2375

Open
Royalflamejlh wants to merge 3 commits into
xcl-dev:mainfrom
Royalflamejlh:shader/compact-tables-any-gpu
Open

Royalflamejlh wants to merge 3 commits into
xcl-dev:mainfrom
Royalflamejlh:shader/compact-tables-any-gpu

Conversation

@Royalflamejlh

@Royalflamejlh Royalflamejlh commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

On a GPU with 64-lane waves, the direct compact form now takes tables of up to 12,288 words, as on a GPU with 32-lane waves, only with heap memory windows (XCL_HEAP_WINDOWS=1); with the default switch windows such a GPU keeps 8,192 words, as on main. So record 95cc13288a27a96e takes the compact form on such a GPU only with heap windows, and the default path does not change. That matters because since #2120 a compute program with over 8 MB of HLSL takes the direct translator without XCL_DIRECT_DXIL, and this one does; the first commit alone (39ec915) changed the default path on such GPUs, and an earlier version of this description wrongly said the change acts only with XCL_DIRECT_DXIL=1. The second commit (9975836) is the guarded rollout asked for in review; the third (98b60d0) only moves a doc comment back to its function. Part of #2088.

What holds now, on one AMD card model, the RX 9070 XT, in 2 runs on each of two machines: with heap windows (XCL_HEAP_WINDOWS=1) this program's compact form builds, and its plain form, which the guard kept, did not within 48 GB. @bielfreedom's run of this branch on a 32 GB machine built it in 137.8 and 149.1 s at a 17.64 GB peak (2 of 2), where 68a284a's plain form passed 24 GB; @komglebissarov's run on a 64 GB machine, on main 0829441 before #2076 with the form forced, built it in 198 and 203 s at 33.9 GB, where the plain form passed 48 GB. With the default switch windows neither form builds within 24 GB (the compact form gets there sooner, 95 s against 226 s), so on the default path the guard bought nothing. The guard came from @bielfreedom's run on cbc296a, before #2174 nested the dispatch, where neither form built within 24 GB and the compact form reached it sooner (31 s against about 205 s).

What is in it

  • kernel.rs, compact.rs, pso.rs: direct_compute takes the larger tables where large_tables says so, on a GPU with 32-lane waves only or with heap windows (main asks only the first). The net change against main is that condition, its test and two doc lines.
  • pso.rs: a_gpu_with_64_lane_waves_takes_the_larger_tables_only_with_heap_windows. With large_tables returning split_wave64 alone it fails (pso.rs:1398); with the condition it passes, with the 13 compact tests (under Wine, at 98b60d0).
  • Upstream's development branches: it conflicts with nvidia-dev (c044dc6) and amd-dev (6a0bb5b) in kernel.rs and pso.rs. On a GPU with 32-lane waves it changes nothing, so there is no nvidia-dev version of it.

Tested

  • Merged onto main 8b957be (and earlier b49be18): no conflict; under Wine, CPU only, -p xcl --lib -- compact large_table: 15 passed on both.
  • At 9975836 (the same code as the head 98b60d0) against main e0d93c8, Linux through Wine, CPU only, XCL_DIRECT_DXIL=1 xcl shaders <folder> --precompile --only cs, the six largest compute programs, 1 translation each: with --split 0 (a GPU with 64-lane waves) and XCL_HEAP_WINDOWS=1, 95cc13288a27a96e goes from 2,175,252 B (plain) to 1,075,700 B (compact); in the other three combinations (--split 0 with switch windows, --split 1 with either) all six are main's bytes (SHA-256). Under Wine, -p xcl --lib -- large_table compact: 14 passed; the workspace suite with the same condition on main e0d93c8: 1,413 passed, 8 failed, 46 ignored, against main's 1,414 / 7 / 46, the eighth (split_compute_program_prebuilds_and_caches_chain_pieces) passed 3 of 3 alone. The bullets below were taken on the first commit, before the condition.
  • Linux through Wine, CPU only: Ryzen 9 9950X3D, 62 GB RAM, Fedora 44, Wine 11.21 Staging, DXC 1.9.2609.5 (its validator only), rustc 1.98.0, release, x86_64-pc-windows-gnu. The numbers below were taken with main 68a284a and the head 3205f86; the head is now 39ec915, the same commit rebased onto main e0d93c8 (its message corrected; no change to the code).
  • The six largest compute programs of the pack, XCL_DIRECT_DXIL=1 xcl shaders <folder> --precompile --only cs --split 0 (a GPU with 64-lane waves) from an empty cache, 1 translation each: 95cc13288a27a96e goes from 2,420,640 B (plain) to 1,218,224 B (compact, 13,890 blocks of 2,643 kinds); with XCL_HEAP_WINDOWS=1 from 2,177,324 B to 1,078,544 B. The other five are main's bytes in both window forms (SHA-256), and with --split 1 all six are. Again at 39ec915 against e0d93c8: 2,418,576 → 1,215,392 B with --split 0, the other five and all six with --split 1 main's bytes.
  • @bielfreedom, on Recompiler: the compact form's larger tables on a 64-lane GPU with heap windows #2375 at 3205f86 against its parent 68a284a: RX 9070 XT 16 GB (native wave64, driver 32.0.32029.2010), Ryzen 7 7700, 32 GB RAM, Windows 11, release, XCL_DIRECT_DXIL=1, nesting auto, one pipeline thread, XCL_PSO_DISK_CACHE=0 and a new exe name per run, this record alone, a watchdog at 24 GB of private bytes, each build with a local patch that logs DXIL size and driver time:
windows build form direct DXIL AMD driver peak private
switch 68a284a plain 2,420,640 B 24 GB after 226 s, stopped –
switch #2375 compact, nested 1,218,224 B 24 GB after 95 s, stopped –
heap 68a284a plain 2,177,324 B 24 GB after 218 s, stopped –
heap #2375 compact, nested 1,078,544 B built, 137.8 s and 149.1 s (2 runs) 17.64 GB

The DXIL sizes are the ones above byte for byte.

  • @luckyteagirl (Recompiler: the compact form's larger tables on a 64-lane GPU with heap windows #2375 (comment)) at the head 98b60d0: AMD Radeon RX 6800M (RDNA2, native wave64, driver 30.0.13002.13003), Windows 11, XCL_HEAP_WINDOWS=1: the 5 gpu_ compact tests and a_gpu_with_64_lane_waves_takes_the_larger_tables_only_with_heap_windows passed, none skipped. Not run there: 95cc13288a27a96e itself and a title run.
  • @SlopTart on Linux, RADV (Mesa 26.2.5) with an RX 7900 XT, vkd3d-proton 3.1, the branch merged into current main: the gpu_ tests 159 passed, 4 failed, the four failing on main there too by their report.
  • @DavidM1911 on an RTX 3060 Ti (Windows 11), the branch merged with current main: cargo test -p xcl --lib 1,039 passed, 0 failed on a single-threaded rerun; one test aborted in one parallel run (Test suite: parallel cargo test intermittently dies with 0xc0000005 (hle::d3d12x queue_tests × list_x race) #1978).
  • cargo test --workspace --release --target x86_64-pc-windows-gnu --no-fail-fast -- --test-threads=8 under Wine, no card: 1,281 passed, 8 failed, 46 ignored; main 68a284a: 1,283 passed, 7 failed, 46 ignored, 335 SKIPPED lines on both. The seven main has fail here too. The eighth, xapu_connect_returns_oom_and_cleans_up_on_failure (an audio test, "data buffer must be released when event creation fails"), passed in this pull request's own CI run and in 3 of 3 runs of its own here. One test fewer passes because the guard's test goes.
  • The same, -p xcl --lib -- compact --test-threads=4: 11 passed, 0 failed (the card tests skip there).
  • NVIDIA GeForce RTX 2070 SUPER 8 GB (driver 621.01, 32-lane waves, so wave64 programs run in the split form), Ryzen 7 5700X3D, 16 GB RAM, native Windows 11, rustc 1.100.0, debug: cargo test --workspace -- compact --test-threads=1 at 3205f86, 1 run: 11 passed, 0 failed, none skipped. The whole suite there, cargo test --workspace -- --test-threads=4: 1,288 passed and 1 failed at 3205f86, 1,289 passed and the same 1 failed on main 68a284a (a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier), 29 SKIPPED lines on both, the same tests; one test fewer because the guard's test goes. This card cannot show the path the change opens.
  • Build and test (Windows, no GPU) fails on a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, which fails the same way in main's own CI at 68a284a and 50a9fde.

Regression run

Native Windows 11, RTX 2070 SUPER 8 GB (driver 621.01), the retail title, 60 s, at 98b60d0 and main e0d93c8, the head first. On this GPU, which has only 32-lane waves, the change alters nothing, so the pair shows only that the branch builds and runs. That PC gives some runs at about 410 frames and 22 presents per 2 s whatever the tree (two of the first commit's earlier, one of main's at 13:47); none in this pair.

main:

xcl-smoke v1
commit: e0d93c84ad8253f6e17738d14741c1bab7061127
gpu: NVIDIA GeForce RTX 2070 SUPER
title: 5330474d
seconds: 60
exit: 0x0
frames shown: 783 (PresentX 783)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14665 MB

PR:

xcl-smoke v1
commit: 98b60d0876e5a29e60e4078d1ff4885eb1689d6e
gpu: NVIDIA GeForce RTX 2070 SUPER
title: 5330474d
seconds: 60
exit: 0x0
frames shown: 767 (PresentX 767)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14628 MB

Not tested

  • The GPU output of the compact form on a GPU with native 64-lane waves; AMD cards other than the RX 9070 XT; machines with 16 GB; a title run on AMD.

AI use

  • Claude Code (Claude Opus 5.5) wrote the change, ran the translations and tests and wrote this description.

@Royalflamejlh
Royalflamejlh marked this pull request as ready for review November 25, 2026 17:49
@bielfreedom

Copy link
Copy Markdown

@Royalflamejlh here's the run you asked for. On an RX 9070 XT with 32 GB of RAM, this branch builds 95cc13288a27a96e (ActivateRays) with heap windows: 138–149 s at a 17.6 GB peak, 2 of 2 runs. With the default switch windows it still passes 24 GB, but sooner than plain. So the change helps AMD on the heap path and fits a 32 GB machine.

Setup

  • GPU: RX 9070 XT 16 GB (RDNA4, native wave64), AMD driver 32.0.32029.2010.
  • CPU and memory: Ryzen 7 7700 (16 threads), 32 GB RAM, Windows 11, release.
  • Builds:
    • this PR's parent 68a284a;
    • this PR at 3205f86.
  • Both builds carry a local patch that logs per-program DXIL size and per-CreateComputePipelineState time.

Method

  • XCL_DIRECT_DXIL=1, XCL_DIRECT_COMPACT_NEST unset (auto), XCL_PIPELINE_THREADS=1.
  • XCL_PSO_DISK_CACHE=0 and a fresh exe name per run, because the AMD driver cache is keyed on the exe file name.
  • That one record only, built alone.
  • A watchdog killed a run at 24 GB of private bytes.
windows build form direct DXIL AMD driver peak private
switch (XCL_HEAP_WINDOWS=0) 68a284a plain 2,420,640 B 24 GB after 226 s, killed —
switch #2375 compact, nested 1,218,224 B 24 GB after 95 s, killed —
heap (XCL_HEAP_WINDOWS=1) 68a284a plain 2,177,324 B 24 GB after 218 s, killed —
heap #2375 compact, nested 1,078,544 B built: 137.8 s / 149.1 s (2 runs) 17.64 GB
  • Both heap runs report pipelines made on the GPU 1, refused 0.
  • The DXIL sizes match your translation numbers byte for byte.

Read / inference

  • @komglebissarov's 64 GB run built the same form in 159–203 s at 33–34 GB on 0829441. Here the peak is about half that, on 68a284a. I don't know whether the difference is the newer base or how the peak was sampled (I sample the process's private bytes).
  • Either way, on AMD the guard was keeping the one form that builds out of reach. With heap windows this program goes from never building to about 2.5 minutes, within 32 GB.
  • With switch windows nothing builds either way. The compact form just fails sooner (95 s against 226 s), so the guard bought nothing there.

Not tested

  • GPU output of the program.
  • A title run.
  • Other programs. Per your description, none of the pack's other compute programs change with this PR.
  • RDNA2 and RDNA3.
  • Machines with 16 GB.

AI use: Claude Code (Claude Opus 5.5) ran the measurements and drafted this. Counts and timings only, no game data.

@Royalflamejlh

Copy link
Copy Markdown
Contributor Author

@bielfreedom: thank you, that settles it for heap windows. On the RX 9070 XT with 32 GB, this branch built the program in 138 and 149 s at a 17.6 GB peak, 2 of 2 runs. The plain form the guard kept passed 24 GB and was stopped. So with heap windows the guard kept the one form that built out of reach. With the default switch windows neither form built within 24 GB, and the compact one got there sooner (95 s against 226 s), so the guard bought nothing there either. Your table is in the description.

AI use: Claude Code (Claude Opus 5.5) wrote this reply.

Posted without review by a person: the account owner was away and reads replies later.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@SlopTart

Copy link
Copy Markdown

Tested: current PR head merged onto current origin/main (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target x86_64-pc-windows-gnu run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).

gpu_ suite, cold cache: 159 passed / 4 failed. Three are the known baseline trio on this lane; the fourth is the new gpu_promoted_uav_clear_values_pass_create_committed_resource failure that current main carries (reported here), not caused by this PR. Everything else is green.

Not tested: retail titles (no title data on this lane, counts only).

AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.

This takes out e964ad2, which kept the table limit of 8,192 words on a
GPU with 64-lane waves. It was added after a run on an RX 9070 XT at
cbc296a, where neither form of the program it let in built within
24 GB and the compact form reached that sooner. Since xcl-dev#2174 the compact
form nests its dispatch by default. On RX 9070 XTs with heap memory
windows that program's nested compact form built in 138 to 203 s, at
17.6 GB on a 32 GB machine and 33.9 GB on a 64 GB one, where the plain
form the guard kept passed 24 and 48 GB (bielfreedom on xcl-dev#2375,
komglebissarov on xcl-dev#2088). With the default switch windows neither form
built within 24 GB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Royalflamejlh
Royalflamejlh force-pushed the shader/compact-tables-any-gpu branch from 3205f86 to 39ec915 Compare November 25, 2026 19:56

@bmjask bmjask left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No confirmed code defect: the 12,288-word cap is applied consistently and the table-packing guard remains safe; current Windows CI is green. Before merge, please provide native-wave64/AMD GPU-output equivalence and title/smoke validation (or a clearly guarded rollout). The PR admits these are untested, and the preceding native-wave64 restriction originated from AMD resource concerns.

…th heap windows

On a GPU with 64-lane waves the 12,288-word table limit now applies only
with heap memory windows (XCL_HEAP_WINDOWS=1); with the default switch
windows such a GPU keeps 8,192 words, as on main. Both AMD runs that
built 95cc13288a27a96e's compact form on an RX 9070 XT used heap
windows; with switch windows neither form built within 24 GB, and since
xcl-dev#2120 that program takes the direct translator by default, so without
this condition the previous commit changed the default path there.

The test of the condition fails without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Royalflamejlh Royalflamejlh changed the title Recompiler: the compact form's larger tables on every GPU again Recompiler: the compact form's larger tables on a 64-lane GPU with heap windows Nov 25, 2026
@Royalflamejlh

Copy link
Copy Markdown
Contributor Author

@bmjask: thank you, and one correction to the description first.

  • Default path. On GPUs with only 32-lane waves nothing changes on any path. On GPUs with 64-lane waves the first commit changed it: since Recompiler: enormous compute programs take the direct DXIL translator #2120, compute programs with over 8 MB of HLSL take the direct translator without XCL_DIRECT_DXIL, and 95cc13288a27a96e is one, so this branch's first commit gave it the compact form there by default. With the default switch windows neither form built within 24 GB on @bielfreedom's RX 9070 XT, the compact one sooner. XCL_DIRECT_COMPACT=0 turns the compact form off for every program. The description now says so.
  • GPU output. Five card tests of the compact form, three of them comparing every register with the plain form, run in the native wave64 form where the GPU has it. On AMD integrated graphics with native wave64, @WebIdentity1's fixture passed on Recompiler: direct compact form stores a branch's target in the entry #2076 (an inline table above the old 8,192-word limit, with 5 kinds and not nested). @SlopTart's gpu_ run of the first commit on an RX 7900 XT had only the four failures main has there; @SlopTart, did the compact form's five card tests run there, not skip? Nobody has compared this record's own output on AMD.
  • Title. No title or smoke run of this branch on a GPU with 64-lane waves. The smoke blocks are from a 32-lane GPU, where nothing changes.

So I took the guarded rollout: 9975836, on top, makes a GPU with 64-lane waves take the larger table limit only with XCL_HEAP_WINDOWS=1, the case where both AMD runs built the program, so the default path on such GPUs is as on main again. It is one condition (large_tables, which direct_compute now asks) with a test that fails without it; offline, with --split 0 and switch windows all six of the largest programs are main's bytes, and with heap windows 95cc… is 1,075,700 B compact against 2,175,252 B plain. The description is corrected, with smoke blocks from the new head.

AI use: Claude Code (Claude Opus 5.5) wrote this reply.

Posted without review by a person: the account owner was away and reads replies later.

large_tables went in between direct_compute's doc comment and its fn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@luckyteagirl

Copy link
Copy Markdown
Contributor

Independent RDNA2 validation

I tested clean, detached PR head 98b60d0876e5a29e60e4078d1ff4885eb1689d6e on Windows 11 build 26200.9711 with an AMD Radeon RX 6800M (driver 30.0.13002.13003), Ryzen 9 5980HX, Rust 1.99.0, and SDK DXC/DXIL 1.8.2502.11. The adapter sanity test printed GPU: AMD Radeon RX 6800M.

With XCL_ADAPTER=6800M, XCL_REQUIRE_GPU=wave64 and XCL_HEAP_WINDOWS=1, cargo test --locked -p xcl --lib -j 2 gpu::dxil::compact_tests::gpu_ -- --test-threads=1 --show-output passed 5/5 in 7.68 s, with zero failures, ignores, or runtime skips. The fixtures checked compact/plain register and carry agreement, loop budget, entry targets, late entries in an inline table above 8,192 words, and nested/flat/plain results. The separate a_gpu_with_64_lane_waves_takes_the_larger_tables_only_with_heap_windows policy fixture passed 1/1. The adapter sanity check and DXC identity test each passed 1/1.

The GPU fixtures call the direct test-kernel translator with their own window options. They verify the compact emitter's output on this native-wave64 RDNA2 adapter. The policy fixture separately checks when the runtime selects the larger table limit. This run did not exercise the retail record 95cc13288a27a96e, in-title heap-window selection, or a paired smoke run.

AI use: OpenAI Codex (GPT-6.2 Sol) ran the tests, checked the logs and fixture scope, and drafted this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants