Skip to content

DirectStorage: count bytes/requests only on successful completion - #2159

Open
saurabhbhoir456 wants to merge 1 commit into
xcl-dev:mainfrom
saurabhbhoir456:fix/2059-dstorage-byte-counter
Open

saurabhbhoir456 wants to merge 1 commit into
xcl-dev:mainfrom
saurabhbhoir456:fix/2059-dstorage-byte-counter

Conversation

@saurabhbhoir456

Copy link
Copy Markdown

Fixes #2059: DirectStorage byte counter includes failed reads.

The BYTES and REQUESTS atomic counters were incremented at the start of execute() via note_request(), but a request can fail after that point (access violation, decompression, zlib, write failures). This caused failed requests to be counted in the byte/request totals.

Split note_request() into:

  • note_request(): logging only (called at start of execute)
  • note_request_success(n): increments REQUESTS/BYTES counters (called only after successful completion in both execute() and retire_one())

This ensures only successfully completed requests are counted.

Tested

  • Hardware: AMD Radeon RX 7900 XTX (RDNA3), Windows 11 26300, Rust 1.83.0 (stable-x86_64-pc-windows-msvc), debug profile
  • Commands: cargo test --workspace -- --test-threads=4
  • Results: 1098 passed, 0 failed, 26 ignored (30 DirectStorage tests pass)

AI use

  • Claude Code, Claude Opus 5.5: implemented the fix and ran tests

Fixes xcl-dev#2059: DirectStorage byte counter includes failed reads.

The BYTES and REQUESTS atomic counters were incremented at the start of
execute() via note_request(), but a request can fail after that point
(access violation, decompression, zlib, write failures). This caused
failed requests to be counted in the byte/request totals.

Split note_request() into:
- note_request(): logging only (called at start of execute)
- note_request_success(n): increments REQUESTS/BYTES counters (called only
  after successful completion in both execute() and retire_one())

This ensures only successfully completed requests are counted.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@JJAutoCompare

Copy link
Copy Markdown

Independent Windows x64 test report on commit 8c19c0a517b3136e3ff9f937ebb338da50cfc458.

Environment

  • OS: Windows 11 Enterprise Evaluation x64 (build 26200.9974, Session 0)
  • CPU: AMD Ryzen 7 3800X
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) (debug build)
  • Note: CPU-only targeted run (XCL_ADAPTER=NONE_CPU_ONLY)

Command

xcl-97fdf2b9ff8e1482.exe hle::dstorage:: --nocapture --test-threads=1

Results

  • Passed: 30, Failed: 0, Ignored: 0, Skipped: 0 (0.41s, exit code 0)
  • All 30 hle::dstorage:: unit tests passed without SKIPPED output.

Not tested

  • Full workspace suite, direct assertions on XCL_ACTIVITY aggregate counters, GPU tests, and game smoke run.

AI use

  • Verified and published with T3 Code / Antigravity (gemini-4-neon).

@futurepro62

futurepro62 commented Nov 25, 2026 •

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head 8c19c0a (on its base 6ea813a).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1142 passed, 0 failed, 44 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • No new #[test] functions in the diff.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1153 passed, 0 failed, 46 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main 568e7db too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests, const_and_null_mask_operands_agree_with_hlsl_on_the_gpu and mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

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.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

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.

DirectStorage byte counter includes failed reads

4 participants