GPU-TIMEOUT-OVERFLOW: Reject GPU timeouts that overflow platform waits #1350

Closed
leonida/mandy
delysidemanYT1 wants to merge 0 commits from gpu-timeout-overflow into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

delysidemanYT1 commented 2026-11-24 22:12:32 +00:00

Claimed in the coordination issue as: GPU-TIMEOUT-OVERFLOW
Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7145900346

Reject finite positive LEONIDA_GPU_TEST_TIMEOUT values above the signed 32-bit millisecond wait limit before launching a subprocess. Preserve the default, fractional timeouts and the existing unlimited setting.

Reproduced the Windows OverflowError at 1e300. Checked seven accepted and rejected boundary cases with synthetic subprocesses. All eight GPU timeout unit tests passed. No GPU run. git diff --check passed. No game files. AI-assisted (Codex).

Claimed in the coordination issue as: GPU-TIMEOUT-OVERFLOW Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7145900346 Reject finite positive LEONIDA_GPU_TEST_TIMEOUT values above the signed 32-bit millisecond wait limit before launching a subprocess. Preserve the default, fractional timeouts and the existing unlimited setting. Reproduced the Windows OverflowError at 1e300. Checked seven accepted and rejected boundary cases with synthetic subprocesses. All eight GPU timeout unit tests passed. No GPU run. git diff --check passed. No game files. AI-assisted (Codex).
whoalin1 commented 2026-11-24 23:25:52 +00:00

Independent verification (AI-assisted, overnight review batch):

  • Checked out 5ca1539; diff is a single guard in runtime/test/shaders/check.py:694-697 (gpu_test_timeout).
  • Manual boundary checks (CPython 3.14.4, Windows): 1e300 now exits with the new diagnostic; 2147483 accepted, 2147483.5/2147484 rejected, 0/-1 still mean no limit, 0.5 accepted, non-numeric/nan still rejected by the existing check.
  • Reproduced the underlying hazard on this Python: subprocess.run(..., timeout=1e300) misbehaves (raises TimeoutExpired immediately rather than waiting), confirming huge timeouts break platform waits.
  • python -I -m pytest tests/test_gpu_test_timeout.py: 8 passed + 7 subtests.
  • py -3.14 -m compileall -q tools tests make_game.py: clean.
  • Minor note (non-blocking): the bound (2**31-1)//1000 = 2147483 is slightly conservative — 2147483.5 s would still fit in a signed 32-bit ms wait — but a ~24-day timeout difference is irrelevant in practice.
  • CPU only, no GPU, no game files. LGTM.
Independent verification (AI-assisted, overnight review batch): - Checked out 5ca1539; diff is a single guard in `runtime/test/shaders/check.py:694-697` (`gpu_test_timeout`). - Manual boundary checks (CPython 3.14.4, Windows): `1e300` now exits with the new diagnostic; `2147483` accepted, `2147483.5`/`2147484` rejected, `0`/`-1` still mean no limit, `0.5` accepted, non-numeric/`nan` still rejected by the existing check. - Reproduced the underlying hazard on this Python: `subprocess.run(..., timeout=1e300)` misbehaves (raises TimeoutExpired immediately rather than waiting), confirming huge timeouts break platform waits. - `python -I -m pytest tests/test_gpu_test_timeout.py`: 8 passed + 7 subtests. - `py -3.14 -m compileall -q tools tests make_game.py`: clean. - Minor note (non-blocking): the bound `(2**31-1)//1000 = 2147483` is slightly conservative — 2147483.5 s would still fit in a signed 32-bit ms wait — but a ~24-day timeout difference is irrelevant in practice. - CPU only, no GPU, no game files. LGTM.
OreoFR commented 2026-11-28 21:49:15 +00:00

Verified by OreoFR

  • Base: main 3408969a7 + PR head 5ca153985; green run in a merge package of 3 PRs, no new ctest failure vs main
  • Test: python -I tests/test_gpu_test_timeout.py (from #1382)
  • Red on main: 2 FAIL (SystemExit not raised for 2147484 and 1e300)
  • Green with the PR: 9 tests OK
  • Verdict: READY (the test comes from #1382 (this PR has none); merge with or before #1382, which contains it)
  • 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 `3408969a7` + PR head `5ca153985`; green run in a merge package of 3 PRs, no new ctest failure vs main - Test: `python -I tests/test_gpu_test_timeout.py (from #1382)` - Red on main: 2 FAIL (SystemExit not raised for 2147484 and 1e300) - Green with the PR: 9 tests OK - Verdict: READY (the test comes from #1382 (this PR has none); merge with or before #1382, which contains it) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-29 01:12:24 +00:00

#1350 | head 5ca153985e4f261c01685a6c7cf2b69205439d95 (merged cleanly onto origin/main 818d881b1f) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Independent Verification (Windows 11)

  • Diff & safety audit: Inspected 100% of the diff in runtime/test/shaders/check.py capping LEONIDA_GPU_TEST_TIMEOUT at (2**31 - 1) // 1000 (2147483 seconds) in gpu_test_timeout(). python -I scripts/check_no_game_data.py runtime/test/shaders/check.py passed (rc=0).
  • Red -> Green on Windows 11:
    • Red (origin/main 818d881b1f): Setting LEONIDA_GPU_TEST_TIMEOUT=5000000 and invoking check.run(...) on Windows 11 crashed inside subprocess / Win32 WaitForSingleObject with unhandled OverflowError: timeout value is too large.
    • Green (#1350 + origin/main):
      • LEONIDA_GPU_TEST_TIMEOUT=5000000 exited cleanly with SystemExit("LEONIDA_GPU_TEST_TIMEOUT must not exceed 2147483 seconds (0 = no limit), not '5000000'").
      • Boundary LEONIDA_GPU_TEST_TIMEOUT=2147483 returned 2147483.0 and check.run(...) executed cleanly (rc=0).
  • Regression suite & sibling merge check:
    • python -I tests/test_shader_checks.py -> 88/88 passed (OK, 2.177s)
    • Verified clean 3-way merge alongside sibling runtime/test/shaders/check.py PR #1325 (0 conflicts).
#1350 | head 5ca153985e4f261c01685a6c7cf2b69205439d95 (merged cleanly onto origin/main 818d881b1f) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes ### Independent Verification (Windows 11) - **Diff & safety audit**: Inspected 100% of the diff in `runtime/test/shaders/check.py` capping `LEONIDA_GPU_TEST_TIMEOUT` at `(2**31 - 1) // 1000` (`2147483` seconds) in `gpu_test_timeout()`. `python -I scripts/check_no_game_data.py runtime/test/shaders/check.py` passed (`rc=0`). - **Red -> Green on Windows 11**: - **Red (`origin/main` `818d881b1f`)**: Setting `LEONIDA_GPU_TEST_TIMEOUT=5000000` and invoking `check.run(...)` on Windows 11 crashed inside `subprocess` / Win32 `WaitForSingleObject` with unhandled `OverflowError: timeout value is too large`. - **Green (`#1350 + origin/main`)**: - `LEONIDA_GPU_TEST_TIMEOUT=5000000` exited cleanly with `SystemExit("LEONIDA_GPU_TEST_TIMEOUT must not exceed 2147483 seconds (0 = no limit), not '5000000'")`. - Boundary `LEONIDA_GPU_TEST_TIMEOUT=2147483` returned `2147483.0` and `check.run(...)` executed cleanly (`rc=0`). - **Regression suite & sibling merge check**: - `python -I tests/test_shader_checks.py` -> `88/88` passed (`OK`, `2.177s`) - Verified clean 3-way merge alongside sibling `runtime/test/shaders/check.py` PR `#1325` (`0` conflicts).
aslan2142 commented 2026-12-01 16:35:01 +00:00

Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.
Sign in to join this conversation.
No description provided.