Tests: views off their elements are placed from a window's start (flaky in one run in twenty) #785

Manually merged
github merged 1 commit from github-bot/gh-785 into main 2026-11-29 08:21:50 +00:00 AGit
Owner

@⁠kibagami-nc on GitHub · 2026-11-28 05:52 UTC · original
kibagami-nc:test/views-off-elements-from-a-window-start → main · +9 −2 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC

descriptor::host::tests::views_off_their_elements_get_a_copy_of_their_bytes fails on main in about one run in twenty. Its structured view gets a 4 MiB buffer instead of a copy of its own bytes:

panicked at crates\victory-gpu\src\descriptor\host.rs:6212:13:
assertion `left == right` failed
  left: 4194304
 right: 2048

Here it failed 4 times in 79 runs of the test alone. It also failed once in a whole cargo test --workspace --locked run on 63b902f.

Why

  • The test's memory is loose memory (a vector), so its host copy is the 4 MiB window over it (crate::shadow). Whether a view is "off its elements" depends on where it lies in that copy (view_home, then off_elements).
  • The test placed its views from the first page start inside a 64 KiB vector. The 456-byte structured view at +8 then lay at k * 4096 + 8 in its window, where k is the page's index in the window.
  • That offset is a multiple of 456 whenever k ≡ 1 (mod 57). In those runs the view is on its elements, so it takes the window, which is right for the code but not what the test expects.
  • k depends on where the allocator put the vector, so the test failed at random.

The change

  • The memory is now 8 MiB, and the views are placed from a 4 MiB line. Each view then lies exactly its offset into its window: +8 is off its elements for both views, and +16 and +32 are on them, as the test means.
  • A line aligned to 4 MiB is aligned on any smaller window grid too (VICTORY_WINDOW_KB).
  • Only the test changes.

Tests

run main this branch
the test alone 4 failures in 79 runs 0 failures in 60 runs
cargo test -p victory-gpu --lib --locked failed once in a workspace run 4 of 4 runs pass (453 passed)

Clippy (default and --all-features) shows nothing in the changed file. Main's own lints are in #665.

**@⁠kibagami-nc** on GitHub · 2026-11-28 05:52 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/785) `kibagami-nc:test/views-off-elements-from-a-window-start` → `main` · +9 −2 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC `descriptor::host::tests::views_off_their_elements_get_a_copy_of_their_bytes` fails on `main` in about one run in twenty. Its structured view gets a 4 MiB buffer instead of a copy of its own bytes: ``` panicked at crates\victory-gpu\src\descriptor\host.rs:6212:13: assertion `left == right` failed left: 4194304 right: 2048 ``` Here it failed 4 times in 79 runs of the test alone. It also failed once in a whole `cargo test --workspace --locked` run on `63b902f`. ## Why - The test's memory is loose memory (a vector), so its host copy is the 4 MiB window over it (`crate::shadow`). Whether a view is "off its elements" depends on where it lies in that copy (`view_home`, then `off_elements`). - The test placed its views from the first page start inside a 64 KiB vector. The 456-byte structured view at `+8` then lay at `k * 4096 + 8` in its window, where `k` is the page's index in the window. - That offset is a multiple of 456 whenever `k ≡ 1 (mod 57)`. In those runs the view is on its elements, so it takes the window, which is right for the code but not what the test expects. - `k` depends on where the allocator put the vector, so the test failed at random. ## The change - The memory is now 8 MiB, and the views are placed from a 4 MiB line. Each view then lies exactly its offset into its window: `+8` is off its elements for both views, and `+16` and `+32` are on them, as the test means. - A line aligned to 4 MiB is aligned on any smaller window grid too (`VICTORY_WINDOW_KB`). - Only the test changes. ## Tests | run | `main` | this branch | |---|---|---| | the test alone | 4 failures in 79 runs | 0 failures in 60 runs | | `cargo test -p victory-gpu --lib --locked` | failed once in a workspace run | 4 of 4 runs pass (453 passed) | Clippy (default and `--all-features`) shows nothing in the changed file. Main's own lints are in #665.
views_off_their_elements_get_a_copy_of_their_bytes failed in about one
run in twenty on main (4 of 79 runs of it alone, and one whole
workspace run): its structured view got a 4 MiB buffer, not a copy of
its own 1,824 bytes.

The host copy of the test's memory is the 4 MiB window over it, and a
view is off its elements by where it lies in that copy (view_home,
off_elements). The test placed its views from the first page start in
a 64 KiB vector: the structured view at +8 then lay at k * 4096 + 8 in
its window, a multiple of its 456-byte elements whenever k is 1 modulo
57. Where the allocator put the vector decided k, and in those runs the
view took the window.

The memory is now 8 MiB and the views are placed from a 4 MiB line, so
each lies exactly its offset into the window. With that, 60 runs of the
test alone and four runs of the whole library all passed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 05:54:54 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-28 07:13 UTC · original · approved these changes

Tested locally merged onto main (63b902f).

  • Merge & Policy: Clean merge; cargo xtask policy passed (294 files ok).
  • Tests (RTX 5090): cargo test -p victory-gpu --lib descriptor:: passed (62 passed; 0 failed, including views_off_their_elements_are_told and views_off_their_elements_get_a_copy_of_their_bytes) with 0 compiler warnings.

Clean test placement fix anchoring the unaligned view from the window start. LGTM.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-28 07:13 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/785#pullrequestreview-6096435057) · **approved these changes** Tested locally merged onto `main` (`63b902f`). - **Merge & Policy**: Clean merge; `cargo xtask policy` passed (`294 files ok`). - **Tests (RTX 5090)**: `cargo test -p victory-gpu --lib descriptor::` passed (`62 passed; 0 failed`, including `views_off_their_elements_are_told` and `views_off_their_elements_get_a_copy_of_their_bytes`) with 0 compiler warnings. Clean test placement fix anchoring the unaligned view from the window start. LGTM. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
github manually merged commit 703c74658b into main 2026-11-29 08:21:50 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!785
No description provided.