D3D12: cover indirect budget resets and rejected batches in both modes #2537

Merged
leonida/mandy
kirigayakazima merged 1 commit from codex/d3d12-indirect-budget-tests into main 2026-11-28 20:21:10 +00:00

Pull request successfully merged and closed

kirigayakazima commented 2026-11-28 01:17:58 +00:00

D3D12-INDIRECT-BUDGET-REGRESSION. Claim.

Three indirect tests failed on 431ceba4f on Windows. The table header now contains the experiment mask in its second dword. Two 65535-by-16 dispatches also leave enough budget for a small dispatch under the default skip-on-overflow policy. The reset test now spends exactly half the budget per large record, proving a small dispatch runs empty before reset and runs after reset in both modes. The WARP batch test checks the amount actually charged for a job too large to fit, alongside the record output and the exact-fit cases.

Verification: cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-gpu --lib indirect::tests:: -- --test-threads=1 in separate Windows processes with LEONIDA_INDIRECT_REST=0 and =1. Each passed 19 tests with 7 ignored. The original full GPU library run had 479 passed, 4 failed, 46 ignored. The fourth failure in descriptor/host.rs is independent. Diff whitespace and no-game-data checks passed.

GPUs tested: Windows D3D12 test harness and WARP on an RTX 4070 Laptop GPU system (NVIDIA 610.74). Synthetic records only. No retail frame timing. No dependencies on other PRs. AI-assisted with OpenAI Codex (GPT-6).

D3D12-INDIRECT-BUDGET-REGRESSION. [Claim](https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7231546679). Three indirect tests failed on 431ceba4f on Windows. The table header now contains the experiment mask in its second dword. Two 65535-by-16 dispatches also leave enough budget for a small dispatch under the default skip-on-overflow policy. The reset test now spends exactly half the budget per large record, proving a small dispatch runs empty before reset and runs after reset in both modes. The WARP batch test checks the amount actually charged for a job too large to fit, alongside the record output and the exact-fit cases. Verification: `cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-gpu --lib indirect::tests:: -- --test-threads=1` in separate Windows processes with LEONIDA_INDIRECT_REST=0 and =1. Each passed 19 tests with 7 ignored. The original full GPU library run had 479 passed, 4 failed, 46 ignored. The fourth failure in descriptor/host.rs is independent. Diff whitespace and no-game-data checks passed. GPUs tested: Windows D3D12 test harness and WARP on an RTX 4070 Laptop GPU system (NVIDIA 610.74). Synthetic records only. No retail frame timing. No dependencies on other PRs. AI-assisted with OpenAI Codex (GPT-6).
timbot103 commented 2026-11-28 02:02:37 +00:00

Static review at head 6ff203098 (Rust toolchain is not installed in this local environment, so cargo test was not executed locally).

Notes (non-blocking)

  • Adjusting the host-list budget fill to 32,768 × 32 = 2^20 groups (2^26 credits each, exhausting 2^27 in two records instead of leaving 2,048 spare credits) fixes the default-policy probe assertion, and the batch header / rejected-job WARP assertions cleanly distinguish zero-charge vs. full-budget policies (d3d12/crates/leonida-gpu/src/indirect.rs:71-75, 125-195, 2779-2843, 3115-3128, 3424-3474).
  • Minor test note (indirect.rs:317-326, 3428-3436): Because warp_batch_charges_every_execution reads LEONIDA_INDIRECT_REST from the process environment for both shader define and expected result, a single test run exercises only one REST policy (unlike the adjacent single-clamp tests at 2660-2689 that parameterize both explicitly). Parameterizing both policies in-test (or invoking twice in CI) ensures routine coverage of both modes.

Approve.

AI-assisted static review.

Static review at head `6ff203098` (Rust toolchain is not installed in this local environment, so `cargo test` was not executed locally). ### Notes (non-blocking) - Adjusting the host-list budget fill to `32,768 × 32 = 2^20` groups (`2^26` credits each, exhausting `2^27` in two records instead of leaving 2,048 spare credits) fixes the default-policy probe assertion, and the batch header / rejected-job WARP assertions cleanly distinguish zero-charge vs. full-budget policies (`d3d12/crates/leonida-gpu/src/indirect.rs:71-75`, `125-195`, `2779-2843`, `3115-3128`, `3424-3474`). - **Minor test note (`indirect.rs:317-326`, `3428-3436`):** Because `warp_batch_charges_every_execution` reads `LEONIDA_INDIRECT_REST` from the process environment for both shader define and expected result, a single test run exercises only one REST policy (unlike the adjacent single-clamp tests at `2660-2689` that parameterize both explicitly). Parameterizing both policies in-test (or invoking twice in CI) ensures routine coverage of both modes. Approve. AI-assisted static review.
zmasi left a comment
No description provided.
Verified at head `6ff203098` on Windows 11 with **NVIDIA GeForce RTX 3090 (driver `610.88`)** D3D12 and **WARP** (`--features diagnostics`, `LEONIDA_D3D12_WARP=1`), including negative controls on `main` (`431ceba4f`): - **Code & boundary check**: - `host_list_budget_starts_empty_at_each_submission`: `[32768u32, 32, 1]` hits `32768 * 32 == 1 << 20 == GROUPS` (staying within both `GROUPS / g.y` and `WIDEST = 65535`) and charges `32768 * 32 * 64 == 1 << 26 == BUDGET / 2` per record, so the first two records exhaust `BUDGET` (`1 << 27`) identically under both `LEONIDA_INDIRECT_REST=0` and `LEONIDA_INDIRECT_REST=1` (on `431ceba4f`, `2 * 65535 * 16 * 64` left `2,048` unspent threads under `REST=0`, letting the `1x1x1` trailing dispatch run). - `batch_tables`: matches `Table::new` initializing dword 1 to `batch::experiments()` (`0` without active experiment switches, and dynamically matching `LEONIDA_AB` under `diagnostics`). - `warp_batch_charges_every_execution`: `(times = 3, records = 1)` charges `3 * 2^26 > BUDGET`, which `batch::SOURCE` leaves at `0` when `REST == 0` and clamps to `BUDGET` when `REST == 1`; `rejected = if rest() != 0 { BUDGET } else { 0 }` matches `make_from` in both modes. - **Negative controls on `431ceba4f` (`LEONIDA_INDIRECT_REST=0`)**: reproduced all three failures (`host_list_budget_starts_empty_at_each_submission` `1 != 0`, `batch_tables` `[3, 0, ..] != [3, 0xffffffff, ..]`, `warp_batch_charges_every_execution` `0 != 134217728`). - **Positive runs on `6ff203098`**: - `LEONIDA_INDIRECT_REST=0` (RTX 3090 D3D12): `cargo test -p leonida-gpu indirect::tests:: -- --test-threads=1` -> `19 passed; 0 failed`. - `LEONIDA_INDIRECT_REST=0` (WARP, `--features diagnostics` + `LEONIDA_D3D12_WARP=1`): `19 passed; 0 failed`. - `LEONIDA_INDIRECT_REST=1` (RTX 3090 D3D12): `19 passed; 0 failed`. - `LEONIDA_INDIRECT_REST=1` (WARP, `--features diagnostics` + `LEONIDA_D3D12_WARP=1`): `19 passed; 0 failed`. AI-assisted.
lixonik approved these changes 2026-11-28 09:20:49 +00:00
lixonik left a comment

Reviewed the diff and tested merged onto main (493867366) on Windows 11 with Rust 1.100.1 (MSVC).

The three indirect test updates ([32768, 32, 1] exact half-budget records, batch::experiments() header dword, and rest()-aware expected_spent) cleanly cover both overflow policies.

Tests run

  • cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-gpu --lib indirect::tests:: -- --test-threads=1:
    • LEONIDA_INDIRECT_REST=0: 19 passed, 0 failed (7 ignored, 4.61 s).
    • LEONIDA_INDIRECT_REST=1: 19 passed, 0 failed (7 ignored, 4.59 s).

GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88) + WARP.

AI-assisted (Antigravity, Gemini).

Reviewed the diff and tested merged onto `main` (`493867366`) on Windows 11 with Rust 1.100.1 (MSVC). The three indirect test updates (`[32768, 32, 1]` exact half-budget records, `batch::experiments()` header dword, and `rest()`-aware `expected_spent`) cleanly cover both overflow policies. ### Tests run - `cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-gpu --lib indirect::tests:: -- --test-threads=1`: - `LEONIDA_INDIRECT_REST=0`: **19 passed, 0 failed** (7 ignored, 4.61 s). - `LEONIDA_INDIRECT_REST=1`: **19 passed, 0 failed** (7 ignored, 4.59 s). GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88) + WARP. AI-assisted (Antigravity, Gemini).
zmasi commented 2026-11-28 11:24:10 +00:00

VERIFY-2537-D3D12 — verified head 6ff2030983 merged cleanly with main c7f5330e0 on Windows 11 Pro (build 26200), NVIDIA GeForce RTX 3090 (driver 610.88) + D3D12 WARP, synthetic indirect dispatch/draw records only.

Red (main c7f5330e0) -> Green (c7f5330e0 + 6ff2030983)

  • Red on main:
    • LEONIDA_INDIRECT_REST=0 cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib indirect::tests:: -- --test-threads=1 -> FAILED (16 passed; 3 failed; 7 ignored: indirect::tests::batch_tables header word 1 0 != 0xffff_ffff, indirect::tests::host_list_budget_starts_empty_at_each_submission left: 1, right: 0, and indirect::tests::warp_batch_charges_every_execution left: 0, right: 134217728).
    • LEONIDA_INDIRECT_REST=1 cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib indirect::tests:: -- --test-threads=1 -> FAILED (18 passed; 1 failed; 7 ignored: indirect::tests::batch_tables).
  • Green on merged PR:
    • LEONIDA_INDIRECT_REST=0 cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib indirect::tests:: -- --test-threads=1 -> 19 passed; 0 failed; 7 ignored (4.62s, RTX 3090 D3D12 + WARP).
    • LEONIDA_INDIRECT_REST=1 cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib indirect::tests:: -- --test-threads=1 -> 19 passed; 0 failed; 7 ignored (5.00s, RTX 3090 D3D12 + WARP).

AI-assisted.

`VERIFY-2537-D3D12` — verified head `6ff2030983` merged cleanly with `main` `c7f5330e0` on Windows 11 Pro (build 26200), NVIDIA GeForce RTX 3090 (driver 610.88) + D3D12 WARP, synthetic indirect dispatch/draw records only. ### Red (`main` `c7f5330e0`) -> Green (`c7f5330e0` + `6ff2030983`) - **Red on `main`**: - `LEONIDA_INDIRECT_REST=0 cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib indirect::tests:: -- --test-threads=1` -> **FAILED** (`16 passed; 3 failed; 7 ignored`: `indirect::tests::batch_tables` header word 1 `0 != 0xffff_ffff`, `indirect::tests::host_list_budget_starts_empty_at_each_submission` `left: 1, right: 0`, and `indirect::tests::warp_batch_charges_every_execution` `left: 0, right: 134217728`). - `LEONIDA_INDIRECT_REST=1 cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib indirect::tests:: -- --test-threads=1` -> **FAILED** (`18 passed; 1 failed; 7 ignored`: `indirect::tests::batch_tables`). - **Green on merged PR**: - `LEONIDA_INDIRECT_REST=0 cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib indirect::tests:: -- --test-threads=1` -> **19 passed; 0 failed; 7 ignored** (`4.62s`, RTX 3090 D3D12 + WARP). - `LEONIDA_INDIRECT_REST=1 cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib indirect::tests:: -- --test-threads=1` -> **19 passed; 0 failed; 7 ignored** (`5.00s`, RTX 3090 D3D12 + WARP). AI-assisted.
MoonEyes commented 2026-11-28 20:21:07 +00:00

Red/green: On main three indirect::tests assertions fail against the current budget semantics, and with the PR cargo test -p leonida-gpu --lib -- indirect::tests passes (3 OK) on Windows 11 at OreoFR's (RTX 4070).
Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.

Red/green: On main three indirect::tests assertions fail against the current budget semantics, and with the PR cargo test -p leonida-gpu --lib -- indirect::tests passes (3 OK) on Windows 11 at OreoFR's (RTX 4070). Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.
OreoFR commented 2026-11-28 22:04:28 +00:00

Verified by OreoFR

  • Base: main 54d27d988 + PR head 6ff203098; green run in a merge package of 5 PRs, no new ctest failure vs main
  • Test: cargo test -p leonida-gpu --lib --locked -- indirect::tests
  • Red on main: 3 failures on main (batch_tables, host_list_budget_starts_empty_at_each_submission, warp_batch_charges_every_execution)
  • Green with the PR: 3 OK
  • Verdict: READY (test-only PR: main is the red; REST mode not forced, only rest()'s default is exercised)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

**Verified by OreoFR** - Base: main `54d27d988` + PR head `6ff203098`; green run in a merge package of 5 PRs, no new ctest failure vs main - Test: `cargo test -p leonida-gpu --lib --locked -- indirect::tests` - Red on main: 3 failures on main (batch_tables, host_list_budget_starts_empty_at_each_submission, warp_batch_charges_every_execution) - Green with the PR: 3 OK - Verdict: READY (test-only PR: main is the red; REST mode not forced, only rest()'s default is exercised) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No description provided.