Repository navigation
Conversation
…e program Console programs keep constant tables after s_endpgm and read them PC-relative (s_getpc_b64 + s_load_dword* / global_load_dword*). The translation gave s_getpc_b64 the program offset with high dword 0, so in a title these loads read memory window 0 at a low offset: zeros. 676 of the 26503 shader records of a retail title use this, among them all postfx_aces LUT bakes, whose 64-cube output LUT came out as one constant texel, so the presented image was flat. The data blocks after the program (xbox::Fssm::rodata, the new Options::rodata) now go with the translation: - HLSL: emit.rs embeds them as `static const uint xcl_rodata[]`, and s_load and FLAT / GLOBAL dword loads go through xcl_gload*, which take the dwords at a code address inside a block from the table. With several memory windows s_getpc_b64's high dword is CODE_ADDRESS_HI (0xC0DE, above any user-space address), so a code address is told from the title's memory at the same low dword; with one window it is the program's offset as before. - Direct DXIL: the same, as an internal constant array of the module (Lw::rodata_loads in lower_window.rs); with windows s_buffer_load reads it too. kernel::translate_entry_rodata carries the data. The per-lane form (XCL_PER_LANE) has no table and leaves such programs to the per-instruction form. TRANSLATOR_VERSION 9 -> 10. - pso.rs passes the data on the compute, VS / PS and mesh paths (HLSL and direct), and `xcl shaders` (precompile, direct sweep) does too. Not covered: byte / short global loads, MUBUF buffer_load, the legacy GS path and the per-lane form still read memory at such addresses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
039a363 to
2304774
Compare
|
Tested Independent debug verification on clean
Both logged 20 native-wave64 skips, three per-lane f16/f32 refusals, and one skip each for unavailable driver-cache control and heap windows. The RTX 2080 SUPER also logged two missing-D3D12-debug-layer skips.
The two workspace failures had identical assertions on both PCs: Not tested Retail smoke, title shader samples, full AMD workspace, Intel, release mode, and performance. The parent checks were targeted, not full-workspace runs. AI use Ran via Samaritan:
|
|
In-title test on an RTX 3090 (32-lane waves), on a different local stack: with this change ported, the presented world frame is no longer flat grey, and the output LUT matches your numbers. One run, with two deviations from the PR that are listed below, so read it as a second data point, not as a test of this head. Setup
Measured
Not tested / not established
AI use: Claude Code (Claude Fable 5.2 coordinating; a Claude Fable 5.2 agent did the port, the runs and the dumps). I looked at the last dumped frame and checked its log line; the other numbers are from the agent's notes. |
Console programs keep constant tables after
s_endpgmand read them PC-relative (s_getpc_b64+s_load_dword*/global_load_dword*). The translation gaves_getpc_b64the program's offset with high dword 0, so in a title those loads read memory window 0 at a low offset and got zeros. This makes both translators (HLSL and direct DXIL) read the program's own constant data there. Part of #505.676 of the 26503 shader records of the newer retail title (#505) take such an address. Among them are all
postfx_acesLUT bakes (CS_Bake*LUT*): the ACES tone-scale spline coefficients sit after the program, so with zeros every channel came out 1.0 and the 64-cube output LUT the composite pass reads was one constant texel (0.162, 0.162, 0.162, 1). The presented picture was then one flat grey whatever the scene. Others in the list:scattering_transmittance_system,prefilter_env_map,MS_VS_CascadeShadows*,MS_VS_Transform*,rtdirectionalshadows,indirect_diffuse_lighting:CS_ScreenProbes_ActivateProbes,water_*.What is in it
crates/xcl/src/gpu/xbox.rs:Fssm::rodata(program), the data blocks after a program.crates/xcl/src/gpu/recomp/mod.rs,emit.rs: newOptions::rodata. The HLSL embeds the blocks asstatic const uint xcl_rodata[];s_loadand FLAT / GLOBAL dword loads take dwords at a code address inside a block from the table. With several memory windowss_getpc_b64's high dword isCODE_ADDRESS_HI(0xC0DE, above any user-space address), so a code address is not taken for the title's memory at the same low dword; with one window it stays the program's offset as before.crates/xcl/src/gpu/dxil/(kernel.rs,lower.rs,lower_mem.rs,lower_window.rs,coverage.rs): the same for the direct translator, as an internal constant array of the module (Lw::rodata_loads); with windowss_buffer_loadreads it too.kernel::translate_entry_rodatacarries the data; the per-lane form has no table and leaves such programs to the per-instruction form. ItsTRANSLATOR_VERSIONgoes from 9 to 10.crates/xcl/src/gpu/recomp/pso.rs,crates/xcl/src/shaders.rs: the data is passed on the compute, VS / PS and mesh paths (HLSL and direct), and byxcl shaders(--precompile, the direct sweep).gpu::recomp::tests::gpu_loads_read_the_constant_data_after_the_programandgpu::dxil::core_tests::gpu_direct_loads_read_the_constant_data_after_the_program: a program reads its table throughs_getpc_b64+s_load_dword*/global_load_dword*(direct: alsos_buffer_loadthrough a V# on it), with one window, two windows in the switch form and with heap windows; the values must equal the table.Tested
stable-x86_64-pc-windows-msvc, release. On2304774(this PR, rebased ontomain5478c4a; it merges cleanly intof087b99).cargo test --release -p xcl --lib constant_data_after_the_program: 2 passed, 0 failed (both ran on the GPU, no SKIPPED).cargo build --release --workspace && cargo test --release --workspace --no-fail-fast -- --test-threads=4on2304774: 1223 passed, 6 failed, 46 ignored.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(CreateComputePipelineState: out of memory (0x8007000E), seeds 70, 545, 1019, 1507); they fail the same way onmain(checked on568e7db: 1150 passed, the same 4 failed, 46 ignored, against 1152 / 4 / 46 for this change there).mainc9a5d58too, run alone:gpu::recomp::pso::shader_cache_tests::rerouted_disk_entries_follow_the_direct_translator(left: 68, right: 1) andhle::d3d12x::device_x::tests::pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa("format 85 kept"). This change does not touch either.--no-fail-fastcargo stops after thexcllib binary.main): 18 "no wave64" (recomp::lower::tests×4,recomp::lower_dxil::tests×12,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware), 3 "refused by the per-lane form" (lower_dxil::tests),heap_window_out_of_memory_falls_back_to_the_switch_form("no heap windows"),pso_measurement_compiles_an_exact_synthetic_record(driver cache cannot be disabled without Developer Mode).mainalone it does not reach its world, so the effect was measured on a local branch that adds other open PRs and local work tomain(XCL_HEAP_WINDOWS=1,XCL_UMA_SHADOW=1, pipelines precompiled), with this change applied (the same commits before the port tomain):postfx_aces:CS_BakeACESWithGamutCompressLUT_QuasiLogShaper(64-cube RGBA16F, slice 0 read back): 1 distinct texel of 4096 before, about 3300 after, in two runs;xcl shaders <pack> --direct --hash 56c0cd3b82a00c6e --validate(indirect_diffuse_lighting:CS_ScreenProbes_ActivateProbes): translates in about 1 s and validates, 3.4 MB DXIL with heap windows. On the HLSL path that program is 28 MB of DXIL, so keeping it on the direct translator matters for compile time.Regression run
main:
this PR:
Not tested
main.buffer_load, the legacy GS path and the per-lane form (XCL_PER_LANE) still read memory at such addresses.AI use
mainand ran the whole suite on this commit and onmain.🤖 Generated with Claude Code