gpu: a value test on Metal for computed compute buffers (#421) #426

Manually merged
github merged 1 commit from github-bot/gh-422 into main 2026-11-28 01:36:55 +00:00 AGit
Owner

@⁠tiagonogueiraa-bit on GitHub · 2026-11-27 17:36 UTC · original
tiagonogueiraa-bit:test-computed-compute-buffer → main · +53 −1 · 2 files · 1 commits · merged 2026-11-28 01:34 UTC

Refs #425

docs/native-host.md ("Computed compute buffers") said that path was only translation-tested: "no value test runs it on a GPU". This PR adds that test. It is test and docs only, with no translator or host change.

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

  • Path. It goes through the host's own path: shaders::translate of an FSPX container (pipeline::test_compute_container) whose root-constant record (root type 0, user data 0) reaches four user SGPRs. So constants_to_the_end and zero_copy_memory are exercised as in a run.
  • Program. Each lane builds a raw descriptor over s[0:1] + 16 (stride 0, control word 0x31014fac, bounds mode 3 with a byte count in dword 2), loads its dword by byte offset (buffer_load_dword ... offen) and stores it to dst[lane] with global_store_dword.
  • Address. The source address is above 4 GiB (VA_A), so the high bits go through the page table.
  • Results.
    • With 128 bytes, every lane reads its source dword.
    • With 64 bytes, lanes 16 and up read 0.

Learned while writing it. I first used control word 0x00014fac (bounds mode 0). With stride 0 every lane read 0, because mode 0 checks each offset against the stride. The docs now say so, next to the test's name.

Checks.

  • cargo test -p victory-shader -p victory-hle -p victory -p victory-gpu -p victory-metal -p xtask: 1054 passed, 0 failed, 11 ignored.
  • Windows clippy -D warnings: clean.
  • cargo xtask policy: ok.
**@⁠tiagonogueiraa-bit** on GitHub · 2026-11-27 17:36 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/422) `tiagonogueiraa-bit:test-computed-compute-buffer` → `main` · +53 −1 · 2 files · 1 commits · merged 2026-11-28 01:34 UTC Refs #425 `docs/native-host.md` ("Computed compute buffers") said that path was only translation-tested: "no value test runs it on a GPU". This PR adds that test. It is test and docs only, with no translator or host change. **Test.** `addr_tests::a_compute_buffer_descriptor_around_a_computed_address_loads_title_memory` (`victory-gpu`, on Metal with MSC 4.0 beta 3). - **Path.** It goes through the host's own path: `shaders::translate` of an FSPX container (`pipeline::test_compute_container`) whose root-constant record (root type 0, user data 0) reaches four user SGPRs. So `constants_to_the_end` and `zero_copy_memory` are exercised as in a run. - **Program.** Each lane builds a raw descriptor over `s[0:1] + 16` (stride 0, control word `0x31014fac`, bounds mode 3 with a byte count in dword 2), loads its dword by byte offset (`buffer_load_dword ... offen`) and stores it to `dst[lane]` with `global_store_dword`. - **Address.** The source address is above 4 GiB (`VA_A`), so the high bits go through the page table. - **Results.** - With 128 bytes, every lane reads its source dword. - With 64 bytes, lanes 16 and up read 0. **Learned while writing it.** I first used control word `0x00014fac` (bounds mode 0). With stride 0 every lane read 0, because mode 0 checks each offset against the stride. The docs now say so, next to the test's name. **Checks.** - `cargo test -p victory-shader -p victory-hle -p victory -p victory-gpu -p victory-metal -p xtask`: 1054 passed, 0 failed, 11 ignored. - Windows clippy `-D warnings`: clean. - `cargo xtask policy`: ok.
docs/native-host.md said the compute path for a buffer descriptor built
around a computed address was only translation-tested. The new test
goes through the host's own translation of an FSPX container whose root
constants hold a title address above 4 GiB. It builds a raw descriptor
(bounds mode 3) over that address plus 16 and loads per lane by byte
offset on Metal. Each lane reads its dword of title memory, and past the
byte count 0. The docs now name the test, and note that bounds mode 0
with stride 0 reads 0 everywhere.

Refs #421
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 17:39:15 +00:00
github manually merged commit 5279c9a0a1 into main 2026-11-28 01:36:55 +00:00
Author
Owner

@⁠Olima34 on GitHub · 2026-11-28 01:34 UTC · original · approved these changes

Check report (helping the maintainer clear the queue):

  • CI: check and macos-scripts green on the current head.
  • Read: the whole diff (test and docs only). It's a Metal value test of a compute buffer descriptor built around a root-constant address above 4 GiB, through the host's own translation, with a byte count that cuts lanes off. The docs now name it instead of saying no value test exists. The program is synthetic.
  • Local check: current main (226645f9) merged with this PR and the other test/docs/tools PRs we're landing in this batch (#401 #403 #426 #471 #475 #479 #483 #485 #490 #493 #498 #502 #509 #515). On it, the victory-gpu (arm64), victory-shader, victory-backend, victory-metal and victory tests pass, as do the macOS script tests (rustup-path.sh, run-summary-compare.sh, run-summary.sh --self-test), Windows clippy (-D warnings) and cargo xtask policy. One victory-gpu run in four failed main's own multi_mip_array_and_placed_depth_twins_preserve_all_subresources_and_remirror_immediately. That test also flakes on main alone, so it isn't from this batch.
  • Not checked: no game run (the maintainer asked us to work on GitHub only).

Thanks @⁠tiagonogueiraa-bit!

**@⁠Olima34** on GitHub · 2026-11-28 01:34 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/422#pullrequestreview-6094918916) · **approved these changes** Check report (helping the maintainer clear the queue): - **CI:** `check` and `macos-scripts` green on the current head. - **Read:** the whole diff (test and docs only). It's a Metal value test of a compute buffer descriptor built around a root-constant address above 4 GiB, through the host's own translation, with a byte count that cuts lanes off. The docs now name it instead of saying no value test exists. The program is synthetic. - **Local check:** current main (226645f9) merged with this PR and the other test/docs/tools PRs we're landing in this batch (#401 #403 #426 #471 #475 #479 #483 #485 #490 #493 #498 #502 #509 #515). On it, the `victory-gpu` (arm64), `victory-shader`, `victory-backend`, `victory-metal` and `victory` tests pass, as do the macOS script tests (`rustup-path.sh`, `run-summary-compare.sh`, `run-summary.sh --self-test`), Windows clippy (`-D warnings`) and `cargo xtask policy`. One `victory-gpu` run in four failed main's own `multi_mip_array_and_placed_depth_twins_preserve_all_subresources_and_remirror_immediately`. That test also flakes on main alone, so it isn't from this batch. - **Not checked:** no game run (the maintainer asked us to work on GitHub only). Thanks @⁠tiagonogueiraa-bit!
This discussion has been locked. Commenting is limited to contributors.
No description provided.