Repository navigation
Conversation
xbox::parse decoded every program twice in full (segments, branch targets; a third time for a segment that may be data) and the statistics of a captured shader once more: three Vecs, hash lookups and bit-at-a-time fields per instruction, for its length, terminator, branch offset and mnemonic. Sampled in a retail title's first 40 s, the two were 31 % of the samples of its running threads, on the threads that make its pipelines. rdna2_scan::step gives those from tables made of the decoder's own, without allocating; mnemonics are counted by number and named once. decode() is unchanged and stays the reference: every opcode of every encoding, random dwords and random programs are compared with it, and a segment with a far jump still goes through it. A whole retail pack (26 503 shaders, 44.4 M instructions), one thread: parse 38.1 -> 4.7 s (2 s of both is inflate), statistics 23.3 -> 1.8 s, with the same result for every shader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
NVIDIA run, since Not tested lists NVIDIA. The change is CPU-side; this covers the suite, the equivalence tests repeated, and the benchmark on another CPU. Tested
Not tested
AI use
|
|
Tested
Not tested
AI use OpenAI Codex (GPT-6, exact variant not exposed in this session) reviewed the exact diff, ran the scanner suites and workspace build, checked the logs, and drafted this report. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Independent Windows/NVIDIA workspace run on clean 3c325a9. Tested Not tested AI-assisted. Codex (GPT-6, exact variant unavailable) ran the tests and drafted this report. |
While a title loads, every console shader it submits goes through
xbox::parse, and once through the instruction statistics ofshader::capture. Both only need an instruction's length, whether it ends the program, its branch offset and its mnemonic, but they usedrdna2::decodefor that: threeVecs, SipHash lookups and bit-at-a-time field reads per instruction, with each program decoded in full three times.I sampled a retail title's running threads for its first 40 s on
main(6efdabc):xbox::parsewas in 20.3 % of the samples andInstStats::add_shaderin 10.8 %, on the threads that make the title's pipelines.This adds
rdna2_scan::step, which walks code from tables built from the decoder's own tables and does not allocate.decode()is unchanged and stays the reference that the tests compare against.xbox::parse(about 2 s of both is inflate)A digest over the
Debugoutput of every parsed shader and of its statistics is the same before and after, for the whole pack.Synthetic benchmark (
bench_scan, release, three runs, other load on the machine). "Before" is the old walk, kept in the tests as the reference:split_segmentsbranch_targetsThe same sampling on this PR's head (one run each): 2150 samples of running threads instead of 3570;
xbox::parseandInstStats::add_shaderare below 12 % each over the run (no longer in the sampler's top 26; on one thread and 4 s windowparsestill had 13.5 %, inflate included).shader::captureitself is still visible (its lock and hashing, which #1026 is about). One run each, so take it as a direction, not a figure.Related: #1026 moves the statistics of
shader::captureto a worker thread (shader.rsonly, no shared file). This PR makes that work cheaper, and also theparsethat every pipeline translation does on its own thread. #479 speeds updecode()itself. Both changerdna2.rs; I have not tried merging them together.What is in it (one commit)
gpu/rdna2_scan.rs(new): the tables,step, and its tests.gpu/xbox.rs:split_segments,branch_targets,is_data_blockandInstStatsuse it. A segment withs_getpc_b64three instructions before ans_setpc_b64(whereresolve_far_jumpsmay find a far jump) still goes throughdecode. Mnemonics are counted by number and named once per shader.gpu/rdna2.rs: three helpers are visible to the sibling module;mnemonicis split intomnemonic_of. No change in behaviour.build.rs: the new file is part of the translator's source identity. As with any change to these sources, the translation cache is rebuilt once.It is over 400 changed lines because more than half of them are the tests and the old walks they compare with.
Tested
stable-x86_64-pc-windows-msvc.cargo test --workspace --no-fail-fast -- --test-threads=4(debug): 741 passed, 3 failed, 42 ignored. The three failures aretitle_textures::placed_title_textures_share_vram_and_preserve_pixels,title_textures::transitions_apply_when_their_list_is_submittedandvram::d32s8_targets_take_their_own_size_of_video_memory; the same three fail onmain(384f7f7) on this machine.test_title_draws_with_a_root_signature_under_the_debug_layeranduploads_start_from_each_subresources_state(no D3D12 debug layer).every_opcode_steps_as_it_decodes(every opcode of every primary encoding, assigned or not, with literals, SDWA / DPP and cut short),random_dwords_step_as_they_decode(100 000),programs_and_statistics_are_as_decoded(3 000 random programs with branches, far jumps, data blocks and padding: segments, branch targets, data blocks and statistics against the old walks).cargo test --release -p xcl --lib scan_tests -- --ignored --nocapturefor the benchmark.main. The frame counts of these runs vary too much from run to run (earlier runs of 6efdabc gave 416 and 928) to show the gain.Regression run
The
title:line of both blocks is replaced by a neutral name; the rest is asscripts/smoke.ps1printed it. The main block is from a run on the same machine by another session.main:
PR:
Not tested
XCL_DUMP_SHADERS=1.rdna2.rs.AI use