xshader: prove a heap descriptor copied in both arms of an if/else for its waterfall read #370
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/370"
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?
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-28T04:36:03Z.
Refs #358 (T7, group b: sampler descriptors).
Cause
RAGE's VfxVBuffer vertex programs (
VS_Transform_VfxVBuffer*,VS_TransformSkin_VfxVBuffer*) work like this:s_load_dwordx4 …, 0x410).v_readfirstlane,v_cmp_eq_u64,s_and_saveexec,image_sample_lz,s_xor exec) reads it back for the sample.descriptor_broadcastonly accepted EXEC narrowing between a copy and its read. The if/else's closings_mov_b64 exec, savedwidens EXEC again, so the read had no descriptor. The program was refused with "not a sampler descriptor (None)", or earlier with "buffer record count read from a descriptor with no one host buffer". The copy of the sampler's word 2 was counted as a read of a buffer's record count.In the recent ProjectScarlett runs this was the only T7 group still costing pipelines: 4 per run.
Change
Four commits. Each is a no-op on the recorded requests alone; only together do they change anything.
Scalar widths (
descriptor_broadcast): a 32-bit scalar result and a lane read write one SGPR, not a pair. Before this,s_addc_u32 s55andv_readfirstlane_b32 s7"overwrote" masks kept in s[56:57] and s[8:9].Table descriptors through proven copies:
s_mov_b32), not a record-count read;v_cmp_eqlane test, which is never certain: a sampler's word 2 isn't a count.If/else join: at
s_mov_b64 exec, saved, the proof finds thes_and_saveexec_b64 savedhead and the single hand-back that starts the else arm. It then requires:An if that never writes the register is passed over.
Lanes
raster-sampler-waterfall:lanes-raster-tables.Without 3 nothing is proven; without 2 the proven read carries no table descriptor; without 4 (scalar widths) half the joins fail on the kept mask.
Effect on recorded shaders (ProjectScarlett, 34,677 requests)
MS_VS_*,MSNC_VS_*), plus 0 regressed, 0 new failures, and no change on wave32 hosts.SamplerDescriptorHeap[NonUniformResourceIndex(sR)], with sR each lane's own read-back of the VGPR, becomes a staticSamplerDescriptorHeap[K]the program already declares.s_load).execzbranch from an earliers_and_saveexecjumps straight to the restore, and the saved-mask register is saved again inside the region. The one-entry rule refuses that correctly. Handling it needs the lane model of T8.Tests
a_32_bit_scalar_result_beside_a_kept_mask_leaves_it_alonea_table_descriptor_read_back_from_a_waterfall_copy_is_that_descriptora_count_read_back_from_a_waterfall_copy_is_still_a_countcopies_in_both_arms_of_an_if_else_reach_every_lanean_if_that_leaves_the_register_alone_is_passed_overraster-sampler-waterfall, with a control branch that reverts the join commit: there the scenario fails on both cards, as intended.Results
GPU (run on 8f7f1a5b, the same changes before this rebase):
lanes-raster-tablesincl.raster-sampler-waterfalllanes-raster-sampler-waterfallfailsCPU, on this head against main
7bafe6b6:tools/shader_harness.py run --no-gpu --compile-limit 0(6 jobs): PASStuxbox.py check --no-gpu) passedtests.test_lanes_rasterpasses, and Lanes builds.🤖 Generated with Claude Code