bcpack: preserve all 32 indices in BC7 dictionary entry 0 #2007

Manually merged
github merged 1 commit from gh-pr/2007/head into gh-pr/2007/base 2026-11-26 05:14:24 +00:00
Owner

@⁠raylitebull on GitHub · 2026-11-25 00:39 UTC · original
raylitebull:fix/bcpack-bc7-dict0 → main · +16 −7 · 3 files · 1 commits · merged 2026-11-25 01:54 UTC

Fixes BC7 dictionary entry 0 in scripts/gen_bcpack_victory_tables.py and crates/xcl/src/hle/bcpack/tables.rs: in bcpack-tables.bin, entry 0 stores all 32 signed i16 indices directly after its two width bytes (bits: [4, 0]), whereas entries 1..254 repeat the two width bytes before 31 i16 indices. Skipping a u16 on entry 0 dropped its leading index (2) and left-shifted its remaining indices ([1, 0, ...] instead of [2, 1, 0, ...]).

Part of #1833.

What is in it

  • scripts/gen_bcpack_victory_tables.py: read 32 i16 indices directly when entry == 0, keeping the r.u16() repeated-width skip only for entry > 0.
  • crates/xcl/src/hle/bcpack/tables.rs: regenerated BC7[0] (ix[0] [1, 0, ...] -> [2, 1, 0, ...]).
  • crates/xcl/src/hle/bcpack/tests.rs: extended bc7_dictionary_indices_line_up to assert BC7[0] (ctrl == 0, bits == [4, 0], ix[0] == [2, 1, 0, ...], ix[1] == [0; 16]).

Tested

  • Toolchain: Windows 11 x64, rustc 1.99.1 (58cf8f9c3 2026-10-13), rebased cleanly onto 6567c5f (7881dbc).
  • cargo check --workspace --tests: passed.
  • cargo test -p xcl --lib bcpack: 10 passed, 0 failed.
  • Community verification on exact head 7881dbc:
    • @futurepro62: NVIDIA RTX 5070 Ti (986 passed, 0 failed, 43 ignored) and AMD Radeon RDNA2 iGPU (996 passed, 0 failed, 45 ignored).
    • @Anon64: NVIDIA RTX 3060 60 s scripts/smoke.ps1 pair vs main 80f4819 (1619 vs 1588 frames, 0 device removals, 0 crashes, 24293 vs 25481 MB peak commit).

Regression run
60 s scripts/smoke.ps1 pair on exact head 7881dbc vs main 80f4819 (NVIDIA GeForce RTX 3060 12 GB, driver 581.80, Windows 11 26200, release, XCL_NETWORK=0, A pressed every 4 s from 20 s on a retail title), contributed by @Anon64:

main 80f4819:

xcl-smoke v1
commit: 80f4819098e921f2e1ab371144d4832f68ffedd6
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1588 (PresentX 1588)
presents per 2 s (last 3): 41 48 30
device removals: 0
crashes: 0
peak commit: 25481 MB

this PR:

xcl-smoke v1
commit: 7881dbc946267a170be810ae4df5e69892f93209
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1619 (PresentX 1619)
presents per 2 s (last 3): 60 60 35
device removals: 0
crashes: 0
peak commit: 24293 MB

Not tested

  • Whether the 60 s smoke workload decodes a BC7 dictionary entry 0 payload; Linux/Wine/vkd3d-proton.

AI use

  • Antigravity assisted with inspection and test assertions; the author reviewed the diff and test output.
**@⁠raylitebull** on GitHub · 2026-11-25 00:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/2007) `raylitebull:fix/bcpack-bc7-dict0` → `main` · +16 −7 · 3 files · 1 commits · merged 2026-11-25 01:54 UTC Fixes `BC7` dictionary entry `0` in `scripts/gen_bcpack_victory_tables.py` and `crates/xcl/src/hle/bcpack/tables.rs`: in `bcpack-tables.bin`, entry `0` stores all 32 signed `i16` indices directly after its two width bytes (`bits: [4, 0]`), whereas entries `1..254` repeat the two width bytes before 31 `i16` indices. Skipping a `u16` on entry `0` dropped its leading index (`2`) and left-shifted its remaining indices (`[1, 0, ...]` instead of `[2, 1, 0, ...]`). Part of #1833. **What is in it** - `scripts/gen_bcpack_victory_tables.py`: read 32 `i16` indices directly when `entry == 0`, keeping the `r.u16()` repeated-width skip only for `entry > 0`. - `crates/xcl/src/hle/bcpack/tables.rs`: regenerated `BC7[0]` (`ix[0]` `[1, 0, ...]` -> `[2, 1, 0, ...]`). - `crates/xcl/src/hle/bcpack/tests.rs`: extended `bc7_dictionary_indices_line_up` to assert `BC7[0]` (`ctrl == 0`, `bits == [4, 0]`, `ix[0] == [2, 1, 0, ...]`, `ix[1] == [0; 16]`). **Tested** - Toolchain: Windows 11 x64, `rustc 1.99.1 (58cf8f9c3 2026-10-13)`, rebased cleanly onto `6567c5f` (`7881dbc`). - `cargo check --workspace --tests`: passed. - `cargo test -p xcl --lib bcpack`: 10 passed, 0 failed. - Community verification on exact head `7881dbc`: - `@futurepro62`: NVIDIA RTX 5070 Ti (`986 passed, 0 failed, 43 ignored`) and AMD Radeon RDNA2 iGPU (`996 passed, 0 failed, 45 ignored`). - `@Anon64`: NVIDIA RTX 3060 60 s `scripts/smoke.ps1` pair vs `main` `80f4819` (`1619` vs `1588` frames, `0` device removals, `0` crashes, `24293` vs `25481` MB peak commit). **Regression run** 60 s `scripts/smoke.ps1` pair on exact head `7881dbc` vs `main` `80f4819` (NVIDIA GeForce RTX 3060 12 GB, driver 581.80, Windows 11 26200, release, `XCL_NETWORK=0`, A pressed every 4 s from 20 s on a retail title), contributed by `@Anon64`: main `80f4819`: ``` xcl-smoke v1 commit: 80f4819098e921f2e1ab371144d4832f68ffedd6 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1588 (PresentX 1588) presents per 2 s (last 3): 41 48 30 device removals: 0 crashes: 0 peak commit: 25481 MB ``` this PR: ``` xcl-smoke v1 commit: 7881dbc946267a170be810ae4df5e69892f93209 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1619 (PresentX 1619) presents per 2 s (last 3): 60 60 35 device removals: 0 crashes: 0 peak commit: 24293 MB ``` **Not tested** - Whether the 60 s smoke workload decodes a BC7 dictionary entry `0` payload; Linux/Wine/vkd3d-proton. **AI use** - Antigravity assisted with inspection and test assertions; the author reviewed the diff and test output.
In bcpack-tables.bin, BC7 dictionary entry 0 stores all 32 signed i16
indices directly after its two width bytes, while entries 1..254 repeat
the two width bytes before 31 i16 indices. Skipping a u16 on entry 0
dropped its leading index (2) and shifted its remaining indices left by
one ([1, 0, ...] instead of [2, 1, 0, ...]).

Keep the repeated-width skip only for entries 1..254, regenerate
crates/xcl/src/hle/bcpack/tables.rs, and verify BC7[0] in tests.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:14:22 +00:00
github manually merged commit 7881dbc946 into gh-pr/2007/base 2026-11-26 05:14:24 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-25 01:04 UTC · original · edited 2026-11-25 01:25 UTC

Full-suite run, since this PR has no test report yet. Tested exact head 7881dbc (on its base 6567c5f).

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::dxil::fuzz_tests: 986 passed, 0 failed, 43 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: 996 passed, 0 failed, 45 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).
  • --skip leaves out tests that fail on main 7994cd1 too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (#1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests and const_and_null_mask_operands_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.
**@⁠futurepro62** on GitHub · 2026-11-25 01:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/2007#issuecomment-7149184661) · edited 2026-11-25 01:25 UTC Full-suite run, since this PR has no test report yet. Tested exact head `7881dbc` (on its base `6567c5f`). **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::dxil::fuzz_tests`: **986 passed, 0 failed, 43 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`: **996 passed, 0 failed, 45 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). - `--skip` leaves out tests that fail on main `7994cd1` too, not because of this PR. On NVIDIA: `heap_window_out_of_memory_falls_back_to_the_switch_form` (#1651), the four `gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu` tests and `const_and_null_mask_operands_agree_with_hlsl_on_the_gpu` ([follow-up on #1651](https://git.gtahub.st/github/xcl-dev--xcl/issues/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.
Author
Owner

@⁠Anon64 on GitHub · 2026-11-25 01:52 UTC · original

Regression run for this PR: head 7881dbc, based on main 80f4819. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, XCL_NETWORK=0, A pressed every 4 s from 20 s, scripts/smoke.ps1 on a retail title for 60 s, back to back with the main run.

main 80f4819:

xcl-smoke v1
commit: 80f4819098e921f2e1ab371144d4832f68ffedd6
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1588 (PresentX 1588)
presents per 2 s (last 3): 41 48 30
device removals: 0
crashes: 0
peak commit: 25481 MB

this PR:

xcl-smoke v1
commit: 7881dbc946267a170be810ae4df5e69892f93209
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1619 (PresentX 1619)
presents per 2 s (last 3): 60 60 35
device removals: 0
crashes: 0
peak commit: 24293 MB

No device removals or crashes; 101 % of main's frames, 95 % of its peak commit.

An earlier run of this head in a batch crashed at 37.8 s with five threads in the texture-detile access violation of #1359 / #751: VCRUNTIME140.dll memcpy, reads at 0xc48ff0000–0xc492b0000. The process then hung, as on main without #742. I see that crash on main too, in about 2 of 25 runs here. In the two reruns of this head it did not come back, so I do not attribute it to this PR.

Not tested: the whole suite; whether the title decodes a BC7 dictionary entry 0 in these 60 s.

Written with Claude Code (Claude Opus 5.5) from runs on this machine.

**@⁠Anon64** on GitHub · 2026-11-25 01:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/2007#issuecomment-7150050696) Regression run for this PR: head `7881dbc`, based on `main` `80f4819`. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, `XCL_NETWORK=0`, A pressed every 4 s from 20 s, `scripts/smoke.ps1` on a retail title for 60 s, back to back with the `main` run. main `80f4819`: ``` xcl-smoke v1 commit: 80f4819098e921f2e1ab371144d4832f68ffedd6 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1588 (PresentX 1588) presents per 2 s (last 3): 41 48 30 device removals: 0 crashes: 0 peak commit: 25481 MB ``` this PR: ``` xcl-smoke v1 commit: 7881dbc946267a170be810ae4df5e69892f93209 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1619 (PresentX 1619) presents per 2 s (last 3): 60 60 35 device removals: 0 crashes: 0 peak commit: 24293 MB ``` No device removals or crashes; 101 % of main's frames, 95 % of its peak commit. An earlier run of this head in a batch crashed at 37.8 s with five threads in the texture-detile access violation of #1359 / #751: `VCRUNTIME140.dll` memcpy, reads at `0xc48ff0000`–`0xc492b0000`. The process then hung, as on `main` without #742. I see that crash on `main` too, in about 2 of 25 runs here. In the two reruns of this head it did not come back, so I do not attribute it to this PR. **Not tested:** the whole suite; whether the title decodes a BC7 dictionary entry 0 in these 60 s. Written with Claude Code (Claude Opus 5.5) from runs on this machine.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 01:53 UTC · original

Thanks @⁠Anon64 for running and sharing the 60 s scripts/smoke.ps1 pair on 7881dbc vs 80f4819 (1619 vs 1588 frames, 0 device removals, 0 crashes, 24293 MB vs 25481 MB peak commit) — added to the PR description! Thanks also to @⁠futurepro62 for verifying exact head 7881dbc across NVIDIA RTX 5070 Ti (986/0/43) and AMD Radeon RDNA2 iGPU (996/0/45).

**@⁠raylitebull** on GitHub · 2026-11-25 01:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/2007#issuecomment-7150088127) Thanks @⁠Anon64 for running and sharing the 60 s `scripts/smoke.ps1` pair on `7881dbc` vs `80f4819` (`1619` vs `1588` frames, `0` device removals, `0` crashes, `24293` MB vs `25481` MB peak commit) — added to the PR description! Thanks also to @⁠futurepro62 for verifying exact head `7881dbc` across NVIDIA RTX 5070 Ti (`986/0/43`) and AMD Radeon RDNA2 iGPU (`996/0/45`).
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 03:51 UTC · original

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!

**@⁠DavidM1911** on GitHub · 2026-11-25 03:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/2007#issuecomment-7152304845) 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!
This discussion has been locked. Commenting is limited to contributors.
No description provided.