test: increase pool sizes for 16KB pages on Apple Silicon #48

Closed
ShivamCodesBS wants to merge 2 commits from upstream-pr/48 into main
ShivamCodesBS commented 2026-11-26 11:20:58 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by ShivamCodesBS on 2026-11-26T11:20:58Z.


Test pools were created with 4-8 pages assuming 4KB pages, but Apple Silicon uses 16KB pages on both arm64 and x86_64 (Rosetta). This caused tests to access memory past the pool boundary at offsets like 16KB, 32KB, etc.

Fix: increase pool pages from 4→8/16 and 2→8 across all native test files:

  • victory-gpu/src/native/tests.rs: 4 tests
  • victory-gpu/src/native/texture_tests.rs: 7 tests
  • victory-gpu/src/native/title_tests.rs: 6 tests
  • victory-metal/tests/resources.rs: 2 tests
  • victory-metal/tests/render.rs: 1 test

All tests now pass on x86_64-apple-darwin (Rosetta) with 16KB pages.

What this changes

How it was tested

  • cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings
  • Ran the game (say how far it got), or not needed

Checklist

  • No game files, game code, disassembly listings or SDK files are included
  • Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md
  • New diagnostics are behind a VICTORY_* variable and documented
<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:5509095247 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/48). Originally posted by [ShivamCodesBS](https://github.com/ShivamCodesBS) on 2026-11-26T11:20:58Z. --- Test pools were created with 4-8 pages assuming 4KB pages, but Apple Silicon uses 16KB pages on both arm64 and x86_64 (Rosetta). This caused tests to access memory past the pool boundary at offsets like 16KB, 32KB, etc. Fix: increase pool pages from 4→8/16 and 2→8 across all native test files: - victory-gpu/src/native/tests.rs: 4 tests - victory-gpu/src/native/texture_tests.rs: 7 tests - victory-gpu/src/native/title_tests.rs: 6 tests - victory-metal/tests/resources.rs: 2 tests - victory-metal/tests/render.rs: 1 test All tests now pass on x86_64-apple-darwin (Rosetta) with 16KB pages. ## What this changes <!-- One change per pull request. Link the issue or ROADMAP item. --> ## How it was tested - [ ] `cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory` - [ ] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` - [ ] Ran the game (say how far it got), or not needed ## Checklist - [ ] No game files, game code, disassembly listings or SDK files are included - [ ] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md - [ ] New diagnostics are behind a `VICTORY_*` variable and documented
LakshanSivakumar commented 2026-11-26 11:42:46 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T11:42:46Z.

Review: CHANGES_REQUESTED


Thanks for catching the descriptor-table arena. Could you narrow this to that fix?

  • The victory-gpu pool changes duplicate #23. Main already sizes those pools with page_size().max(16384).
  • For victory-metal/tests/resources.rs, please derive the page count from the two 16 KiB buffers and the reported page size, instead of a fixed 8 pages (that's 128 KiB on arm64).

A short note on Rosetta's 4 KiB reported page size in docs/native-host.md would help too.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:review:6073546777 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/48#pullrequestreview-6073546777). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T11:42:46Z. **Review:** CHANGES_REQUESTED --- Thanks for catching the descriptor-table arena. Could you narrow this to that fix? - The victory-gpu pool changes duplicate #23. Main already sizes those pools with `page_size().max(16384)`. - For `victory-metal/tests/resources.rs`, please derive the page count from the two 16 KiB buffers and the reported page size, instead of a fixed 8 pages (that's 128 KiB on arm64). A short note on Rosetta's 4 KiB reported page size in `docs/native-host.md` would help too.
LakshanSivakumar commented 2026-11-26 12:01:48 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T12:01:48Z.

Review: CHANGES_REQUESTED


Thanks for catching the arena bounds failure. Please keep this PR to srv_and_uav_through_a_descriptor_table, size its arena from the two 16 KiB buffers and the reported page size (rather than a hard-coded eight pages), and add a sentence to the existing Rosetta alignment note in docs/native-host.md (~237). The GPU test helpers on main already clamp the allocation unit to 16 KiB, so the other pool increases aren't needed.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:review:6073789151 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/48#pullrequestreview-6073789151). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T12:01:48Z. **Review:** CHANGES_REQUESTED --- Thanks for catching the arena bounds failure. Please keep this PR to `srv_and_uav_through_a_descriptor_table`, size its arena from the two 16 KiB buffers and the reported page size (rather than a hard-coded eight pages), and add a sentence to the existing Rosetta alignment note in `docs/native-host.md` (~237). The GPU test helpers on main already clamp the allocation unit to 16 KiB, so the other pool increases aren't needed.
LakshanSivakumar commented 2026-11-26 12:10:08 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T12:10:08Z.

Review: CHANGES_REQUESTED


Thanks for deriving the descriptor-table arena size from the reported page size; that part is right. Please keep that fix and revert the other GPU and Metal arena changes still in the diff (native/tests.rs, texture_tests.rs, title_tests.rs, victory-metal/tests/render.rs, and texture_over_zero_copy_memory in resources.rs). Move the docs into the existing Rosetta alignment note in docs/native-host.md (~239) as one sentence explaining that two reported 4 KiB pages cannot hold the two 16 KiB buffers. Note that the 16 KiB clamp lives in the GPU test helpers, not victory-metal::mem (which returns sysconf(_SC_PAGESIZE) directly).

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:review:6073894140 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/48#pullrequestreview-6073894140). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T12:10:08Z. **Review:** CHANGES_REQUESTED --- Thanks for deriving the descriptor-table arena size from the reported page size; that part is right. Please keep that fix and revert the other GPU and Metal arena changes still in the diff (`native/tests.rs`, `texture_tests.rs`, `title_tests.rs`, `victory-metal/tests/render.rs`, and `texture_over_zero_copy_memory` in `resources.rs`). Move the docs into the existing Rosetta alignment note in `docs/native-host.md` (~239) as one sentence explaining that two reported 4 KiB pages cannot hold the two 16 KiB buffers. Note that the 16 KiB clamp lives in the GPU test helpers, not `victory-metal::mem` (which returns `sysconf(_SC_PAGESIZE)` directly).
LakshanSivakumar commented 2026-11-26 14:55:10 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T14:55:10Z.


Superseded by #77 (same fix, current with main). Closing; please carry the remaining asks there.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7195522087 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/48#issuecomment-7195522087). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T14:55:10Z. --- Superseded by #77 (same fix, current with main). Closing; please carry the remaining asks there.

Pull request closed

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
LakshanSivakumar/Native-Victory-macOS!48
No description provided.