shader: lower buffer_load_format_x in mesh EXECZ skips and element zero (Part of #3703) #3720

Merged
timbot103 merged 1 commit from upstream-pr/3720 into main 2026-12-01 11:20:43 +00:00
timbot103 commented 2026-12-01 10:53:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-01T10:53:03Z.


Refs #3703.

Summary

Lowers buffer_load_format_x inside open EXECZ skips and for unindexed literal element zero in the C++ mesh frontend (src/gfx1013_direct_mesh.inl):

  • Open EXEC skips & element zero: Admits buffer_load_format_x (i.op == 0) when (full_exec || exec_skip) and addressing is either idxen (0x2000) or unindexed literal element zero (0x0000, already accepted by decode()). When idxen is clear, emits index 0 without reading vaddr.
  • Lane & uniformity soundness:
    • Records partial_writes when !full_exec so pre-skip VGPR values are preserved via select/phi and fresh destinations under a lane count retain value_limits.
    • Propagates uniform_values under full_exec and active_uniform under whole_wave_execution() && !branch only when uniform(index) == index.
    • Guards group_uniform propagation for buffer_load_format on full_exec so a lane-masked select cannot be marked group-uniform.
    • Rejects descriptor bases past SGPR 105 (base + 4 > 106).
  • Fail-closed controls: Keeps narrowed EXEC without an enclosing s_cbranch_execz, non-heap table descriptors, multi-channel buffer_load_format_xy/xyz/xyzw, non-zero offsets, per-lane v_readfirstlane_b32, and unmasked reads of lane-bounded destinations strictly refused.

Verification

Windows 11 (26200), MSVC 19.44, Ninja, Windows SDK 10.0.26100. Source-built tests only; added positive cases (element-0, per-lane skip preserve, whole-wave lane-limit skip + readfirstlane, SAVEEXEC then arm, heap_tokens inside skip) and negative controls in tests/native_direct_mesh_check.py.

  • Debug (dev preset):
    • ctest --preset dev --no-tests=error -R '^native_direct_|^startup_mesh57_real_shape$|^startup_mesh57_execz_diagnostics$' -V -> 4/4 passed (native_direct_container, native_direct_mesh, startup_mesh57_execz_diagnostics, startup_mesh57_real_shape)
  • Release (release preset):
    • ctest --preset release --no-tests=error -R '^native_direct_|^startup_mesh57_real_shape$|^startup_mesh57_execz_diagnostics$' -V -> 4/4 passed
  • git diff --check HEAD^ HEAD clean.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5584195300 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3720). Originally posted by [timbot103](https://github.com/timbot103) on 2026-12-01T10:53:03Z. --- Refs #3703. ## Summary Lowers `buffer_load_format_x` inside open `EXECZ` skips and for unindexed literal element zero in the C++ mesh frontend (`src/gfx1013_direct_mesh.inl`): - **Open EXEC skips & element zero:** Admits `buffer_load_format_x` (`i.op == 0`) when `(full_exec || exec_skip)` and addressing is either `idxen` (`0x2000`) or unindexed literal element zero (`0x0000`, already accepted by `decode()`). When `idxen` is clear, emits index `0` without reading `vaddr`. - **Lane & uniformity soundness:** - Records `partial_writes` when `!full_exec` so pre-skip VGPR values are preserved via `select`/`phi` and fresh destinations under a lane count retain `value_limits`. - Propagates `uniform_values` under `full_exec` and `active_uniform` under `whole_wave_execution() && !branch` only when `uniform(index) == index`. - Guards `group_uniform` propagation for `buffer_load_format` on `full_exec` so a lane-masked `select` cannot be marked group-uniform. - Rejects descriptor bases past SGPR 105 (`base + 4 > 106`). - **Fail-closed controls:** Keeps narrowed EXEC without an enclosing `s_cbranch_execz`, non-heap table descriptors, multi-channel `buffer_load_format_xy/xyz/xyzw`, non-zero offsets, per-lane `v_readfirstlane_b32`, and unmasked reads of lane-bounded destinations strictly refused. ## Verification Windows 11 (26200), MSVC 19.44, Ninja, Windows SDK 10.0.26100. Source-built tests only; added positive cases (element-0, per-lane skip preserve, whole-wave lane-limit skip + `readfirstlane`, `SAVEEXEC` then arm, `heap_tokens` inside skip) and negative controls in `tests/native_direct_mesh_check.py`. - **Debug (`dev` preset):** - `ctest --preset dev --no-tests=error -R '^native_direct_|^startup_mesh57_real_shape$|^startup_mesh57_execz_diagnostics$' -V` -> **4/4 passed** (`native_direct_container`, `native_direct_mesh`, `startup_mesh57_execz_diagnostics`, `startup_mesh57_real_shape`) - **Release (`release` preset):** - `ctest --preset release --no-tests=error -R '^native_direct_|^startup_mesh57_real_shape$|^startup_mesh57_execz_diagnostics$' -V` -> **4/4 passed** - `git diff --check HEAD^ HEAD` clean. AI-assisted.
R0Y00 commented 2026-12-01 11:20:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-01T11:20:39Z.

Review: APPROVED


Reviewed the indexed and literal-zero paths and EXEC skip bookkeeping. Integrated native_direct_mesh passed locally, including positive and refusal cases.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6130198440 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3720#pullrequestreview-6130198440). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-01T11:20:39Z. **Review:** APPROVED --- Reviewed the indexed and literal-zero paths and EXEC skip bookkeeping. Integrated native_direct_mesh passed locally, including positive and refusal cases.
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!3720
No description provided.