shader: the exhaustive mul-form sweep is a runbook step, not the gate #619

Open
qnjk wants to merge 1 commit from qnjk/Darner:oracle64-sweep into Main
Contributor

Contributor role (optional)

  • Fluxer ID:

What it changes

  • The problem on main: oracle64::legacy_mul_forms_are_exact proves the host forms of emit::cost::Rewrite::LegacyMulForms against this model's v_mul_legacy_f32 bit for bit, and it does so exhaustively:

    for bits in 0..=u32::MAX { ... }                 // the square of every float
    for k in CONSTANTS.iter()... { ... }             // 30 constants over every float of three exponents
    for k in [..6..] { for bits in 0..=u32::MAX { } } // six constants over every float
    

    That is about 30 billion checks. In a debug build — which is what cargo test runs — it takes over half an hour, and it is most of this crate's suite: cargo test -p darner-shader --lib measured 2444 s on this machine in a gate run earlier today, with this test running for almost all of it. A test that costs more than the rest of the workspace is a gate-time defect even though its content is right.

  • This change keeps the exhaustive pass and moves it behind #[ignore], with the run command in the reason — the shape AGENTS.md describes for a measurement (cargo test --release -p darner-shader legacy_mul_forms_are_exact -- --ignored). A bounded deterministic sweep of the same properties runs by default: every 8192th float for the squares, every 131072nd for each of the same constants, plus the ends of the range and the NaN and infinity encodings, through the same per-pair assertion. The constants and the assertion are now two helpers, so both passes check exactly the same thing.

How it was tested

  • Tested revision: bf5302a (one commit on c8258f9).
  • Commands and results:
    • cargo test --locked -p darner-shader --lib — 568 passed, 0 failed, 17 ignored, in 648 s on this machine. The same crate's suite took 2444 s earlier today on the same machine (my gate log on c8258f9; that run also had the pre-existing emit::waterfall_tests failure, which has since been fixed by a merge). The difference is this test: the exhaustive pass is now the 17th ignored test, and the default sweep runs in 0.20 s.
    • cargo test --locked -p darner-shader --lib -- oracle64:: — 3 passed, 1 ignored.
    • cargo clippy --locked -p darner-shader --all-targets -- -D warnings passes (the ignored test still compiles, so the exhaustive pass is not dead code).
    • Fail-before for the sweep: with the new default test's assertion path broken (the helper's assert_eq! removed), the sweep fails; and the exhaustive test, run with --ignored on a release build, still fails on a deliberately broken legacy_mul — its content is unchanged.
  • Changes a default: no. Nothing the emulator does changes; what changes is which tests the default cargo test pays for.
  • A/B result: this is a test-time claim, and the numbers are above: 2444 s → 648 s for cargo test -p darner-shader --lib on this machine, same suite, same hardware. No fps or gameplay figure is implied or given.
  • Gates run on that revision:
    • Gate 1, cargo clippy --workspace --all-targets --locked -- -D warnings: passes.
    • Gate 2, cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes.
    • Gate 3, cargo test --workspace --locked: still not green on this machine, but for the first time this crate is not the reason — darner-gpu's pre-existing order-dependent failures and deadlock (#224, #150) remain. darner-shader is green in 648 s.
  • Gameplay, when relevant: not applicable — tests-only change.
  • Shader wave sizes tested, when relevant: not applicable — this is the multiplication model, not wave shapes.
  • Hardware dependence: none. The time is a debug-build property.
  • Coverage gaps: the default sweep covers every 8192nd float for the squares and every 131072nd for each constant, so a counterexample that only occurs at some other bit pattern would now be found only by the ignored exhaustive pass. That trade is the point of the change; the exhaustive pass is one command away and its command is in the #[ignore] reason.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
    • Not applicable: tests-only change, stated at the top.
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md (cargo xtask policy: 576 files ok).
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none found. No open pull request changes crates/darner-shader/src/oracle64.rs (checked against the file list of all 189 open pull requests), and no open or closed issue mentions legacy_mul_forms_are_exact or the oracle.
  • Replaces or overlaps: none found
## Contributor role (optional) - Fluxer ID: ## What it changes - The problem on main: `oracle64::legacy_mul_forms_are_exact` proves the host forms of `emit::cost::Rewrite::LegacyMulForms` against this model's `v_mul_legacy_f32` bit for bit, and it does so exhaustively: ```rust for bits in 0..=u32::MAX { ... } // the square of every float for k in CONSTANTS.iter()... { ... } // 30 constants over every float of three exponents for k in [..6..] { for bits in 0..=u32::MAX { } } // six constants over every float ``` That is about 30 billion checks. In a debug build — which is what `cargo test` runs — it takes over half an hour, and it is most of this crate's suite: `cargo test -p darner-shader --lib` measured **2444 s** on this machine in a gate run earlier today, with this test running for almost all of it. A test that costs more than the rest of the workspace is a gate-time defect even though its content is right. - This change keeps the exhaustive pass and moves it behind `#[ignore]`, with the run command in the reason — the shape AGENTS.md describes for a measurement (`cargo test --release -p darner-shader legacy_mul_forms_are_exact -- --ignored`). A bounded deterministic sweep of the same properties runs by default: every 8192th float for the squares, every 131072nd for each of the same constants, plus the ends of the range and the NaN and infinity encodings, through the same per-pair assertion. The constants and the assertion are now two helpers, so both passes check exactly the same thing. ## How it was tested - Tested revision: `bf5302a` (one commit on `c8258f9`). - Commands and results: - `cargo test --locked -p darner-shader --lib` — **568 passed, 0 failed, 17 ignored, in 648 s** on this machine. The same crate's suite took **2444 s** earlier today on the same machine (my gate log on `c8258f9`; that run also had the pre-existing `emit::waterfall_tests` failure, which has since been fixed by a merge). The difference is this test: the exhaustive pass is now the 17th ignored test, and the default sweep runs in 0.20 s. - `cargo test --locked -p darner-shader --lib -- oracle64::` — 3 passed, 1 ignored. - `cargo clippy --locked -p darner-shader --all-targets -- -D warnings` passes (the ignored test still compiles, so the exhaustive pass is not dead code). - Fail-before for the sweep: with the new default test's assertion path broken (the helper's `assert_eq!` removed), the sweep fails; and the exhaustive test, run with `--ignored` on a release build, still fails on a deliberately broken `legacy_mul` — its content is unchanged. - Changes a default: no. Nothing the emulator does changes; what changes is which tests the default `cargo test` pays for. - A/B result: this is a test-time claim, and the numbers are above: 2444 s → 648 s for `cargo test -p darner-shader --lib` on this machine, same suite, same hardware. No fps or gameplay figure is implied or given. - Gates run on that revision: - Gate 1, `cargo clippy --workspace --all-targets --locked -- -D warnings`: passes. - Gate 2, `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: passes. - Gate 3, `cargo test --workspace --locked`: still not green on this machine, but for the first time this crate is not the reason — `darner-gpu`'s pre-existing order-dependent failures and deadlock (#224, #150) remain. `darner-shader` is green in 648 s. - Gameplay, when relevant: not applicable — tests-only change. - Shader wave sizes tested, when relevant: not applicable — this is the multiplication model, not wave shapes. - Hardware dependence: none. The time is a debug-build property. - Coverage gaps: the default sweep covers every 8192nd float for the squares and every 131072nd for each constant, so a counterexample that only occurs at some other bit pattern would now be found only by the ignored exhaustive pass. That trade is the point of the change; the exhaustive pass is one command away and its command is in the `#[ignore]` reason. ## Checklist - [x] I ran this change in the game, or say below why it can't be (docs, tests only). - Not applicable: tests-only change, stated at the top. - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md` (`cargo xtask policy`: 576 files ok). - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none found. No open pull request changes `crates/darner-shader/src/oracle64.rs` (checked against the file list of all 189 open pull requests), and no open or closed issue mentions `legacy_mul_forms_are_exact` or the oracle. - Replaces or overlaps: none found
`legacy_mul_forms_are_exact` proves the host forms of `LegacyMulForms`
against this model bit for bit: the square of every float, then seven
constants across every float — about 30 billion checks. In a debug build
that is over half an hour, and it is most of this crate's suite: the
reason `cargo test -p darner-shader --lib` takes as long as it does.

The exhaustive pass stays, `#[ignore]`d for its run time and run as
AGENTS.md describes a measurement:
`cargo test --release -p darner-shader legacy_mul_forms_are_exact -- --ignored`.
A bounded deterministic sweep of the same properties runs by default —
every 8192nd float for the squares, every 131072nd for each constant, the
ends of the range and the NaN and infinity encodings — and takes a
fraction of a second. The constants and the per-pair assertion moved to
two helpers so both passes check the same thing.
Contributor

An independent Windows result for the exhaustive runbook step. With Rust 1.98.1 and RUSTFLAGS=-C target-cpu=native, the complete existing sweep passed in 42.04 s:

cargo test --release --locked --offline -p darner-shader --lib oracle64::legacy_mul_forms_are_exact -- --exact

This used 6d80b4b from #620, where the oracle is identical to c8258f95. The same sweep was the only shader test still running when I stopped the debug workspace run. This exercises the full original oracle through the release path.

An independent Windows result for the exhaustive runbook step. With Rust 1.98.1 and `RUSTFLAGS=-C target-cpu=native`, the complete existing sweep passed in **42.04 s**: `cargo test --release --locked --offline -p darner-shader --lib oracle64::legacy_mul_forms_are_exact -- --exact` This used `6d80b4b` from #620, where the oracle is identical to `c8258f95`. The same sweep was the only shader test still running when I stopped the debug workspace run. This exercises the full original oracle through the release path.
TrustNo1 changed title from [pr-tests] shader: the exhaustive mul-form sweep is a runbook step, not the gate to shader: the exhaustive mul-form sweep is a runbook step, not the gate 2026-12-06 03:26:11 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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 'oracle64-sweep:qnjk-oracle64-sweep'
git switch 'qnjk-oracle64-sweep'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'Main'
git merge --no-ff 'qnjk-oracle64-sweep'
git switch 'qnjk-oracle64-sweep'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'qnjk-oracle64-sweep'
git switch 'qnjk-oracle64-sweep'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'qnjk-oracle64-sweep'
git switch 'Main'
git merge --squash 'qnjk-oracle64-sweep'
git switch 'Main'
git merge --ff-only 'qnjk-oracle64-sweep'
git switch 'Main'
git merge 'qnjk-oracle64-sweep'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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
TrustNo1/Darner!619
No description provided.