Shaders: console containers are walked without decoding instructions #1082
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1082
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1082"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@TG0000 on GitHub · 2026-11-24 11:24 UTC · original
TG0000:perf/shader-container-scan→main· +515 −32 · 5 files · 1 commits · openWhile 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 of6efdabcgave 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
@fromthemoonx on GitHub · 2026-11-24 12:09 UTC · original
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
NVIDIA GeForce RTX 3060 12 GB (32-lane waves), driver 32.0.16.1088; AMD Ryzen 7 5700X; native Windows 11 Pro 26H2 (build 26300.9974), Graphics Tools installed; rustc 1.100.0
stable-x86_64-pc-windows-msvc; DXC 1.9.2602.17Exact head
3c325a9080790815bae0e79349ac24d93f2bb52b, which is on currentmain47efa2e(so also the merged result), debug:cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4: 744 passed, 0 failed, 42 ignored (lib 701 / 0 / 22; the extra ignored test isbench_scan). New tests passed:rdna2_scan::tests::every_opcode_steps_as_it_decodes,rdna2_scan::tests::random_dwords_step_as_they_decode,xbox::scan_tests::programs_and_statistics_are_as_decoded.gpu::rdna2_scan+gpu::xbox+gpu::rdna2+gpu::packlib tests, 10 runs (the random-dword comparison included): 10 of 10 passed (25 passed, 1 ignored each)Integration tests on parsed containers, 3 runs:
disasm_e2e,console_shaders,rpf_e2e: 3 of 3 passedbench_scan, release (cargo test --release -p xcl --lib gpu::xbox::scan_tests::bench_scan -- --ignored --nocapture), 3 runs, ns per instruction:split_segmentsbranch_targetsClose to your numbers. The old walk is a little faster on this CPU, so the ratios are a bit lower.
SKIPPED (no wave64 on this adapter):
gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwareXCL_SAMPLE_*not set, so the retail-pack tests did nothingNot tested
AI use
@luckyteagirl on GitHub · 2026-11-25 03:35 UTC · original
Tested
3c325a9080790815bae0e79349ac24d93f2bb52bon Windows 11 build 26200, Ryzen 9 5980HX, Rust 1.99.0 MSVC. The focused scanner tests are CPU tests; they did not exercise the RX 6800M GPU.cargo test --locked -p xcl --lib -j 2 gpu::rdna2_scan::tests:: -- --test-threads=1 --show-output: 2 passed, 0 failed, 0 ignored. These compare the scanner with the reference decoder across opcode encodings and random dwords.scan_tests: 1 passed, 0 failed, 1 ignored. The passing test compares split segments, branch targets, data-block detection, and instruction statistics against the old decoding walks over 3,000 generated programs. The ignored test is the benchmark.cargo build --locked --workspace -j 2: passed.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.
@DavidM1911 on GitHub · 2026-11-25 08:36 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@thehollowedone on GitHub · 2026-11-25 12:52 UTC · original
Independent Windows/NVIDIA workspace run on clean 3c325a9.
Tested
Windows 11 build 26300, RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Rust 1.99.1 MSVC, debug.
cargo build --offline --locked --workspacepassed.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --nocapturereported 744 passed, 0 failed, 42 ignored. The scanner matched the decoder in the primary-opcode and random-dword fixtures. The console shader-container test also matched decoded program and statistics results. Cargo’s passed count includes two wave64 skip notices.Not tested
Retail shader-pack timing, world load, and other GPUs.
AI-assisted. Codex (GPT-6, exact variant unavailable) ran the tests and drafted this report.
@ClosetPie107 on GitHub · 2026-11-25 17:42 UTC · original
Independent AMD RDNA4 / Linux (RADV, native wave64) test report for head
3c325a9080790815bae0e79349ac24d93f2bb52b(merged locally ontomain68a284a, clean merge).Hardware & environment
experimental-11.0-20261112),vkd3d-protonmasterec207194(3.2.0) +dxil-spirvb540c8a2+ relaxed-vtable patch (-Db_ndebug=true), DXVKv3.1.1-209, DXC1.9.2609.5, Rustx86_64-pc-windows-gnu(debug)Tested (
XCL_REQUIRE_GPU=wave64,VKD3D_CONFIG=ignore_shared_fence,--test-threads=1 --nocapture)gpu::rdna2_scan: 2 passed, 0 failed, 0 ignored (0 skipped)gpu::xbox: 10 passed, 0 failed, 1 ignored (0 skipped)gpu::rdna2: 19 passed, 0 failed, 0 ignored (0 skipped)Not tested
bench_scantiming, retail title smoke run, native Windows.AI use
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.