shader: track texture sample readiness across partial VM waits #175
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/176"
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 R0Y00/Xbox2Windows. Originally posted by descent81 on 2026-11-21T17:59:42Z.
<html>
Motivation
A pixel shader can issue samples for textures A and B, start computing with A as soon as it is ready, and wait for B only when the blend needs it. On
583fee5, the translator stops at instruction 18 of the source-built fixture withUnsupported instruction 18: s_waitcnt vmcnt(1).Recognizing the instruction alone would leave a correctness problem. With A issued first and B second,
vmcnt(1)makes A available while B can still be outstanding. The translator needs to know which sample supplies each operand.What changes
The lowerer tracks outstanding
image_sampleresults in issue order. A VM wait retains at most the newest N outstanding samples. Arithmetic and packing then check the result they actually consume. The ordering rule is scoped to the texture-sample instruction class supported by this translator.Reversing the issue order is the main regression control. The arithmetic instruction and its source register stay the same. Only the identity of the outstanding sample changes, so accepting both programs would expose an error that a final-color comparison alone could miss.
Verification
Instruction round-trip. Assembled all four source-built dual-texture fixtures with LLVM 15 for
gfx1013, extracted and disassembled the machine code, and checked that it lowered to the same HLSL as the assembly input.GPU readback.
pixel_aot_hardwareon NVIDIA GeForce RTX 4060 andpixel_aot_warpon Microsoft WARP both passed. The partial-wait fixture matched the existing CPU blend reference on both backends.Wait boundaries. The controls also reject an early read after
vmcnt(2)with two samples outstanding and confirm that a later wait leaves an already completed sample available.The new fixture runs through the existing LLVM binary check and Windows draw tests. All inputs are built from repository source. To repeat the GPU comparison after a dev build, run:
</html>Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T18:11:54Z.
#144 has landed. Please reconcile the partial-wait queue with its
v_mov_b32path. Keep the pending-destination write checks for each outstanding sample, and exercise a move aftervmcnt(1)for both the older completed sample and the newer outstanding one. Please rerun the LLVM round trip andpixel_aot_warpon the reconciled head.