gpu: a value test on Metal for indexed table buffers without a stride (#424) #429

Open
github-bot wants to merge 2 commits from github-bot/gh-425 into main AGit
Owner

@⁠tiagonogueiraa-bit on GitHub · 2026-11-27 17:38 UTC · original
tiagonogueiraa-bit:test-indexed-table-buffer → main · +68 −1 · 2 files · 2 commits · open

Refs #428

docs/native-host.md ("Indexed table buffers without a stride") said the path was translation-tested only: "no GPU value test". This PR adds the test. It is test and docs only, with no translator or host change.

Test. heap_tests::an_indexed_load_through_a_table_buffer_without_a_stride_reads_its_elements (victory-gpu, on Metal with MSC 4.0 beta 3).

  • Path. It goes through shaders::translate of an FSPX container with two table records: an SRV (kind 0, user data 0) whose record gives no stride, and a raw UAV (kind 3, user data 1).
  • Views. Heap entry 0 is a placed structured SRV of 32 elements of 8 bytes, made with create_placed_srv as the title makes them. Entry 2 is a placed raw UAV.
  • Program. Each lane loads dword 1 of element lane (buffer_load_dword ... idxen offset:4) and stores it to dword lane of the UAV. Each element is [0xdead0000 | i, 1000 + i].
  • Results. The UAV reads 1000 + i in every lane, so the element size (8) came from the view-stride table. A wrong stride would read other dwords, and a null view would read 0. The test also checks unset_roots and failed are 0.

Checks.

  • cargo test -p victory-shader -p victory-hle -p victory -p victory-gpu -p victory-metal -p xtask: all passed, 0 failed.
  • Windows clippy -D warnings: clean.
  • cargo xtask policy: ok.
**@⁠tiagonogueiraa-bit** on GitHub · 2026-11-27 17:38 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/425) `tiagonogueiraa-bit:test-indexed-table-buffer` → `main` · +68 −1 · 2 files · 2 commits · open Refs #428 `docs/native-host.md` ("Indexed table buffers without a stride") said the path was translation-tested only: "no GPU value test". This PR adds the test. It is test and docs only, with no translator or host change. **Test.** `heap_tests::an_indexed_load_through_a_table_buffer_without_a_stride_reads_its_elements` (`victory-gpu`, on Metal with MSC 4.0 beta 3). - **Path.** It goes through `shaders::translate` of an FSPX container with two table records: an SRV (kind 0, user data 0) whose record gives no stride, and a raw UAV (kind 3, user data 1). - **Views.** Heap entry 0 is a placed structured SRV of 32 elements of 8 bytes, made with `create_placed_srv` as the title makes them. Entry 2 is a placed raw UAV. - **Program.** Each lane loads dword 1 of element `lane` (`buffer_load_dword ... idxen offset:4`) and stores it to dword `lane` of the UAV. Each element is `[0xdead0000 | i, 1000 + i]`. - **Results.** The UAV reads `1000 + i` in every lane, so the element size (8) came from the view-stride table. A wrong stride would read other dwords, and a null view would read 0. The test also checks `unset_roots` and `failed` are 0. **Checks.** - `cargo test -p victory-shader -p victory-hle -p victory -p victory-gpu -p victory-metal -p xtask`: all passed, 0 failed. - Windows clippy `-D warnings`: clean. - `cargo xtask policy`: ok.
docs/native-host.md said the stride-less table buffer path (the element
size taken from the view-stride table) had no GPU value test. The new
test goes through the host's translation of an FSPX container whose
table SRV record gives no stride. It places a structured SRV of 8-byte
elements and reads dword 1 of element `lane` by index into a raw UAV in a
second table. The docs now name it.

Refs #424
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 17:39:17 +00:00
Author
Owner

@⁠Olima34 on GitHub · 2026-11-28 00:37 UTC · original · requested changes

Thanks for this PR! We're helping the maintainer clear the queue tonight, and main has moved a lot (the preview branch landed as 86cefd22, then a batch of PRs; main is now a6a58361). This branch now conflicts with main in crates/victory-gpu/src/native/heap_tests.rs.

Could you merge current main into the branch (a merge commit is fine, no need to rebase) and resolve the conflict? It looks like tests appended at the same spot as tests that landed on main; keep both sides. Once GitHub shows it as mergeable and CI is green on the new head, we'll read it through and merge it if it holds up.

**@⁠Olima34** on GitHub · 2026-11-28 00:37 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/425#pullrequestreview-6094669190) · **requested changes** Thanks for this PR! We're helping the maintainer clear the queue tonight, and main has moved a lot (the preview branch landed as 86cefd22, then a batch of PRs; main is now a6a58361). This branch now conflicts with main in `crates/victory-gpu/src/native/heap_tests.rs`. Could you merge current `main` into the branch (a merge commit is fine, no need to rebase) and resolve the conflict? It looks like tests appended at the same spot as tests that landed on main; keep both sides. Once GitHub shows it as mergeable and CI is green on the new head, we'll read it through and merge it if it holds up.
# Conflicts:
#	crates/victory-gpu/src/native/heap_tests.rs
#	docs/native-host.md
Author
Owner

@⁠tiagonogueiraa-bit on GitHub · 2026-11-28 10:01 UTC · original

Merged current main (26817285) into the branch with a merge commit. In heap_tests.rs I kept both sides. In native-host.md, I kept main's "Computed compute buffers" bullet (from #426) and this branch's "Indexed table buffers" bullet. On the merged head: cargo test -p victory-shader -p victory-hle -p victory -p victory-gpu -p victory-metal -p xtask gives 1133 passed and 0 failed, and Windows clippy and policy are clean.

**@⁠tiagonogueiraa-bit** on GitHub · 2026-11-28 10:01 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/425#issuecomment-7237624160) Merged current `main` (`26817285`) into the branch with a merge commit. In `heap_tests.rs` I kept both sides. In `native-host.md`, I kept main's "Computed compute buffers" bullet (from #426) and this branch's "Indexed table buffers" bullet. On the merged head: `cargo test -p victory-shader -p victory-hle -p victory -p victory-gpu -p victory-metal -p xtask` gives 1133 passed and 0 failed, and Windows clippy and policy are clean.
Author
Owner

@⁠buddybot89 on GitHub · 2026-11-28 15:26 UTC · original

At 482ead4, on an M2 Ultra (64 GB, macOS 26.7.1) with Apple's Metal Shader Converter 4.0.3: an_indexed_load_through_a_table_buffer_without_a_stride_reads_its_elements passed (1 passed, 0 failed).

**@⁠buddybot89** on GitHub · 2026-11-28 15:26 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/425#issuecomment-7241462888) At `482ead4`, on an M2 Ultra (64 GB, macOS 26.7.1) with Apple's Metal Shader Converter 4.0.3: `an_indexed_load_through_a_table_buffer_without_a_stride_reads_its_elements` passed (1 passed, 0 failed).
This pull request can be merged automatically.
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/429/head:github-bot/gh-425'
git switch 'github-bot/gh-425'

Merge

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