util: a negative return spec past i64::MIN is refused, not flipped positive #1700

Open
github-bot wants to merge 1 commit from github-bot/gh-1700 into main AGit
Owner

@⁠b3IKK on GitHub · 2026-11-24 19:24 UTC · original
b3IKK:util/parse-ret-negative-range → main · +17 −2 · 1 files · 1 commits · open

util::parse_ret (the return values in data/stubdb.toml and in init_db overrides) negated a negative spec's magnitude as u64:

if let Some(n) = t.strip_prefix('-') {
    return n.parse::<u64>().ok().map(|v| (v as i64).wrapping_neg() as u64);
}

That is right for -1 (0xFFFF_FFFF, a console HRESULT) but wraps for anything below i64::MIN: "-9223372036854775809" came back as 0x7FFF_FFFF_FFFF_FFFF, a positive value where a negative one was asked for, and "-+1" parsed as -1 because u64::from_str accepts a leading +.

This takes a negative spec as i64 (which accepts i64::MIN itself) and refuses everything below it instead of flipping it positive. The hex form and a whole u64 are unchanged.

What is in it

  • crates/xcl/src/util.rs: parse the decimal spec as i64 before u64 in parse_ret; add unit test a_negative_return_spec_is_not_wrapped_around_i64_min (fails on main: -9223372036854775809 → Some(9223372036854775807) instead of None).

Tested

  • hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1)
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 960 passed, 0 failed, 43 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses, no heap windows, and cannot disable the driver cache (Windows Developer Mode is required))
  • cargo test -p xcl --lib util::tests: 6 passed, 0 failed

Regression run

main (1d027e5, clean tree, no local changes):

xcl-smoke v1
commit: 1d027e5c76c9a86a7ee2ca1cc677edf0be95d331
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1553 (PresentX 1554)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16342 MB

PR (b509a70, clean tree, no local changes):

xcl-smoke v1
commit: b509a70707bff971ca7e12e3560d4d0c5ccdf51d
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1643 (PresentX 1643)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14612 MB

Not tested

  • AMD GPUs and native wave64 hardware
  • other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine

AI use

  • OpenCode, Gemini 4 Neon: audited util::parse_ret, wrote the fix and unit test (and confirmed it fails without the fix), rebased onto 1d027e5, ran the test suite and scripts/smoke.ps1 regression runs with #677's title hashing, and drafted this PR description.
**@⁠b3IKK** on GitHub · 2026-11-24 19:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/1700) `b3IKK:util/parse-ret-negative-range` → `main` · +17 −2 · 1 files · 1 commits · open `util::parse_ret` (the return values in `data/stubdb.toml` and in `init_db` overrides) negated a negative spec's magnitude as `u64`: ```rust if let Some(n) = t.strip_prefix('-') { return n.parse::<u64>().ok().map(|v| (v as i64).wrapping_neg() as u64); } ``` That is right for `-1` (`0xFFFF_FFFF`, a console HRESULT) but wraps for anything below `i64::MIN`: `"-9223372036854775809"` came back as `0x7FFF_FFFF_FFFF_FFFF`, a positive value where a negative one was asked for, and `"-+1"` parsed as `-1` because `u64::from_str` accepts a leading `+`. This takes a negative spec as `i64` (which accepts `i64::MIN` itself) and refuses everything below it instead of flipping it positive. The hex form and a whole `u64` are unchanged. **What is in it** - `crates/xcl/src/util.rs`: parse the decimal spec as `i64` before `u64` in `parse_ret`; add unit test `a_negative_return_spec_is_not_wrapped_around_i64_min` (fails on `main`: `-9223372036854775809` → `Some(9223372036854775807)` instead of `None`). **Tested** - hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (`stable-x86_64-pc-windows-msvc`), DXC 1.9.2609.5, debug (`scripts/test.ps1`) and release (`scripts/smoke.ps1`) - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`): 960 passed, 0 failed, 43 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses, `no heap windows`, and `cannot disable the driver cache (Windows Developer Mode is required)`) - `cargo test -p xcl --lib util::tests`: 6 passed, 0 failed **Regression run** main (`1d027e5`, clean tree, no local changes): ``` xcl-smoke v1 commit: 1d027e5c76c9a86a7ee2ca1cc677edf0be95d331 gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1553 (PresentX 1554) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16342 MB ``` PR (`b509a70`, clean tree, no local changes): ``` xcl-smoke v1 commit: b509a70707bff971ca7e12e3560d4d0c5ccdf51d gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1643 (PresentX 1643) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14612 MB ``` **Not tested** - AMD GPUs and native wave64 hardware - other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine **AI use** - OpenCode, Gemini 4 Neon: audited `util::parse_ret`, wrote the fix and unit test (and confirmed it fails without the fix), rebased onto `1d027e5`, ran the test suite and `scripts/smoke.ps1` regression runs with #677's title hashing, and drafted this PR description.
parse_ret negated the magnitude as u64 ("-1" is 0xFFFF_FFFF, a console
HRESULT), so any magnitude above i64::MAX wrapped: the stub override
"-9223372036854775809" parsed as 0x7FFF_FFFF_FFFF_FFFF - a positive value
where the user asked for a negative one - and "-+1" parsed as -1.

Take a negative spec as i64 (which takes i64::MIN itself) and let it
fail for anything below it; a whole u64 and the hex form are unchanged.

Assisted-by: OpenCode (Gemini 4 Neon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:02:05 +00:00
Author
Owner

@⁠b3IKK on GitHub · 2026-11-24 22:07 UTC · original

Rebased onto 1d027e5 and re-ran: 960 passed, 0 failed, 43 ignored; both blocks above are from the current scripts/smoke.ps1 (#677's hashed itle: line), and the head run is 1643 frames / 0 crashes / 0 device removals against main's 1553.

**@⁠b3IKK** on GitHub · 2026-11-24 22:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/1700#issuecomment-7145838019) Rebased onto 1d027e5 and re-ran: 960 passed, 0 failed, 43 ignored; both blocks above are from the current scripts/smoke.ps1 (#677's hashed itle: line), and the head run is 1643 frames / 0 crashes / 0 device removals against main's 1553.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 22:09 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 22:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/1700#issuecomment-7145882671) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~23 ignored. Thanks!
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 04:02 UTC · original

XCL PR #1700 verification

Head b509a70707bff971ca7e12e3560d4d0c5ccdf51d was checked out detached and clean. The PR changes only crates/xcl/src/util.rs.

STOR-WINLAB ran Windows 11 Enterprise Evaluation x64 (build 26200) on an AMD Ryzen 7 3800X with an Intel Arc A770 (driver 32.0.101.9175). DXC was 1.9.2609.5 and rustc was 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). Cargo used unoptimized dev/test profiles with incremental compilation and debug info disabled.

Tested

  • cargo build --workspace and cargo test --workspace --no-run both exited 0 outside the Arc mutex. The latter compiled 19 test binaries.
  • cargo test -p xcl --lib util::tests::return_specs -- --exact and cargo test -p xcl --lib util::tests::a_negative_return_spec_is_not_wrapped_around_i64_min -- --exact each reported 1 passed, 0 failed, 0 ignored, 0 skipped. Both ran outside the mutex with XCL_ADAPTER=NONE_CPU_ONLY. They verified named, hexadecimal and decimal returns, signed values through i64::MIN, rejection of overflow and malformed signs, and acceptance of u64::MAX.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 ran once inside Invoke-ArcTest.ps1 with XCL_ADAPTER=A770 and RUST_TEST_NOCAPTURE=1. Cargo exited 101. Summing all 20 test result: lines (19 binaries and 1 doctest target) gave 941 passed, 19 failed and 43 ignored. Both return-spec tests passed in this run too.

Workspace failures and skips

  • Library (18 failures). Fourteen GPU tests returned CreateComputePipelineState error 0x80070057. Four had output mismatches in FMA overflow, implicit-LOD sampling, f16 lane preservation and wave64 pixel reduction.
  • End-to-end (1 failure). The test title's dynamic depth-bias check (#94) drew a blue top-right pixel where it expected green.
  • The log contains 25 lines starting with SKIPPED . Seventeen cite unavailable wave64 and three cite refused wave32 per-lane forms. Five cover tiled-resource tier, heap windows, driver-cache controls and missing debug-layer support. These lines provide no test coverage.

Not tested

Matched main baseline, retail-title smoke runs, and other GPU vendors. Failure provenance is undetermined.

AI use

T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1700-suite.log and published.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 04:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/1700#issuecomment-7152469769) # XCL PR #1700 verification Head `b509a70707bff971ca7e12e3560d4d0c5ccdf51d` was checked out detached and clean. The PR changes only `crates/xcl/src/util.rs`. STOR-WINLAB ran Windows 11 Enterprise Evaluation x64 (build 26200) on an AMD Ryzen 7 3800X with an Intel Arc A770 (driver 32.0.101.9175). DXC was 1.9.2609.5 and rustc was 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). Cargo used unoptimized dev/test profiles with incremental compilation and debug info disabled. **Tested** - `cargo build --workspace` and `cargo test --workspace --no-run` both exited 0 outside the Arc mutex. The latter compiled 19 test binaries. - `cargo test -p xcl --lib util::tests::return_specs -- --exact` and `cargo test -p xcl --lib util::tests::a_negative_return_spec_is_not_wrapped_around_i64_min -- --exact` each reported 1 passed, 0 failed, 0 ignored, 0 skipped. Both ran outside the mutex with `XCL_ADAPTER=NONE_CPU_ONLY`. They verified named, hexadecimal and decimal returns, signed values through `i64::MIN`, rejection of overflow and malformed signs, and acceptance of `u64::MAX`. - `cargo test --workspace --no-fail-fast -- --test-threads=4` ran once inside `Invoke-ArcTest.ps1` with `XCL_ADAPTER=A770` and `RUST_TEST_NOCAPTURE=1`. Cargo exited 101. Summing all 20 `test result:` lines (19 binaries and 1 doctest target) gave 941 passed, 19 failed and 43 ignored. Both return-spec tests passed in this run too. **Workspace failures and skips** - Library (18 failures). Fourteen GPU tests returned `CreateComputePipelineState` error `0x80070057`. Four had output mismatches in FMA overflow, implicit-LOD sampling, f16 lane preservation and wave64 pixel reduction. - End-to-end (1 failure). The test title's dynamic depth-bias check (#94) drew a blue top-right pixel where it expected green. - The log contains 25 lines starting with `SKIPPED `. Seventeen cite unavailable wave64 and three cite refused wave32 per-lane forms. Five cover tiled-resource tier, heap windows, driver-cache controls and missing debug-layer support. These lines provide no test coverage. **Not tested** Matched `main` baseline, retail-title smoke runs, and other GPU vendors. Failure provenance is undetermined. **AI use** T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against `pr1700-suite.log` and published.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 06:07 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 06:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/1700#issuecomment-7184120892) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
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 origin '+refs/pull/1700/head:github-bot/gh-1700'
git switch 'github-bot/gh-1700'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1700'
git switch 'github-bot/gh-1700'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1700'
git switch 'github-bot/gh-1700'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1700'
git switch 'main'
git merge --squash 'github-bot/gh-1700'
git switch 'main'
git merge --ff-only 'github-bot/gh-1700'
git switch 'main'
git merge 'github-bot/gh-1700'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.