Tests: some_ranges in texture_upload wraps its generator instead of overflowing #2771

Open
github-bot wants to merge 1 commit from github-bot/gh-2771 into nvidia-dev AGit
Owner

@⁠inf1425 on GitHub · 2026-11-26 11:38 UTC · original
inf1425:tests/texture-upload-lcg-overflow → nvidia-dev · +1 −1 · 1 files · 1 commits · draft

The some_ranges helper in texture_upload's tests advances a linear congruential generator with n = n * 1103515245 + 12345, and n grows without bound. By the third loop pass it exceeds u64, and debug builds (cargo test) panic with "attempt to multiply with overflow". Both GPU tests that use the helper fail on a GPU. CI has no GPU, so they return before reaching it. The step now wraps, as such a generator should. Royalflamejlh reported this in #42 (comment) and proposed exactly this line. This PR applies it.

What is in it

  • crates/xcl/src/hle/d3d12x/texture_upload.rs (in mod tests): n = n.wrapping_mul(1103515245).wrapping_add(12345). Test code only. The helper came in with 73fc616f.

Tested

  • NVIDIA GeForce RTX 4060 Laptop GPU (8 GB, driver 616.64), Ryzen 7 7840HS, Windows 11 build 26300, Rust 1.95.0, debug build.
  • cargo test -p xcl --lib texture_upload: 8 passed, 0 failed, in 3 runs. Without this PR, pieces_hold_the_texels_of_their_levels and gpu_parts_of_a_texture_go_up_and_the_rest_stays fail.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 at this PR's head: 1746 passed, 4 failed, 48 ignored. The failures are not touched here: the 2 late-release tests (#2770), d3d12_mesh_stream::console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly (#2632), and the flaky hle::kernelx::tests::memory_under_a_shown_page_is_told_to_sparse_before_it_goes, a race that #2772 fixes. That last test passed in 3 further lib runs and 10 runs on its own.
  • SKIPPED GPU tests (26): 21 need wave64; 3 are f16 ops the per-lane form refuses (#1426); 2 need XCL_HEAP_WINDOWS=1.

Regression run

  • The change is inside #[cfg(test)] mod tests and never reaches xcl.exe, but scripts/pr_check.py counts any file under crates/xcl/src/ as runtime. Smoke blocks from nvidia-dev and from this head will be added once a title is available, unless a maintainer prefers the test-only label.

main:

PR:

Not tested

  • AMD, other NVIDIA cards, Linux/Wine, a release build, any retail title (smoke run pending).

AI use

  • Claude Code (Claude Opus 5.5) found the overflow, wrote the change and ran the tests. I read every line of the diff.
**@⁠inf1425** on GitHub · 2026-11-26 11:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/2771) `inf1425:tests/texture-upload-lcg-overflow` → `nvidia-dev` · +1 −1 · 1 files · 1 commits · draft The `some_ranges` helper in `texture_upload`'s tests advances a linear congruential generator with `n = n * 1103515245 + 12345`, and `n` grows without bound. By the third loop pass it exceeds u64, and debug builds (`cargo test`) panic with "attempt to multiply with overflow". Both GPU tests that use the helper fail on a GPU. CI has no GPU, so they return before reaching it. The step now wraps, as such a generator should. Royalflamejlh reported this in #42 ([comment](https://git.gtahub.st/github/xcl-dev--xcl/issues/42)) and proposed exactly this line. This PR applies it. **What is in it** - `crates/xcl/src/hle/d3d12x/texture_upload.rs` (in `mod tests`): `n = n.wrapping_mul(1103515245).wrapping_add(12345)`. Test code only. The helper came in with 73fc616f. **Tested** - NVIDIA GeForce RTX 4060 Laptop GPU (8 GB, driver 616.64), Ryzen 7 7840HS, Windows 11 build 26300, Rust 1.95.0, debug build. - `cargo test -p xcl --lib texture_upload`: 8 passed, 0 failed, in 3 runs. Without this PR, `pieces_hold_the_texels_of_their_levels` and `gpu_parts_of_a_texture_go_up_and_the_rest_stays` fail. - `cargo test --workspace --no-fail-fast -- --test-threads=4` at this PR's head: 1746 passed, 4 failed, 48 ignored. The failures are not touched here: the 2 late-release tests (#2770), `d3d12_mesh_stream::console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly` (#2632), and the flaky `hle::kernelx::tests::memory_under_a_shown_page_is_told_to_sparse_before_it_goes`, a race that #2772 fixes. That last test passed in 3 further lib runs and 10 runs on its own. - SKIPPED GPU tests (26): 21 need wave64; 3 are f16 ops the per-lane form refuses (#1426); 2 need `XCL_HEAP_WINDOWS=1`. **Regression run** - The change is inside `#[cfg(test)] mod tests` and never reaches `xcl.exe`, but `scripts/pr_check.py` counts any file under `crates/xcl/src/` as runtime. Smoke blocks from `nvidia-dev` and from this head will be added once a title is available, unless a maintainer prefers the `test-only` label. main: PR: **Not tested** - AMD, other NVIDIA cards, Linux/Wine, a release build, any retail title (smoke run pending). **AI use** - Claude Code (Claude Opus 5.5) found the overflow, wrote the change and ran the tests. I read every line of the diff.
The helper's linear congruential step `n = n * 1103515245 + 12345`
grows without bound: from the third loop pass it is past u64, and debug
builds (cargo test) panic with "attempt to multiply with overflow".
Both GPU tests that use it failed on a GPU (CI has none, so they return
before reaching it):

- texture_upload::tests::pieces_hold_the_texels_of_their_levels
- texture_upload::tests::gpu_parts_of_a_texture_go_up_and_the_rest_stays

The step now wraps, as such a generator is meant to. Test code only; on
an RTX 4060 Laptop GPU all 8 texture_upload tests pass (3 runs).

Assisted-by: Claude Code (Claude Opus 5.5)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:40:50 +00:00
Author
Owner

@⁠MarcosMDev on GitHub · 2026-11-26 12:25 UTC · original

Test report: 6b2691e against its base af2cecc on a desktop RTX 4060 (Windows): the 2 texture_upload tests fail 10 of 10 on the base and pass 10 of 10 here; full suite, no new failure. No title was run.

Debug, each tree in its own worktree and target folder, cargo build --workspace --locked first.

  • cargo test -p xcl --lib hle::d3d12x::texture_upload::tests, 10 times in a row: base 6 passed, 2 failed every time (attempt to multiply with overflow at texture_upload.rs:1002); head 8 passed, 0 failed every time.
  • Full suite, cargo test --workspace --locked --no-fail-fast -- --test-threads=4: base 1745 passed, 6 failed, 48 ignored; head 1747 passed, 4 failed, 48 ignored. The 4 left are the 2 late-release tests (counted 3 times; #2770) and console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly. The kernelx race you mention did not fail here. The same 30 SKIPPED lines on both.

The change is inside #[cfg(test)] mod tests, and in a release build n * … already wraps, so the generator's values are the same there as before.

RTX 4060 8 GB (driver 621.01), Ryzen 7 5700X, 24 GB, Windows 11 26200, rustc 1.100.0, DXC 1.9.2609.5.

Not tested: a release build, AMD, any title, so no smoke blocks from me.

AI use: Claude Code (Claude Opus 5.5) ran the tests and drafted this; I read it before posting.

**@⁠MarcosMDev** on GitHub · 2026-11-26 12:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/2771#issuecomment-7191985261) **Test report: `6b2691e` against its base `af2cecc` on a desktop RTX 4060 (Windows): the 2 `texture_upload` tests fail 10 of 10 on the base and pass 10 of 10 here; full suite, no new failure.** No title was run. Debug, each tree in its own worktree and target folder, `cargo build --workspace --locked` first. - `cargo test -p xcl --lib hle::d3d12x::texture_upload::tests`, 10 times in a row: base 6 passed, 2 failed every time (`attempt to multiply with overflow` at `texture_upload.rs:1002`); head 8 passed, 0 failed every time. - Full suite, `cargo test --workspace --locked --no-fail-fast -- --test-threads=4`: base 1745 passed, 6 failed, 48 ignored; head 1747 passed, 4 failed, 48 ignored. The 4 left are the 2 late-release tests (counted 3 times; #2770) and `console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly`. The `kernelx` race you mention did not fail here. The same 30 SKIPPED lines on both. The change is inside `#[cfg(test)] mod tests`, and in a release build `n * …` already wraps, so the generator's values are the same there as before. RTX 4060 8 GB (driver 621.01), Ryzen 7 5700X, 24 GB, Windows 11 26200, rustc 1.100.0, DXC 1.9.2609.5. **Not tested:** a release build, AMD, any title, so no smoke blocks from me. AI use: Claude Code (Claude Opus 5.5) ran the tests and drafted this; I read it before posting.
Author
Owner

@⁠Prime1997 on GitHub · 2026-11-26 13:19 UTC · original · reviewed

Good targeted test result; retain this PR. Clean exact head 6b2691e18b02fd5f5efcca5c8e27db93e3ce727a: 2 passed, 0 failed, 0 ignored, 0 reported skips. No production or fixture edits were made.

  • hle::d3d12x::texture_upload::tests::pieces_hold_the_texels_of_their_levels: passed; CPU layout/fill assertions using D3D12 device layouts, no command submission in this test body.
  • hle::d3d12x::texture_upload::tests::gpu_parts_of_a_texture_go_up_and_the_rest_stays: passed; bounded texture upload/readback assertions. The fixture may omit partial rounds with zero pieces while still running full uploads.

Adapter attribution remains blocked: these fixtures call D3D12CreateDevice(None) and can fall back to WARP. Their logs do not identify the selected adapter, so this is not a confirmed NVIDIA hardware result even though an RTX 3060 Ti is installed and XCL_ADAPTER was requested. The passing assertions remain useful functional evidence.

Build: cargo test --locked --offline -p xcl --lib --no-run --message-format=json --target-dir <isolated-target>. Run each exact test name in a fresh process: <test-exe> <exact-name> --exact --test-threads=1 --nocapture. Windows 11 Pro 26200, i5-10400, 32 GiB, Rust 1.100.0 MSVC debug. Private target paths are placeholders. Test processes had a 90-second process-tree deadline, isolated caches/data, one DXC worker, one pipeline worker, XCL_ASYNC_PSO=1 XCL_LATE_RELEASE=1 XCL_UMA_WINDOWS=4 XCL_UMA_MB=16 XCL_COHERENT_MB=16 XCL_HEAP_WINDOWS=0, and the pinned private compiler.

Compiler SHA-256: dxcompiler 0689e2fee0a1c9df8662a59680469f24e2a3ad7ce6bbbcc9284f7a83172bfc59; dxil 64be2368211d257a038a7d4ea6bb3e24c878eb8d588c7b8414fccf759b69c2ac.

Latest refs checked: main b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7, nvidia-dev af2cecc40886a8682ecf3267f5328c6dc4b66ad7. The native results above are on the exact PR head, not a main integration. Source-only merge-tree against latest main reports clean; that does not validate a rebased build. Full-suite, gameplay, performance and general driver compatibility are not established.

AI use: Codex (GPT-6) inspected the fixtures, ran the bounded checks and audited the raw results. Optional temporary Discord for coordinating contributor work, testing and comparing results.

**@⁠Prime1997** on GitHub · 2026-11-26 13:19 UTC · [original](https://github.com/xcl-dev/xcl/pull/2771#pullrequestreview-6074813201) · **reviewed** **Good targeted test result; retain this PR.** Clean exact head `6b2691e18b02fd5f5efcca5c8e27db93e3ce727a`: **2 passed, 0 failed, 0 ignored, 0 reported skips**. No production or fixture edits were made. - `hle::d3d12x::texture_upload::tests::pieces_hold_the_texels_of_their_levels`: passed; CPU layout/fill assertions using D3D12 device layouts, no command submission in this test body. - `hle::d3d12x::texture_upload::tests::gpu_parts_of_a_texture_go_up_and_the_rest_stays`: passed; bounded texture upload/readback assertions. The fixture may omit partial rounds with zero pieces while still running full uploads. **Adapter attribution remains blocked:** these fixtures call `D3D12CreateDevice(None)` and can fall back to WARP. Their logs do not identify the selected adapter, so this is not a confirmed NVIDIA hardware result even though an RTX 3060 Ti is installed and `XCL_ADAPTER` was requested. The passing assertions remain useful functional evidence. Build: `cargo test --locked --offline -p xcl --lib --no-run --message-format=json --target-dir <isolated-target>`. Run each exact test name in a fresh process: `<test-exe> <exact-name> --exact --test-threads=1 --nocapture`. Windows 11 Pro 26200, i5-10400, 32 GiB, Rust 1.100.0 MSVC debug. Private target paths are placeholders. Test processes had a 90-second process-tree deadline, isolated caches/data, one DXC worker, one pipeline worker, `XCL_ASYNC_PSO=1 XCL_LATE_RELEASE=1 XCL_UMA_WINDOWS=4 XCL_UMA_MB=16 XCL_COHERENT_MB=16 XCL_HEAP_WINDOWS=0`, and the pinned private compiler. Compiler SHA-256: dxcompiler `0689e2fee0a1c9df8662a59680469f24e2a3ad7ce6bbbcc9284f7a83172bfc59`; dxil `64be2368211d257a038a7d4ea6bb3e24c878eb8d588c7b8414fccf759b69c2ac`. Latest refs checked: main `b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7`, nvidia-dev `af2cecc40886a8682ecf3267f5328c6dc4b66ad7`. The native results above are on the exact PR head, not a main integration. Source-only merge-tree against latest main reports **clean**; that does not validate a rebased build. Full-suite, gameplay, performance and general driver compatibility are not established. AI use: Codex (GPT-6) inspected the fixtures, ran the bounded checks and audited the raw results. Optional temporary [Discord](https://discord.gg/gK3y7WRRY) for coordinating contributor work, testing and comparing results.
This pull request can be merged automatically.
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/2771/head:github-bot/gh-2771'
git switch 'github-bot/gh-2771'

Merge

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