DirectStorage: count delivered bytes only upon successful completion (#2059) #2084
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2094"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by IAmTheSween on 2026-11-25T03:51:26Z.
Fixes #2059.
Previously, note_request() incremented dstorage::counters().1 (BYTES) upon request arrival, prior to read or decompression. Requests that failed (such as reads past EOF, invalid file handles, corrupted decompression streams, or access violations) delivered 0 bytes to the destination buffer but still inflated the delivered bytes counter.
Move delivered byte tracking to note_delivered(), called strictly upon successful transfer in serial execute() and parallel decompression retirement (retire_one()).
What is in it
Tested
Regression run
scripts/smoke.ps1 on main (
cbc296ab65) and on this PR's head commit (1d1ff8c2db):Not tested
AI use
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-25T05:15:27Z.
Full-suite run, since this PR has no test report yet. Tested exact head
1d1ff8c(on its basecbc296a).Tested
cargo build --workspace, thenXCL_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: 1143 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.failed_read_does_not_increase_delivered_bytes_counter.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1154 passed, 0 failed, 46 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #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 #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 #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 #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 #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on main6020a33too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests,const_and_null_mask_operands_agree_with_hlsl_on_the_gpuandmask_ff0_and_flbit_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T05:43:42Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-25T05:47:33Z.
A regression run under Wine on Linux on the retail title: no device removal, no crash, frames level with
main(1412 here; 1360 and 1374 on the twomainruns). No DirectStorage read failed in this run as far as the log shows, so the changed counter path is not seen; this is a regression run only. The new testfailed_read_does_not_increase_delivered_bytes_counterpasses under Wine.Tested
x86_64-pc-windows-gnu.1d1ff8cas it is (based oncbc296a) andmain6020a33, no uncommitted changes. Retail title 1.0.2.1,scripts/linux/smoke.sh(#257) for 60 s, no input. Runs in order: main, this PR (with other PRs in between), main. The new lib tests ran under Wine, one test per process.Regression run
main (first run):
this PR:
The second
mainrun: 1374 frames,exit: 0x0, no device removal, no crash. Under Wine,peak commitreads 0 MB, so these blocks do not check memory.Not tested
AI use
Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T10:46:11Z.
Code review on
1d1ff8c:BYTESaccounting intonote_delivered(n)after successful writes inexecute(dstorage.rs) andparallel.rspreservesREQUESTSvsFAILEDparity and adds unit coverage (failed_read_does_not_increase_delivered_bytes_counter).#2159(8c19c0a), which also modifiesBYTES/REQUESTSaccounting indstorage.rs+parallel.rs.Remaining before merge: Fix
PR description, ensureBuild and testfinishes green on1d1ff8c, and dual-vendor verification.Imported from ivall/xcl. Originally posted by CalvyPZ on 2026-11-25T22:44:12Z.
This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T08:59:26Z.
Review: COMMENTED
At exact head
1d1ff8c(base08db802, current mainb49be18), the new byte-counter regression test can fail under the repository's parallel lib-test run even when delivery accounting is correct. This is a source-derived test review; I did not reproduce a scheduling failure.failed_read_does_not_increase_delivered_bytes_countersamples process-globalcounters().1before and after its successfulexecute, then again after its failedexecute, and requires exact deltas of 16 and 0. Other DirectStorage queue tests in the same lib binary submit successful requests throughexecute/note_delivered; one can increment the globalBYTESbetween either pair of samples. A test-only mutex would not isolate those other producers. The full suite normally runs multiple test threads, so this can report a false failure unrelated to the PR's behavior.Could the exact-delta assertion run in an isolated subprocess, or use an injected local counter sink for the two requests? A parallel test with a forced competing successful request would make the isolation requirement visible.
AI assistance: GPT-6.2 Sol identified the shared counter; GPT-6.2 Astra verified the exact-head test and other request paths.
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T09:04:09Z.
Independent desktop NVIDIA verification of PR #2094 at head
1d1ff8c2dbd72ac7af02e178acf32574b2470c53(1commit; exact parent & merge-base:cbc296ab65a2661a61e3e2da109134bcd5319f60, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
1d1ff8c2)cargo test --release -p xcl --lib failed_read_does_not_increase_delivered_bytes_counter -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1124 filtered out× 3 (0.02s× 3,0skipped)cargo test --release -p xcl --lib hle::dstorage:: -- --test-threads=1(3 consecutive runs)31 passed; 0 failed; 0 ignored; 1094 filtered out× 3 (0.14s× 3,0skipped)cargo build --release -p xcl1m 27s, exit0,0new warnings)Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
cbc296ab65a2661a61e3e2da109134bcd5319f60, cached baseline on the same machine):PR #2094 (
1d1ff8c2dbd72ac7af02e178acf32574b2470c53):Limits of coverage
note_delivered()in serialexecute()and parallel decompression retirement, excluding failed reads) was directly verified viafailed_read_does_not_increase_delivered_bytes_counter(3/3) andhle::dstorage::(31/31× 3).title: 29640639(single-run peak-commit delta vs. cached parent reflects normal startup variance, not this PR); no failed DirectStorage requests were injected during the live retail smoke.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:21:17Z.
Triage (#1607) – head
1d1ff8c#2159 fixes the same thing (#2059). In
executeand the parallel path it moves theBYTESincrement to after a successful write, just as this PR does. It also movesREQUESTS, so failed requests are no longer counted as run, whichcounters()documents as 'requests run'. It has no test. This PR is first, keepsREQUESTSas documented, and has a test.One problem:
failed_read_does_not_increase_delivered_bytes_counterasserts exact deltas of the globalcounters().1. Other dstorage tests running in parallel can add to the counter between the two reads, so the test can fail intermittently. Asserting only that the failed request adds nothing, or serialising the test, would avoid that.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.