Skip to content

Tests: four races, the BCPack oracle, the shader key's stale names, and a loop-latch test - #3061

Open
Adriwin06 wants to merge 3 commits into
trustno1-coder:mainfrom
Adriwin06:tests-races-and-key
Open

Adriwin06 wants to merge 3 commits into
trustno1-coder:mainfrom
Adriwin06:tests-races-and-key

Conversation

@Adriwin06

Copy link
Copy Markdown

What it changes

3 small changes of the same kind, one commit each, so each can be reviewed, reverted or left out on its own:

Tests: four races, a timing test on WARP and the BCPack oracle, which fail on main or on a busy runner

  • rangelock: the reader test slept 50 ms and assumed the writer thread
    had announced its range by then. It now waits (up to 5 s) until
    state().writing shows the range, so a late-scheduled writer no
    longer fails it.
  • card_steps: the two late tests gave their memory back, and the
    other test could be handed the same pages and find them already
    learned (late has no forgetting) before it learned anything. The
    memory is now leaked (std::mem::forget) so it is never another
    test's.
  • card_steps: shared_scratch_eliminates_flight_settle_end_to_end times
    a hardware GPU; on a software adapter (WARP) it now says so and
    returns. The root-constants test still covers the fill path.
  • menu: the tests that set or clear VICTORY_MENU_FILE / VICTORY_HOME
    hold one MENU_ENV mutex, since the save note reads both and two such
    tests at once saw each other's.
  • watch: the late-fault test keeps the guard lock from queuing the
    entry through its pre-settle assertions and settles it itself, so
    another test taking the lock cannot drain the entry first.
  • bcpack: the test oracle skipped a u16 and read 31 index slots; the
    word after the widths is pixel 0's index and all 32 slots are read
    in order, the same layout as Tables::builtin (f9de61c).

Shader cache: the key's test lists only switches the translator still reads (#479's revert)

1b4b6cd restored the GPU side of the reverted #479 and with it five
switch names in shader_cache: VICTORY_SCALAR_SPLITS in KEYED, and the
differential fuzzer's VICTORY_ORACLE_RUNS, _SEED, _AVOID and _OUT in the
test's NOT_TRANSLATION list. The translator's side and oracle_tests.rs
stayed reverted, so nothing in victory-shader reads any of the five:
the key took a value that changes no translation, and
shader_cache::tests::every_switch_of_the_translator_is_in_the_key fails
on main ("VICTORY_SCALAR_SPLITS is not read by the translator any
more"). The five are taken out; they go back with #479's shader side.

Shaders: a test that a block closing two loops keeps one back edge

The empty-latch fold leaves a block that is already another loop's
latch alone, since it would get two back edges, which
single_back_edges took apart for vkd3d-proton's dxil-spirv. Says so
where the fold is decided and adds a test for it.

Test: bitcode::tests::a_block_that_closes_two_loops_gets_one_back_edge.

From DoubleGhosty/cool_fox@f7d5b50 (Hasusmogus), GPL-3.0-or-later.

How it was tested

  • GPU and profile: n/a, tests only (run on an RTX 4070 SUPER and on WARP)
  • For shader changes, the wave sizes tested: the unit tests named in each commit (32- and 64-lane programs where they translate both)
  • cargo test passed for the crates it touches:
    • test-races: yes, cargo test -p victory-formats --lib -- bcpack: 15 passed (main fails 3 oracle_parity tests); cargo test -p victory-gpu --lib -- rangelock:: card_steps:: host::menu:: watch::: 97 passed, three runs in a row
    • shader-key-scalar-splits: yes, cargo test -p victory-gpu --lib -- shader_cache::: 11 passed (main fails every_switch_of_the_translator_is_in_the_key; this passes it)
    • loop-latch-test: yes, cargo test -p victory-shader --lib -- bitcode::tests::a_block_that_closes: 1 passed
  • cargo clippy --workspace --all-targets --locked: no finding that main does not already have (main has 34 of its own, which is why the Clippy step of CI is red on main itself).
  • cargo xtask policy: no new finding (main fails it on crates/victory-loader/src/heap_sites/frame_users.rs).
  • With all eleven of my pull requests merged together: cargo clippy also with --all-features adds no finding, and cargo test --workspace --locked fails only tests main also fails on this machine: the five shader tests that fail on main here too (WARP's SM 6.2 and the validator) (barycentric_tests::first_half_values_render_on_hardware_and_warp, hw_tests::split_lds_wave32_read_after_read_barrier_coalescing_and_parity, intersect_tests::flat_global_stores_and_atomics_fence_uavs_at_group_barriers_across_waves, rect::tests::rectangles_are_drawn_whole, rect::tests::the_rectangle_stage_is_a_geometry_shader) and xtask's repository_passes_policy (frame_users.rs). 2208 passed, including five that fail on main (three BCPack oracle tests, the menu save race, the shader key test).

Checked for overlap

🤖 Generated with Claude Code

Adriwin06 and others added 3 commits November 29, 2026 20:28
… fail on main or on a busy runner

- rangelock: the reader test slept 50 ms and assumed the writer thread
  had announced its range by then. It now waits (up to 5 s) until
  `state().writing` shows the range, so a late-scheduled writer no
  longer fails it.
- card_steps: the two `late` tests gave their memory back, and the
  other test could be handed the same pages and find them already
  learned (`late` has no forgetting) before it learned anything. The
  memory is now leaked (`std::mem::forget`) so it is never another
  test's.
- card_steps: shared_scratch_eliminates_flight_settle_end_to_end times
  a hardware GPU; on a software adapter (WARP) it now says so and
  returns. The root-constants test still covers the fill path.
- menu: the tests that set or clear VICTORY_MENU_FILE / VICTORY_HOME
  hold one MENU_ENV mutex, since the save note reads both and two such
  tests at once saw each other's.
- watch: the late-fault test keeps the guard lock from queuing the
  entry through its pre-settle assertions and settles it itself, so
  another test taking the lock cannot drain the entry first.
- bcpack: the test oracle skipped a u16 and read 31 index slots; the
  word after the widths is pixel 0's index and all 32 slots are read
  in order, the same layout as `Tables::builtin` (f9de61c).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… reads (trustno1-coder#479's revert)

1b4b6cd restored the GPU side of the reverted trustno1-coder#479 and with it five
switch names in shader_cache: VICTORY_SCALAR_SPLITS in KEYED, and the
differential fuzzer's VICTORY_ORACLE_RUNS, _SEED, _AVOID and _OUT in the
test's NOT_TRANSLATION list. The translator's side and oracle_tests.rs
stayed reverted, so nothing in victory-shader reads any of the five:
the key took a value that changes no translation, and
shader_cache::tests::every_switch_of_the_translator_is_in_the_key fails
on main ("VICTORY_SCALAR_SPLITS is not read by the translator any
more"). The five are taken out; they go back with trustno1-coder#479's shader side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The empty-latch fold leaves a block that is already another loop's
latch alone, since it would get two back edges, which
single_back_edges took apart for vkd3d-proton's dxil-spirv. Says so
where the fold is decided and adds a test for it.

Test: bitcode::tests::a_block_that_closes_two_loops_gets_one_back_edge.

From DoubleGhosty/cool_fox@f7d5b50 (Hasusmogus), GPL-3.0-or-later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 29, 2026 19:52
@github-actions github-actions Bot added the pr-tests Pull request: tests only label Nov 29, 2026
@github-actions github-actions Bot changed the title [pr-tests] Tests: four races, the BCPack oracle, the shader key's stale names, and a loop-latch test Tests: four races, the BCPack oracle, the shader key's stale names, and a loop-latch test Nov 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The review has no active issues requiring resolution.

No open issues 🎉

What changed in this PR

This PR improves test reliability across the GPU and format crates, removes stale shader-cache switch names left after the partial revert of #479, and adds regression coverage for nested-loop latch handling.

Changes:

  • Synchronizes race-prone tests, prevents learned-memory reuse, and skips hardware timing comparisons on software adapters.
  • Corrects the BCPack test oracle to read all 32 index slots and removes unused shader switch names.
  • Documents the existing loop-latch folding restriction and adds a regression test without changing shader control-flow logic.
File Description
crates/​victory-shader/​src/​emit/​bitcode.rs Documents latch-folding constraints and tests a block closing two loops.
crates/​victory-gpu/​src/​watch.rs Holds the guard lock through pre-settle assertions to prevent interference.
crates/​victory-gpu/​src/​shader_cache.rs Removes unused scalar-split and oracle switch names.
crates/​victory-gpu/​src/​rangelock.rs Replaces a fixed sleep with a bounded wait for writer registration.
crates/​victory-gpu/​src/​host/​menu.rs Serializes tests that modify shared menu environment variables.
crates/​victory-gpu/​src/​host/​card_steps.rs Prevents learned-memory reuse and skips software-adapter timing comparisons.
crates/​victory-formats/​src/​bcpack.rs Fixes the test oracle’s index-table layout.

Review effort: Balanced

JustOptimize added a commit to JustOptimize/VIctory-Enhanced that referenced this pull request Nov 30, 2026
… loop-latch test (PR trustno1-coder#3061)

Port of trustno1-coder#3061 (Adriwin06) onto this fork's main, 3-way merge,
no conflicts. It fixes what made this fork's CI Tests step fail on a real Windows runner and
the shared-state failure seen under Proton:

- bcpack: the test oracle skipped a u16 and read 31 index slots; it now reads all 32 in order,
  as `Tables::builtin` does (upstream f9de61c). These were the three `oracle_parity_*` failures.
- card_steps: the two `late` tests gave their memory back and another test could be handed the same
  pages and find them already learned; the memory is now leaked. This is
  `places_written_after_sending_are_learned` failing after other modules ran.
- rangelock, menu, watch: races fixed (wait for the state instead of sleeping; one mutex for the tests
  that set VICTORY_MENU_FILE / VICTORY_HOME; the late-fault test settles its own entry).
- shader_cache: `VICTORY_SCALAR_SPLITS` leaves `KEYED` (nothing reads that switch any more).

SIDE EFFECT: `KEYED` is mixed into the shader cache key, so removing a name changes the key and
every translated-shader cache is rebuilt once, on the next launch (slow first start, then normal).
Behaviour is otherwise unchanged. Not run yet: the tests under CI after this commit.
JustOptimize added a commit to JustOptimize/VIctory-Enhanced that referenced this pull request Nov 30, 2026
…MASK) and no 4 KiB placement probe that cannot fit (PR trustno1-coder#3069)

Port of trustno1-coder#3069 onto this fork's main (3-way merge). Conflicts: pool.rs (both sides added a condition to the small-placement line; both kept) and shader_cache.rs (KEYED length: trustno1-coder#3061 removed one name, trustno1-coder#3069 adds one: 46). Adds a new name to KEYED, so the shader cache key changes once, like trustno1-coder#3061. The three switches are off by default and were not measured.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-tests Pull request: tests only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants