Skip to content

fix(hle): harden gpu_bcpack batch error/worker fallback & bump bcpack-gpu-sdk v0.15.1 - #20

Open
POMXARK wants to merge 1 commit into
HumanlyDev:mainfrom
POMXARK:fix/gpu-bcpack-v0151-fallback
Open

POMXARK wants to merge 1 commit into
HumanlyDev:mainfrom
POMXARK:fix/gpu-bcpack-v0151-fallback

Conversation

@POMXARK

@POMXARK POMXARK commented Nov 26, 2026

Copy link
Copy Markdown

Follow-up to #10 and #8 on top of main (60fe765f), keeping #8's zero-copy src_ptr/out_ptr Job representation intact while adding early batch-error isolation, non-panicking worker spawn fallback, and bcpack-gpu-sdk v0.15.1.

Summary

  • Bumps bcpack-gpu-sdk to v0.15.1 (96b7e757) in Cargo.toml and Cargo.lock, which initializes every item.status = -1 in BcPackDecodeBatch and BcPackDecodeBatchToTextures before ctx.is_null(), catch_unwind, and wait_compute_cpu.
  • Hardens BcPackBatchItem error handling (crates/victory-hle/src/modules/gpu_bcpack.rs decode_batch_with):
    • Initializes all valid BcPackBatchItem::status fields to -1 (failure sentinel) rather than 0.
    • Checks the aggregate BcPackDecodeBatch return value (if rc < 0) and fails the entire batch cleanly so callers never treat untouched zero/destination buffers as decoded output if an early SDK error (e.g. -99) occurs.
  • Graceful worker thread fallback (sender() -> Option<&'static Sender<Job>>):
    • Replaces .spawn(...).expect(...) with .spawn(...).ok().map(|_| tx) and submit_with_sender(sender(), ...) so worker creation failure returns None and falls back cleanly to CPU victory_formats::bcpack::decode.
  • Regression tests: Adds batch_early_error_return_rejects_items and unavailable_worker_falls_back_without_panicking.

Verification (Windows 11 + NVIDIA GeForce RTX 5080, head a05a1e26)

  • cargo clippy --locked -p victory-hle -- -D warnings: PASS (0 warnings)
  • cargo clippy --locked -p victory-hle --features gpu-bcpack -- -D warnings: PASS (0 warnings)
  • cargo test --release --locked -p victory-hle --features gpu-bcpack gpu_bcpack -- --nocapture: 4 passed; 0 failed
    • unavailable_worker_falls_back_without_panicking: ok
    • batch_early_error_return_rejects_items: ok
    • gpu_bcpack_matches_victory_cpu: ok (0 mismatches across BC1/3/4/5/6H/7)
    • gpu_bcpack_batch_coalescing_matches_cpu: ok (12/13 mixed + 6-thread coalescing: 0 mismatches)

Note on CI Clippy, diagnostics build (--all-features): HumanlyDev/HUMAN:main (60fe765f) currently fails --all-features compilation at crates/victory-gpu/src/descriptor/host.rs:1322 (#[cfg(feature = "diagnostics")] accessing .1 on DynamicSlots), which is pre-existing on main and unrelated to this PR.

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.

1 participant