Repository navigation
Recompiler: track sampler constants only up to image instructions - #1573
philip-roy-jones wants to merge 1 commit into
Conversation
11cd98c to
be200ab
Compare
|
Test report for #1573 at Tested
Not tested
AI use
|
|
Retest of
Independent AMD check of both compiler paths at Tested
Not tested Retail shader packs or titles, performance, or direct runtime routing through a title PSO. AI use OpenAI Codex (GPT-6 family, exact variant unavailable) wrote the temporary probe, ran the tests, and drafted this report. |
Sampler constants only reach an image instruction in the same block. Apply pending scalar writes at each image and discard them at the next block boundary. This skips register analysis on image-free blocks and after the last image in a block. Release translation of 54 retail VS, PS and CS programs took 81.15 ms against 86.50 ms on main. The generated HLSL and all 45 static sampler descriptors matched. Assisted-by: Codex (GPT-6.2 Astra, max reasoning effort)
54d5cd7 to
fcc8247
Compare
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Test report for Setup
Both runs stop presenting at the same point and stay at 0 presents for the rest of the run. With one run each, this shows no change in the stop; it says nothing about the time this PR saves per translation. Not tested: a warm cache, repeat runs, other GPUs. AI use: Claude Code. Claude Sonnet 5.5 (a second session) made the two runs; Claude Opus 5.5 checked the counts against the run logs and wrote this report. |
Part of #1269. XCL can skip tracking scalar writes in blocks that never read a static sampler descriptor. A descriptor depends only on the writes that precede its image instruction in the same block.
What is in it
Apply pending writes when an image instruction reads the descriptor and discard them at block boundaries. Both the HLSL and direct-DXIL backends use the same helper. The regression test covers consecutive image reads, an unknown overwrite and a branch target.
Tested
fcc8247a9455is a single commit on upstreamc160d86ef2ef. It and the independently tested54d5cd78da13have the same complete Git tree,72ad1a0bf8a6. Windows 11 Pro 26200.9974, Ryzen 7 7700X, Radeon RX 580 (31.0.21925.1001), Rust 1.100.0 MSVC, DXC 1.9.2609.5.cargo build --release -p xclon both. Median CPU time to translate 54 retail shaders to HLSL fell from 86.30 ms to 82.76 ms (4.1%) per batch. Each build ran 36 timed batches in alternating groups after warmup, on 18 vertex, 18 pixel and 18 compute programs with four memory windows. All 7,571,624 HLSL bytes and all translation metadata matched, including 45 static descriptors across 26 programs.cargo test -p xcl --lib -- static_samplers --test-threads=1 --nocapturepassed with the default backend and again with--locked,XCL_DIRECT_DXIL=1andXCL_REQUIRE_GPU=wave64. Both modes also passed with--lockedon GitHub's mergeacee405with upstream9039900and on a clean local merge with upstream85e3826(tree5fd5a66b687d, including Shaders: speed up translated pipeline compiles and add PSO measurements #1524). Each run reported 2 passed, 0 failed, 0 ignored and 0 skipped, including point/linear sampling on the RX 580.cargo build --workspacesucceeded on both.cargo test --workspace --no-fail-fast -- --test-threads=4lost the library process on both. Rerunning every unreported case by name gave 836 reported passes on main and 837 on the PR. Each had the same 21 failed tests, 1 test-process crash and 42 ignored. Both pass counts include 21 explicit hardware skips..\scripts\test.ps1 --skip test_title_runs_and_game_folder_is_untouchedpassed locally on WARP with Windows SDK DXC 1.8.2502.11. It reported 858 passes (including 236 hardware skips), 0 failures, 42 ignored and 1 filtered. The hosted Windows run awaits maintainer approval. Hosted Windows CIfcc8247on the Ryzen 7 9800X3D iGPU and RTX 5090. The workspace reported 859 passes, 0 failures and 42 ignored on each adapter, including one skip on AMD and three on NVIDIA. On the same merge tree asacee405, both GPUs passed a sampler probe through both compilers and the direct-DXIL recompiler suite (195 passed, 0 failed, 18 ignored). Independent AMD and NVIDIA reportbe200abon an RTX 4090 and reported 777 passed, 0 failed, 41 ignored. Earlier RTX 4090 reportRX 580 failures and hardware skips on both revisions
Both builds failed the same tests,
gpu_cmp_class_f16_preserves_snan,gpu_compute_tg_size_counts_a_partial_last_wave,gpu_ds_swizzle_and_bpermute_zero_inactive_lanes,gpu_f16_defaults_to_round_to_nearest_even,gpu_f32_compares_with_nan,gpu_f64_compares_with_nan,gpu_f64_literal_high_word,gpu_f64_math_random,gpu_f64_roots,gpu_f64_rounding_and_conversions,gpu_float_compares_random,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_ldexp_f32,gpu_ldexp_f64,gpu_mad_nf_f16_rounds_intermediate_in_binary16,gpu_nonfused_mad_and_mac_prevent_fma_contraction,gpu_s_round_mode_controls_f16_rounding_across_modes,gpu_safe_s_barrier_multi_warp_and_early_endpgm,gpu_sdwa_f16_inline_constants,gpu_signed_bfe_arithmetic_shift,gpu_wave32_and_wave64_src_vccz_execz.Process exit
0xc0000005ingpu_wave64_ps_whole_wave_reductions.heap_window_out_of_memory_falls_back_to_the_switch_form.emitted_ms_primitive_attribute_reaches_the_pixel_shader,emitted_ms_ps_draw_a_triangle,gpu_geometry_mode_es_gs_strip,gpu_mesh_mode_two_passes.approximate_float_unary_ops_are_within_tolerance,derivatives_in_compute_run,doubles_match_cpu,exact_float_unary_ops_match_cpu,float_binary_tertiary_and_half_conversions_match_cpu,groupshared_barrier_and_atomics_run,half_precision_overloads_run,int64_bit_ops_match_cpu,integer_ops_match_cpu,raw_and_structured_buffer_atomics_run,texture_ops_run,typed_buffer_ops_run,uaddc_and_usubb_match_cpu,uav_array_3d_stores_loads_and_texture_atomics_run,wave_ops_match_cpu.blocks_are_written_in_reverse_post_order.Regression run
After pushing
fcc8247, I ranscripts/smoke.ps1 -Game Retail -Seconds 60on both release builds withXCL_ASYNC_PSO=0and a fresh title data root for each run. All eight runs exited normally with zero crashes or device removals.The four warm runs started with byte-identical copies of the same 3,061-file cache. Each copy held both builds' original translated entries for 1,020 shared shader keys with matching DXIL and sampler payloads. The blocks below are from the first matched pair.
With empty caches and main first, the PR showed 79.2% of upstream's frames, below the 80% threshold. Reversing the order, the PR showed 86.0% of upstream's frames and met both thresholds. Both matched warm-cache pairs passed within six frames of main.
Earlier cache comparisons on the identical source tree
Previous head
54d5cd78da13and the same upstream parent. Each row is a 60-second main/PR comparison.The first warm pair exceeded the 25% peak-commit limit (+26.2%). Using upstream's cache alone also exceeded it. XCL keys its translated entries by compiler source, so the PR had to translate again with that upstream-only cache. For the last two pairs, I verified the cached DXIL and sampler payloads matched for 1,020 shared shader keys, kept the original entries under each build's own key, and gave all four runs byte-identical copies of the resulting cache.
Not tested
Asynchronous PSO creation, gameplay correctness on other GPUs at this head, and game-wide compilation time. The paired shader comparisons cover translation, byte equality and validation. The optional
XCL_SAMPLE_*fixtures were unset in the workspace suite.AI use
OpenAI Codex used GPT-6.2 Astra (
gpt-6.2-astra) at maximum reasoning effort (max) to write the optimization and regression test, rebase the patch, run the tests and comparisons and prepare this report.