shader: lower mesh computed buffers, dynamic root counts, and spilled phis #558

Open
github-bot wants to merge 1 commit from github-bot/gh-554 into main AGit
Owner

@⁠Sheffy007 on GitHub · 2026-11-28 03:47 UTC · original
Sheffy007:feat/mesh-and-spilled-phi-descriptors → main · +745 −42 · 4 files · 1 commits · open

Summary

  • Enable computed_buffers for HwStage::Ms in resource::track_graphics (and keep computed_buffers consistent in emit_fast's structure::killing retry), matching the Metal mesh stage's zero-copy page-table binding.
  • Emit Source::BuiltMemory when computed_buffers is enabled and a 4-dword V# buffer descriptor is built around a non-VERTEX_TABLE RootType::Descriptor with a runtime num_records (w2), and set root_memory in Lower::new whenever Source::BuiltMemory is present so compute shaders expose the root descriptor's 64-bit title address.
  • Fold pure constant scalar ALU expressions (Tracer::const_u32) when classifying Source::Constant sampler words and Source::Built / Source::BuiltMemory control/count dwords.
  • Trace v_readlane_b32 of constant scratch VGPR lanes across VGPR phi joins in Tracer::phi and Tracer::collect_descriptor_loads, and propagate Val::Missing through multi-arm v_writelane_b32 spills (Lower::spill_missing) without polluting read_phis on the scratch VGPR.
  • Add unit tests in victory-shader and an end-to-end Metal GPU mesh test (a_mesh_program_loads_from_a_computed_buffer_descriptor_in_title_memory) reading 64-bit Pool memory with runtime num_records bounds checking.

Verification

  • cargo xtask policy
  • cargo test --locked -p victory-shader (423 lib + 5 sweep passed)
  • cargo test --locked -p victory-gpu --lib -- mesh_tests:: --test-threads=1 (24 passed on Metal)
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings
  • cargo clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-gnullvm -- -D warnings

Closes #556
Refs #258, #525

cc @⁠Olima34

**@⁠Sheffy007** on GitHub · 2026-11-28 03:47 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/554) `Sheffy007:feat/mesh-and-spilled-phi-descriptors` → `main` · +745 −42 · 4 files · 1 commits · open ## Summary - Enable `computed_buffers` for `HwStage::Ms` in `resource::track_graphics` (and keep `computed_buffers` consistent in `emit_fast`'s `structure::killing` retry), matching the Metal mesh stage's zero-copy page-table binding. - Emit `Source::BuiltMemory` when `computed_buffers` is enabled and a 4-dword V# buffer descriptor is built around a non-`VERTEX_TABLE` `RootType::Descriptor` with a runtime `num_records` (`w2`), and set `root_memory` in `Lower::new` whenever `Source::BuiltMemory` is present so compute shaders expose the root descriptor's 64-bit title address. - Fold pure constant scalar ALU expressions (`Tracer::const_u32`) when classifying `Source::Constant` sampler words and `Source::Built` / `Source::BuiltMemory` control/count dwords. - Trace `v_readlane_b32` of constant scratch VGPR lanes across VGPR `phi` joins in `Tracer::phi` and `Tracer::collect_descriptor_loads`, and propagate `Val::Missing` through multi-arm `v_writelane_b32` spills (`Lower::spill_missing`) without polluting `read_phis` on the scratch VGPR. - Add unit tests in `victory-shader` and an end-to-end Metal GPU mesh test (`a_mesh_program_loads_from_a_computed_buffer_descriptor_in_title_memory`) reading 64-bit `Pool` memory with runtime `num_records` bounds checking. ## Verification - `cargo xtask policy` - `cargo test --locked -p victory-shader` (423 lib + 5 sweep passed) - `cargo test --locked -p victory-gpu --lib -- mesh_tests:: --test-threads=1` (24 passed on Metal) - `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` - `cargo clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-gnullvm -- -D warnings` Closes #556 Refs #258, #525 cc @⁠Olima34
- Enable `computed_buffers` for `HwStage::Ms` in `resource::track_graphics` (and keep `computed_buffers` consistent in `emit_fast`'s `structure::killing` retry), matching the Metal mesh stage's zero-copy page-table binding.
- Emit `Source::BuiltMemory` when `computed_buffers` is enabled and a V# buffer descriptor is built around a non-`VERTEX_TABLE` `RootType::Descriptor` with a runtime `num_records`, and enable `root_memory` in `Lower::new` whenever `Source::BuiltMemory` is used.
- Fold pure constant scalar ALU chains (`Tracer::const_u32`) when classifying constant sampler dwords and built buffer control/count dwords.
- Follow `v_readlane_b32` of constant scratch VGPR lanes across VGPR `phi` joins in `Tracer::phi` and `Tracer::collect_descriptor_loads`, and propagate `Val::Missing` across multi-arm `v_writelane_b32` spills (`Lower::spill_missing`) without marking the scratch VGPR phi as a per-lane read.

Closes #552
Refs #258, #521
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 03:48:09 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/558/head:github-bot/gh-554'
git switch 'github-bot/gh-554'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-554'
git switch 'github-bot/gh-554'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-554'
git switch 'github-bot/gh-554'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-554'
git switch 'main'
git merge --squash 'github-bot/gh-554'
git switch 'main'
git merge --ff-only 'github-bot/gh-554'
git switch 'main'
git merge 'github-bot/gh-554'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.