Repository navigation
Conversation
The rANS lanes a BCPack stream is split into, for BC1, BC3, BC4, BC5, BC6H and BC7: a port of the decoder module of Microsoft's silicon-rans sample (MIT), with the byte feeder and symbol release after the format notes of bcpack-decoder and bcpack-rs (MIT, no code taken). The 128 static models are generated by scripts/gen_bcpack_tables.py from the sample. Nothing calls it yet; DirectStorage still refuses BCPack requests. Tested against fixtures from an encoder written independently from the notes (tests/data/bcpack/generate.py) and a round-trip encoder. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
BC1 blocks are rebuilt from the 12 lanes of the entropy stage (bc1.rs, after the BC1 sections of the bcpack-decoder and bcpack-rs format notes, MIT, no code taken). The rebuild needs two tables of constants that no stream carries: the 255 endpoint sets a stream starts with and the order of the 256 selector quadrants. bcpack-rs by Ahmet Dedeler (https://github.com/Ahmet-Dedeler/bcpack-rs, MIT) estimated both from retail data; bc1_fitted.rs is generated from its data files by scripts/gen_bcpack_bc1_tables.py and carries its MIT notice. The constants belong to the codec, not to a game. dstorage.rs runs the BCPack stage for BC1, alone or after zlib; every other mode is refused and counted as before. A stream the decoder does not take fails the request with E_DECOMPRESSION and writes nothing. report.json gets dstorage.bcpack_unpacked per mode (requests, bytes rebuilt, failed). The output is an approximation where an estimate is off: one history entry is not known (a block that refers to it fails the request), 17 differ by a step or so between fits on two halves of the data, and 8 rare quadrants may be swapped with their mirror. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
@Cattn your run of 🤖 Claude Opus 5.5 |
… requests are unpacked Their work, merged as it is. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Test report for #273 at Setup: AMD Radeon RX 9070 (16 GB; XCL's report.json: "AMD Radeon RX 9070 (16191 MiB VRAM)"), Ryzen 7 7800X3D, 31.2 GB RAM, Windows 11 Pro 10.0.26300, DXC 1.8.2502.11, rustc 1.98.1 (48a229cea 2026-09-01), release build for the runs, debug for the tests. Retail title 1.0.2.1, Regression run (
Frames 1503 vs 1505 (99.9 %), peak commit 14883 vs 14902 MB, no device removal, no crash. An earlier pair of runs with inputs gave 1194 ( BC1 effect, scripted menus (
Tests on 5f12643 ( |
|
@ExMoha thank you: the first run where this decoder is actually called. Both blocks are in the description under Regression run, and the BC1 and DirectStorage numbers under Tested. 🤖 Claude Opus 5.5 |
|
@ivall, for the provenance question you raised on #340: the facts on this PR's two BC1 tables, with no argument about whether they are acceptable. Sources: bcpack-rs at 1. How bcpack-rs made them
2. The same for every stream and title?
3. Another route to the same constants
4. What #208 needs
What we can do
Not checked: bcpack-rs's fits were not rerun (that needs game files; we have none), so both projects' statements are quoted, not verified. Whether they measured the same title. 🤖 Claude Fable 5.2 |
Stacked on #208. With this PR, DirectStorage unpacks BCPack BC1 requests, alone or after zlib, instead of refusing them. The BC1 blocks are rebuilt from #208's lanes with two tables of constants that no stream carries; XCL takes the estimates bcpack-rs made of them. BC3–BC7 requests are refused and counted as on
main.This is the second half of #208's earlier form (
a7ffb2f), which a tester ran on a retail title (below). One commit,5f12643, on #208's34c0ee5; GitHub shows both commits until #208 is merged.What is in it
hle/bcpack/bc1.rs: BC1 blocks from the 12 lanes. A back-reference for the endpoints, six zigzag differences, and four 2×2 selector quadrants through a codebook. It follows the BC1 sections of the format notes of bcpack-decoder and bcpack-rs, both MIT. No code was taken from either. The file's header names both, with URL and licence.hle/bcpack/bc1_fitted.rs: the two tables, which no specification publishes. One is the 255 endpoint sets a stream starts with; the other is the order of the 256 quadrants.python scripts/gen_bcpack_bc1_tables.py <bcpack-rs>/data/bc1_window.json <bcpack-rs>/data/bc1_quad_table.json(bcpack-rs at c51ec52; the script is in this PR). The file carries bcpack-rs's MIT notice.hle/bcpack/mod.rs:decode(mode, bytes, len)(lanes, then blocks), and the errorslane 1andunknown history.hle/dstorage.rs: a BC1 request runs the BCPack stage after zlib, or alone.E_DECOMPRESSIONand writes nothing, as a refusal does.XCL_DSTORAGE_BCPACK_FILLnow applies to the refused modes only.report.rs:report.jsongetsdstorage.bcpack_unpackedper mode, withrequests,destination_bytes(bytes of blocks rebuilt) andfailed.tests/data/bcpack/*.bc1: the blocks of DirectStorage: BCPack entropy stage for all modes, not yet called #208's BC1 fixtures, from the same independent encoder.THIRD_PARTY.md:bc1_fitted.rs, generated by the script above).Tested
cargo test --workspace -- --test-threads=4on5f12643: 659 passed, 0 failed, 40 ignored, with DirectStorage: BCPack entropy stage for all modes, not yet called #208's commit under it (SKIPPED GPU tests:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware, both "no wave64").cargo test -p xcl --lib bcpackon5f12643: 11 passed, 0 failed.cargo build -p xcladds no warning.a7ffb2f, merged ontomain60565c4plus D3D12.X: pipelines in two passes are drawn (console MS via DispatchMesh, VS+GS via Draw*) #215. "Without" is the same branch before the merge.report.json'sdstorage.bcpack_refusedcompared.a7ffb2f.git diff 6da33fa a7ffb2fandgit diff 9ab7d76 5f12643differ only in the provenance comments oflanes.rsandbc1.rs, which now carry the sources' URLs; no code line differs.mainhas moved since, so it is the same change but not the same build.More from that run:
BCPack BC1: first request unpacked (39541 to 65536 bytes), and one BC1 stream was not unpacked (BCPack BC1 streams not unpacked so far: 1).XCL_RUN_SECONDSended the run.cargo test --release -p xcl --lib bcpack: 11 passed.What the tests show, all on synthetic data:
bc1_fixtures_decode_to_their_blocks: DirectStorage: BCPack entropy stage for all modes, not yet called #208's independent BC1 fixtures decode to their blocks.bc1_block_rebuild: one block by hand, every field.fitted_bc1_tables_are_well_formed: every quadrant appears once, the ranges hold, and one block goes through the shipped tables.bcpack_bc1_requests_are_unpacked_alone_and_after_zlib: seven requests through a memory queue.IntermediateSize.IntermediateSize, a cut stream and a wrong block count; these three fail and write nothing.main's BCPack refusal tests now use BC3 / BC7 where they used BC1.With the fitted tables, five BC1 streams (8,926 blocks) give byte-identical blocks here and in bcpack-rs's CLI.
Mutations of the earlier form, each failing at least one of these tests:
execute;IntermediateSizenot compared.DirectStorage: BCPack entropy stage for all modes, not yet called #208 lists its other six.
Known to be approximate or assumed:
The BC1 tables are estimates. Per bcpack-rs:
A wrong history entry gives a slightly wrong colour in the blocks that refer to it and in the ones chained to them. bcpack-rs reports a median 35.4 dB against the next mip level, where 37.9 dB is the ceiling of that measure.
BC1 lane 1 is 0 in every stream the notes describe. A stream where it is not is refused (
lane 1); bcpack-rs ignores it instead.One request is taken to be one stream that unpacks to
DestinationSizebytes.IntermediateSize0 with zlib + BCPack is accepted; zlib may then yield any size up to the destination's. The GDK documents the field as the size of the stream BCPack reads. What a console does with 0 was not tested.The blocks are written in stream order. Requests with a swizzle mode are still refused.
Overlaps:
hle/dstorage.rs, so the two conflict there. It is opt-in (XCL_DSTORAGE_BCPACK_BC1=1) and takes the decoder from the bcpack-rs crate, a git dependency pinned to c51ec52 (MIT). It handles BC1 alone and zlib → BC1, into virtual or physical-page destinations. It rejects malformed streams, unknown lane-1 symbols and unfitted entries. It also changes the window title (present.rs,pso_async.rs), and its run on a title saw no BCPack request. This PR differs as follows:THIRD_PARTY.md, and takes only bcpack-rs's two generated tables;executeinhle/dstorage.rs: a destination page-array entry that is 0 at enqueue is read again at the request's turn. Its change is in the physical-page write; this PR's is in the stages before it (zlib, then BCPack).git merge-treeof5f12643with DirectStorage: a destination page array entry that is 0 at enqueue is read at the request's turn #289'sd0b6079gives no conflict. With both, a BC1 request into physical pages would go through DirectStorage: a destination page array entry that is 0 at enqueue is read at the request's turn #289's late read too; that combination is not tested.HANDOFF.mdsays "BCPack (and other console formats) are refused". With this PR that holds for every mode but BC1.docs/specs/2026-11-20-xcl-design.mdnames BCPack as having "no public decoder (risk)". Neither is edited here.scripts/smoke.ps1, 60 s, no input:main9ab7d761505 frames, peak commit 14902 MB; this PR5f126431503 frames, 14883 MB; exit 0x0, 0 device removals and 0 crashes in both.main85bdf21against it with5f12643merged: BC1 refusals 114 (3,383,296 bytes) to none,BCPack BC1: first request unpackedin the log; failed DirectStorage requests 220 to 26. BC5 and BC7 requests are still refused.cargo test --workspace -- --test-threads=4on5f12643: 659 passed, 0 failed, 40 ignored, no SKIPPED GPU tests (RDNA4).Regression run
Run by @ExMoha on a retail title (RX 9070, release, 60 s, no input, back to back; #273 (comment)). The
gpu:line names the CPU's integrated GPU (#281 / #285); the runs used the RX 9070. As posted:main:
PR:
Not tested
scripts/smoke.ps1, was ofa7ffb2f, and is not a substitute for it.physical_page_destinations_and_sourcescovers.AI use