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. |
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. |
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. On the original PR head fcc8247, release translation of 54 retail VS, PS and CS programs took 81.15 ms against 86.50 ms on main c160d86. The generated HLSL and all 45 static sampler descriptors matched in that comparison. Assisted-by: Codex (GPT-6.2 Astra, max reasoning effort)
fcc8247 to
a971a8a
Compare
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
a971a8ab36econ50a9fdef81cb. 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 --workspace --lockedandcargo build --release --locked -p xclpassed on both revisions.XCL_REQUIRE_GPU=wave64,cargo test --locked -p xcl --lib -- static_samplers --test-threads=1 --nocapturepassed on HLSL and withXCL_DIRECT_DXIL=1. Each run passed 1 test on main and 2 on the PR, with zero failures, ignores or skips. Both upstream image-load/store tests at the conflict also passed on the PR.cargo test --locked --workspace --no-fail-fast -- --test-threads=4on the RX 580 returned 101 on both. Main reported 1,170 passed, 119 failed, 46 ignored and the PR 1,172 passed, 118 failed, 46 ignored. Both pass counts include the same 76 tests that printedSKIPPED. Each GPU command ran through Philip’s shared queue.gpu_wave64_ps_whole_wave_reductionsexited0xc0000005on both. The full-suite log includes0x887A0005(device removed) in subsequent tests.a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier. Both runs counted 3 barriers with 1 expected. Main CI · PR CICurrent RX 580 skips and isolated failures
a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_branch_on_a_mixed_mask_matches_the_hlsl_path_on_the_gpu,a_bridged_instruction_may_write_to_the_entry_block,a_bridged_v_cmpx_keeps_the_lanes_outside_exec_out,a_compute_program_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,a_per_lane_compute_program_runs_on_the_gpu,a_per_lane_program_with_four_memory_windows_runs_on_the_gpu,coalesced_foreign_runs_agree_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,const_and_null_mask_operands_agree_with_hlsl_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,f16_programs_on_the_gpu,f32_programs_on_the_gpu,f64_programs_on_the_gpu,gpu_frexp_exp_f32_denorm_per_lane,integer_programs_on_the_gpu,mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu,native_wave_branches_on_the_gpu,per_lane_kernels_run_on_the_gpu,split_wave64_dead_scc_skips_exchange_barrier,split_wave64_wave_branches_on_the_gpu,the_lowering_agrees_with_the_hlsl_path_on_the_gpu,the_runtime_path_takes_the_split_form,the_split_form_agrees_with_the_wave64_lowering_on_the_gpu,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.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,gpu_direct_rcp_f64_and_rsq_f64_edges,groupshared_barrier_and_atomics_run,half_precision_overloads_run,int64_bit_ops_match_cpu,integer_ops_match_cpu,raw_and_structured_buffer_atomics_run,s_setreg_b32_mode_bit3_does_not_underflow,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.a_held_resource_goes_when_the_queue_is_past_its_batch,a_new_list_takes_no_copy_scratch_of_an_earlier_one,a_recording_outlives_the_reset_of_the_titles_allocator,a_reset_while_the_last_submit_runs_records_on_another_pc_list,a_resubmit_while_the_previous_submit_runs_is_noticed,an_internal_wait_is_listed_until_its_fence_reaches_the_value,copy_scratch_budget_counts_resources_until_gpu_completion,execute_indirect_reads_the_arguments_written_before_it,gpu_console_textures_upload_every_mip_and_slice,gpu_depth_buffer_created_for_unordered_access_is_placed,gpu_large_mixed_upload_keeps_tight_staging_and_exact_pixels,gpu_placed_console_depth_target_with_clear_value,gpu_raw_window_view_reaches_its_top,gpu_upload_batches_reuse_the_queues_upload_buffer,rejected_create_shader_cache_session_falls_back_to_working_in_memory_session,the_shaders_t_sharp_index_bound_fits_the_shared_heap.dispatch_chain_divergent_forward_edges_3d,dispatch_chain_oversized_loop_matches_whole,dispatch_chain_payload_skips_middle_piece,dispatch_chain_payload_survives_reused_edge_slot,dispatch_chain_wave32_live_loops,dispatch_chain_wave64_live_loops_and_exchange.emitted_ms_primitive_attribute_reaches_the_pixel_shader,emitted_ms_ps_draw_a_triangle,gpu_geometry_mode_es_gs_strip,gpu_geometry_mode_es_gs_strip_with_branches,gpu_mesh_mode_two_passes.0x887A0020(2) —pso_measurement_compiles_an_exact_synthetic_record,stale_blob_cannot_bypass_the_offline_pipeline_cap.gpu_geometry_direct_records.heap_window_out_of_memory_falls_back_to_the_switch_form.blocks_are_written_in_reverse_post_order.test_title_draws_with_a_root_signature_under_the_debug_layer.The 32 assertion or execution failures reproduced individually on both revisions were
a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier,gpu_cmp_class_f16_preserves_snan,gpu_compute_coherent_and_cached_loads,gpu_compute_tg_size_counts_a_partial_last_wave,gpu_direct_image_get_resinfo_d16,gpu_direct_msaa_image_loads,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_frexp_exp_f32_denorm_control_flow,gpu_frexp_exp_f32_denorm_initial_mode,gpu_frexp_exp_f32_denorm_modes,gpu_frexp_exp_f32_denorm_setreg,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_image_get_resinfo_dim_2d_of_an_msaa_tsharp,gpu_image_get_resinfo_past_last_level,gpu_images_sample_load_store_atomic,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.Historical verification and performance measurements on `fcc8247` and earlier revisions
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. At that revision the hosted Windows run awaited 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
scripts/smoke.ps1 -Game <local title> -Seconds 60 -Title Retail, offline release builds on the RX 580,XCL_ASYNC_PSO=0and fresh title data for every run. From empty caches, main showed 291 frames at 12,162 MB and the PR showed 399 frames at 12,206 MB. The two blocks below used byte-identical warm caches, with 896 pairs of matching translated shader payloads and 897 shared DXIL entries. All four runs exited normally with zero crashes and device removals.Historical retail runs on `fcc8247` and its predecessors
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.
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
Translation time at
a971a8ab36ec, asynchronous PSO creation, later gameplay, or execution on another GPU at this head. The 4.1% timing in the historical results was measured on the earlier tree. OptionalXCL_SAMPLE_*fixtures were unset in the workspace suites.AI use
For the original series, 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.OpenAI Codex in Orca, GPT-6.2 Astra (
gpt-6.2-astra) at maximum reasoning effort (max), resolved the rebase, reviewed the complete diff on Philip’s behalf, ran the revision-specific checks, and updated the evidence.