Skip to content

DirectStorage: handle BCPack output allocation failure - #1381

Open
hajduzsolt wants to merge 1 commit into
xcl-dev:mainfrom
hajduzsolt:fix/bcpack-output-allocation
Open

hajduzsolt wants to merge 1 commit into
xcl-dev:mainfrom
hajduzsolt:fix/bcpack-output-allocation

Conversation

@hajduzsolt

@hajduzsolt hajduzsolt commented Nov 24, 2026 •

Copy link
Copy Markdown

What is in it

  • Return a distinct allocation error for the output buffer, with a synthetic regression for every supported mode.

Tested

  • Windows 11 Pro x64 build 26300, Ryzen 7 9800X3D, Radeon RX 9070 XT, driver 32.0.32029.2010; Rust 1.98.1 MSVC, debug.
  • cargo build --workspace
  • cargo test -p xcl --lib oversized_output_returns_allocation_error: 1 passed.
  • cargo test --workspace -- --test-threads=4 --nocapture: 752 passed, 0 failed, 41 ignored. The reported passes include tests that return early.
  • SKIPPED: test_title_draws_with_a_root_signature_under_the_debug_layer and uploads_start_from_each_subresources_state, because the D3D12 debug layer is unavailable.

Regression run

main:

xcl-smoke v1
commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7
gpu: AMD Radeon RX 9070 XT
title: A newer retail game
seconds: 60
exit: 0x0
frames shown: 1675 (PresentX 1675)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14837 MB

PR:

xcl-smoke v1
commit: a71455945d0373b19b67f845251a4e1991509374
gpu: AMD Radeon RX 9070 XT
title: A newer retail game
seconds: 60
exit: 0x0
frames shown: 1674 (PresentX 1674)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14838 MB

Not tested

  • Retail title, debug layer, and adapters other than the one above. This change handles output reservation failure; it does not bound all intermediate allocations or prevent operating-system overcommit.

AI use

  • Codex, GPT-6: investigation, implementation, synthetic test, and validation.

Return a decoder error when the requested output cannot be allocated instead of panicking on an impossible capacity.
@futurepro62

futurepro62 commented Nov 24, 2026 •

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head a714559 (on its base 930e8b4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: oversized_output_returns_allocation_error.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored, no skips.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@hajduzsolt
hajduzsolt marked this pull request as draft November 24, 2026 15:33
@DavidM1911

Copy link
Copy Markdown
Contributor

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

@throny

throny commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Two contributors checked independently and found that #1438 #1785 solves the same problem (for #1392) in a different way: #1607, group D54. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.

This is a hint from the community triage in #1607, not a maintainer decision.

AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.

@anes66

anes66 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

CPU-only allocator-refusal verification on exact head a71455945d0373b19b67f845251a4e1991509374 passed. Optional test companion 98886cb adds one test only, directly on that head.

The existing usize::MAX regression covers a capacity overflow. This additional case uses a representable, block-aligned 128 MiB output size and a 64 MiB Windows Job Object process-commit cap applied only to an isolated test child, so it exercises a real allocator refusal without exhausting the machine's memory.

Tested

  • Windows 10 Pro 19045, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, debug. No GPU, DXC, title or proprietary input.
  • All six supported modes (1, 3, 4, 5, 6, 7) returned Error::Allocation; the child completed normally. Creating/configuring/assigning the job must succeed or the test fails.
  • cargo test --locked -p xcl --lib hle::bcpack::tests:: -j 2 -- --nocapture --test-threads=1: 8 passed / 0 failed / 0 ignored / 0 skips. This includes the original oversized-output test, synthetic fixtures, malformed-input checks and the new child test. The nested child summary is the same test invocation and is not counted again.
  • Temporary negative control restored the original vec![0u8; out_len]: the child aborted and stderr contained memory allocation of 134217728 bytes failed; the parent test failed as expected. Restored before the final passing suite and commit.

Not tested
Whole-system exhaustion, intermediate decoder allocations, downstream DirectStorage error mapping, release, full workspace/GPU suite, retail smoke or newer-main integration. This verifies graceful refusal of the output allocation, not that every allocation in a title run becomes recoverable or that #1381 fixes a particular retail crash.

AI use: Codex (GPT-6; exact variant unavailable) wrote the test and temporary negative control, ran CPU verification and prepared this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants