Repository navigation
Recompiler: direct compact form stores a branch's target in the entry - #2076
Draft
Royalflamejlh wants to merge 2 commits into
Draft
Royalflamejlh wants to merge 2 commits into
Royalflamejlh wants to merge 2 commits into
Conversation
Hardening from the review of xcl-dev#2034. Whether an instruction has a static sampler follows from the moves before it in its block, which are in the key, so no two blocks share a key today; the flag makes the key's sections delimit themselves. The six largest compute programs of a retail pack come out byte for byte as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Royalflamejlh
force-pushed
the
shader/compact-third
branch
from
November 25, 2026 03:14
a429968 to
d15c1ec
Compare
The third-largest compute program of a retail pack repeats itself as the two largest do (13,890 blocks of 2,643 kinds), but its branches go to 6,530 different pairs of offsets. As an index into a table of pairs its tables were about 24,000 words, over the limit, and it kept the plain form: 3.9 MB of DXIL. In it, as in the other large programs, a block's second successor is the next block or the same as its first. When every conditional branch of a program falls through to the next block, a table entry now holds the taken successor itself if that makes the tables smaller: 11,287 words here, in one table. The limit goes from 8,192 to 12,288 words, the size xcl-dev#1315 measured an RTX 5070 Ti accepting in the HLSL form, and the program takes the form. Part of xcl-dev#1269. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Royalflamejlh
force-pushed
the
shader/compact-third
branch
from
November 25, 2026 03:16
d15c1ec to
f1b313f
Compare
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.
The third-largest compute program of a retail pack now takes the direct compact form of #2034: 3,916,120 B of direct DXIL become 1,249,504 B, and vkd3d-proton's dxil-spirv converts it in 0.6 s where its plain form took 496 s. The rule left this program out for the size of its tables. Part of #1269.
Draft: on an RTX 5070 Ti (native Windows, debug) the 7
compact_testspass atf1b313f, the three card tests among them. Both regression blocks are below, and the driver took this program's table: 33 s for its compact form.What is in it (two commits)
compact.rs, the tables: the program's branches go to 6,530 different pairs of offsets, so as an index into a table of pairs its tables were 23,913 words. In it, as in the other five of the six largest programs, a block's second successor is the next block or the same as its first. For such a program an entry now holds the taken successor itself when that makes the tables smaller: 11,287 words here, in one table. The limit for taking the form goes from 8,192 to 12,288 words.compact.rs, the key (its own commit, from the review of Recompiler: direct DXIL lowers a repeating compute program's blocks once #2034): a flag for whether an instruction has a static sampler. Hardening only: the sampler follows from the moves before it in the block, which are in the key.compact_tests.rs, two tests: a program of 1,000 early exits to one place needs under 500 words of tables (2,381 onmain, where the test fails);gpu_compact_form_with_targets_in_the_entry_runs_as_the_plain_formruns 40 such exits in both forms and compares every register.Tested
x86_64-pc-windows-gnu.mainiscbc296a. The numbers were taken ona429968; the head,f1b313f, tightens one condition (a conditional branch's second successor must be the next block for the one-table form) and gives the six programs the same bytes (SHA-256).XCL_DIRECT_DXIL=1 xcl shaders <folder> --precompile --only cs --split 1from an empty cache, 1 translation each:main"The same bytes" is by SHA-256.
dxil-spirv as vkd3d-proton ships it (command-line tool, 8 GB limit, 1 conversion): the 76,699-instruction program in 0.6 s, 4,403,404 B of SPIR-V, which
spirv-val --target-env vulkan1.3accepts. Its plain form took 496.3 s and gave 20,705,832 B onmainaa9ab8a(Recompiler: direct DXIL lowers a repeating compute program's blocks once #2034's description).The whole pack,
xcl shaders <pack> --direct --validate --only cs --split 1 --max-bytes 0 --sample 100000(26,698 programs, 2,689 of them compute): with the rule deciding, 3 take the form (2 onmain, by the six-program run) and DXC's validator accepts every program; with the form forced on every compute program it accepts every one too.A 23,000-record slice of the pack (836 cached translations): 231,800,172 B on
main, 229,133,556 B with the change, the difference being this one program.cargo test --workspace --release --target x86_64-pc-windows-gnu --no-fail-fast -- --test-threads=8under Wine, no card: 1,150 passed, 6 failed, 46 ignored;main: 1,148 passed, 6 failed, 46 ignored. The same six fail on both:disk_free_space_ex_reports_pls_quota,fence_and_command_queue_sync_timing_and_allocator_reset_match_host_and_console,directed_reference_basics,gpu_depth_buffer_created_for_unordered_access_is_placed,stale_blob_cannot_bypass_the_offline_pipeline_cap,test_title_runs_and_game_folder_is_untouched. SKIPPED lines: 296 (295 onmain), no GPU or a missing wave size; the new card test is one of them.The direct translator's own tests under Wine with
XCL_DIRECT_DXIL=1 XCL_DIRECT_COMPACT=1: 123 passed, 1 failed (directed_reference_basics, which translates nothing and fails onmaintoo), 3 ignored.On the same RTX 5070 Ti (driver 621.24), alone on the machine, debug build of the head plus one local test that calls
CreateComputePipelineStateon a program's direct DXIL with XCL's root signature, split wave64 form, the driver's cache on, 1 run: the 76,699-instruction program in the compact form (1,249,504 B, one table of 11,287 words) took 33.16 s on the first call and 0.009 s on the second. The two programsmainalready compacts took 6.44 s and 5.22 s (484,508 and 442,740 B).Regression run
Native Windows 11, RTX 5070 Ti 16 GB (driver 621.24), the retail title, 60 s, 1 run each.
smoke.ps1sets noXCL_DIRECT_DXIL, so neither run reaches this code.main:
PR:
Not tested
mainit was at the driver for 209 s without finishing: [OFFICIAL] Looking for PRs with shaders optimization #1269), and any card but this one.f1b313f: they ran ona429968. On the head the six programs are the same bytes and the 7 compact tests pass.XCL_HEAP_WINDOWS=1.AI use