Repository navigation
Conversation
The direct translator recomputes a vertex or pixel shader's input -> output dependency tables (PSV0, dx.viewIdState) from the code it emitted. compute_deps kept the set of input components of every value as a BTreeSet<u32>, cloned and merged at each operand of each instruction, in hash maps keyed by value. On a retail pack that was 39 % of the time its vertex and pixel shaders took to translate. - the sets are bit masks (a u128 for components 0..128, words after that); - the two memo tables are indexed by instruction and by block; - the base of a pointer chain is found once per instruction, not walked again at every instruction with two operands or more; - the instruction -> block map, which nothing read, is gone. The traversal and what it memoises are unchanged, so the tables are too. Measured on a retail pack's 26 698 programs (xcl shaders --direct --sample 0 --max-bytes 0, 8 threads, Ryzen 7 9700X), two runs each: - compute_deps: 156 / 154 s -> 37.5 / 38.0 s summed over the threads; - vertex and pixel shaders (14 337 programs): 399 / 392 s -> 284 / 288 s; - the whole sweep: 103.6 / 102.7 s -> 89.1 / 89.9 s. The per-phase times come from timers added for the measurement, not part of this commit. With --dump, all 52 168 files of the two builds are identical (25 615 DXIL containers). Part of xcl-dev#1269. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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 direct DXIL translator (xcl-dev#1426) recomputes a vertex or pixel shader's input → output dependency tables (PSV0,
dx.viewIdState) from the code it emitted.compute_depskept the input components of every value as aBTreeSet<u32>, cloned and merged at each operand of each instruction, in hash maps keyed by value. On a retail pack that was 39 % of the time its vertex and pixel shaders took to translate. This PR keeps the algorithm and makes the sets bit masks. The DXIL is byte for byte the same. Part of xcl-dev#1269.What is in it
crates/xcl/src/gpu/dxil/graphics.rs,compute_deps:Comps: au128for components 0..128, words after that);The traversal order and what is memoised are unchanged.
crates/xcl/src/gpu/dxil/graphics_tests.rs: a test of the set type on both sides of component 128, and a test that an input placed past row 32 reaches the dependency table. The second one passes onmaintoo: it pins the behaviour the pack does not cover.Tested
AMD Radeon RX 9070 (driver 32.0.32029.2010), Ryzen 7 9700X, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0, DXC 1.9.2602.17. Tests in debug, measurements and regression runs in release.
cargo build --workspace, thencargo test --workspace -- --test-threads=4on6f8cb8b: 860 passed, 0 failed, 42 ignored (SKIPPED GPU tests:heap_window_out_of_memory_falls_back_to_the_switch_form, no heap windows).Same output:
xcl shaders <pack> --direct --sample 0 --max-bytes 0 --dump <dir>onmainc160d86and on this commit, all 26 698 programs of a retail pack (26 229 translated, the same 469 refused in both).diff -rqof the two folders: all 52 168 files identical, 25 615 of them DXIL containers.Time, same command without
--dump, 8 threads, two runs each (main→ this PR):mainc160d86compute_deps, summed over the threadsThe first three rows come from timers added to both builds for the measurement; they are not part of this PR.
Regression run
Both runs with
XCL_PRESS_A_AT=10,14,18,22,26,30,34,38,42,46,50,54,58set beforescripts/smoke.ps1, so that the title takes the same path in both (in a first pair without it, a real key press reached the title at 12 s in one run and at 36 s in the other, and the runs were not comparable). The game folder is given through a junction namedretail-title.main:
PR:
Not tested
XCL_DIRECT_DXIL=all. The regression runs above use the default HLSL path, which does not send the title's shaders throughcompute_deps; for the changed code the evidence is the whole-pack comparison and the tests.finish_graphicson game data: the pack's NGG programs go through the compute entry. The mesh unit tests (ms_*_parts_match_dxc) pass.Noticed while measuring, not changed here:
Shader::infer_type_featurestakes about 39 s of the 800 s summed above (insts_use_typebuilds aVecper instruction), and xcl-dev#1544 already touches that code.AI use
🤖 Generated with Claude Code
Mirror of xcl-dev#1770 (auto-synced, do not edit).