shader: lower the P9 MUBUF and interpolation leftovers #3623

Merged
lambirou merged 1 commit from upstream-pr/3623 into main 2026-12-01 00:20:04 +00:00
lambirou commented 2026-11-30 16:08:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-30T16:08:40Z.


Part of the P9 leftovers. This adds four forms: buffer_gl0_inv, buffer_gl1_inv, v_interp_mov_f32 (VINTRP) and v_interp_mov_f32_e64 (VOP3).

The two operandless MUBUF invalidations become no-ops: the RDNA 2 ISA gives them no destination or data result, and the compute store profile maps MUBUF accesses directly to D3D12 buffers without a GL0/GL1 cache, so there is no cache or acknowledgement state to model. This matches the cacheless treatment of the operandless s_icache_inv hint; the neighbouring s_dcache_inv/s_gl1_inv stay refused because their scalar-cache scope is not claimed. A malformed invalidation with an operand or modifier is refused by name rather than ignored.

v_interp_mov_f32 lowers the p0 selector in both encodings: on RDNA, p0 is the flat attr0 word of the provoking vertex, bound as nointerpolation float4 flat0 : TEXCOORD1. p10 and p20 need per-vertex values this profile does not bind and are refused with the selector in the diagnostic; the same interpolation context, mask, component and outstanding-sample refusals as v_interp_p1/p2 apply, and modifiers, clamp, output modifiers, attr1 and malformed operands stay outside the accepted text.

Tests

  • Five new CTest entries pass: compute_store_aot_mubuf_cache_invalidation_{controls,warp,hardware} and pixel_aot_interp_mov_{warp,hardware}.
  • The cache draw compares six 320-word readbacks per adapter with zero mismatch; the pixel draw checks four flat-channel words. The stored-word and store-offset mutations and the flat0.x→flat0.y and interpolated-uv.x mutations all mismatch on WARP and the AMD Radeon RX 9060 XT (driver 32.0.32029.2010).
  • The 18 selected neighbouring MUBUF, attribute and e64 tests still pass on both adapters; form_coverage_check.py pins exactly the four forms.
  • Expected delta: +4 forms on gfx1013 and +4 on gfx1030. After the other open PRs and this one, the table reaches 1,733/1,968 gfx1013 and 1,635/1,863 gfx1030.

Limits

The cache invalidations are modelled only as the cacheless no-op; the scalar s_dcache_inv/s_gl1_inv scope is not claimed. Only the p0 interpolation selector is lowered; p10/p20 remain refused. The debug layer is unavailable on this host, and no console measurement was made.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5568996125 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3623). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-30T16:08:40Z. --- Part of the P9 leftovers. This adds four forms: `buffer_gl0_inv`, `buffer_gl1_inv`, `v_interp_mov_f32` (VINTRP) and `v_interp_mov_f32_e64` (VOP3). The two operandless MUBUF invalidations become no-ops: the RDNA 2 ISA gives them no destination or data result, and the compute store profile maps MUBUF accesses directly to D3D12 buffers without a GL0/GL1 cache, so there is no cache or acknowledgement state to model. This matches the cacheless treatment of the operandless `s_icache_inv` hint; the neighbouring `s_dcache_inv`/`s_gl1_inv` stay refused because their scalar-cache scope is not claimed. A malformed invalidation with an operand or modifier is refused by name rather than ignored. `v_interp_mov_f32` lowers the `p0` selector in both encodings: on RDNA, `p0` is the flat attr0 word of the provoking vertex, bound as `nointerpolation float4 flat0 : TEXCOORD1`. `p10` and `p20` need per-vertex values this profile does not bind and are refused with the selector in the diagnostic; the same interpolation context, mask, component and outstanding-sample refusals as `v_interp_p1/p2` apply, and modifiers, clamp, output modifiers, attr1 and malformed operands stay outside the accepted text. ## Tests - Five new CTest entries pass: `compute_store_aot_mubuf_cache_invalidation_{controls,warp,hardware}` and `pixel_aot_interp_mov_{warp,hardware}`. - The cache draw compares six 320-word readbacks per adapter with zero mismatch; the pixel draw checks four flat-channel words. The stored-word and store-offset mutations and the flat0.x→flat0.y and interpolated-uv.x mutations all mismatch on WARP and the AMD Radeon RX 9060 XT (driver 32.0.32029.2010). - The 18 selected neighbouring MUBUF, attribute and e64 tests still pass on both adapters; `form_coverage_check.py` pins exactly the four forms. - Expected delta: **+4 forms on gfx1013 and +4 on gfx1030**. After the other open PRs and this one, the table reaches **1,733/1,968** gfx1013 and **1,635/1,863** gfx1030. ## Limits The cache invalidations are modelled only as the cacheless no-op; the scalar `s_dcache_inv`/`s_gl1_inv` scope is not claimed. Only the `p0` interpolation selector is lowered; `p10`/`p20` remain refused. The debug layer is unavailable on this host, and no console measurement was made. AI-assisted.
lukaslw-lab commented 2026-11-30 20:38:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-30T20:38:25Z.

Review: APPROVED


Reviewed 3da324bc by reading the diff; not built or run.

Verdict: approve. Both lowerings are right inside this profile. No MUST. The two SHOULDs tighten the argument and can follow.

  • SHOULD The no-op buffer_gl0_inv/buffer_gl1_inv reverses the explicit refusal from #1379 (tools/compute_store_aot.py:2825). The stated reason, that the profile "models no GL0/GL1 cache", is not what makes it safe: desktop D3D12 UAVs are cached too. It is safe because the profile reads through inputData (the SRV) and writes only u0, so no load can observe a store from another wave or group, and an invalidate has no visible effect. Please put that condition in the comment and in docs/experiments.md. A later change that adds loads from u0 would then have to revisit the no-op instead of inheriting it silently.
  • SHOULD v_interp_mov_f32 p0 reads a separate input, nointerpolation float4 flat0 : TEXCOORD1 (tools/pixel_aot.py:8821, :8849). It matches the guest only if the producer fills TEXCOORD1 with attr0 of the provoking vertex. The only producer is tests/pixel_aot_vs.hlsl, which sets it to constants (0.125, −0.25, 2, 4), while attr0 at vertex 0 is uv = (0, 0, 0.25, 1). So the draw shows that the right component of flat0 is read, not that p0 equals attr0. Please state the producer contract in the docstring/docs. Making the test VS write the provoking vertex's uv into flat, plus one program that reads both p0 and p1/p2 of the same component, would pin the relation.
  • Checked, no finding:
    • p10/p20 are refused with the selector named.
    • p0 shares the m0/mask/sample-overlap rules of p1/p2, and the exact operand regex keeps modifiers, clamp and omod out.
    • A malformed invalidation is refused by name.
    • The entry signature now drops uv when nothing reads it, in both export paths. The neighbouring draws you list cover that change.

Tests: the cache draw (six 320-word readbacks) shows the invalidations leave the stored words unchanged. The interp draw checks four flat words, with component and source mutations. The controls entry and the five new draws are not in the Windows pr preset filter. CI ran the LLVM fixture job and form_coverage_check.py; the draws have only your WARP + RX 9060 XT run.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6120145458 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3623#pullrequestreview-6120145458). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-30T20:38:25Z. **Review:** APPROVED --- Reviewed `3da324bc` by reading the diff; not built or run. **Verdict: approve.** Both lowerings are right inside this profile. No MUST. The two SHOULDs tighten the argument and can follow. - **SHOULD** The no-op `buffer_gl0_inv`/`buffer_gl1_inv` reverses the explicit refusal from #1379 (`tools/compute_store_aot.py:2825`). The stated reason, that the profile "models no GL0/GL1 cache", is not what makes it safe: desktop D3D12 UAVs are cached too. It is safe because the profile reads through `inputData` (the SRV) and writes only `u0`, so no load can observe a store from another wave or group, and an invalidate has no visible effect. Please put that condition in the comment and in `docs/experiments.md`. A later change that adds loads from `u0` would then have to revisit the no-op instead of inheriting it silently. - **SHOULD** `v_interp_mov_f32 p0` reads a separate input, `nointerpolation float4 flat0 : TEXCOORD1` (`tools/pixel_aot.py:8821`, `:8849`). It matches the guest only if the producer fills `TEXCOORD1` with attr0 of the provoking vertex. The only producer is `tests/pixel_aot_vs.hlsl`, which sets it to constants `(0.125, −0.25, 2, 4)`, while attr0 at vertex 0 is `uv = (0, 0, 0.25, 1)`. So the draw shows that the right component of `flat0` is read, not that p0 equals attr0. Please state the producer contract in the docstring/docs. Making the test VS write the provoking vertex's `uv` into `flat`, plus one program that reads both `p0` and `p1/p2` of the same component, would pin the relation. - Checked, no finding: - `p10`/`p20` are refused with the selector named. - `p0` shares the m0/mask/sample-overlap rules of `p1/p2`, and the exact operand regex keeps modifiers, clamp and omod out. - A malformed invalidation is refused by name. - The entry signature now drops `uv` when nothing reads it, in both export paths. The neighbouring draws you list cover that change. Tests: the cache draw (six 320-word readbacks) shows the invalidations leave the stored words unchanged. The interp draw checks four flat words, with component and source mutations. The `controls` entry and the five new draws are not in the Windows `pr` preset filter. CI ran the LLVM fixture job and `form_coverage_check.py`; the draws have only your WARP + RX 9060 XT run.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!3623
No description provided.