Textures: a layout's high-coordinate tables hold one period, not 65536 entries #435
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!435
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/435/head"
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?
@Cattn on GitHub · 2026-11-24 00:15 UTC · original
Cattn:tiling-swizzle-table-size→main· +43 −1 · 1 files · 1 commits · merged 2026-11-24 02:34 UTCPart of #248 (memory while a title streams its world).
Every
xg::Texturebuilds its owngpu::tiling::Layout, andLayout::from_bitsbuilt the tables for the coordinates above a block (hx,hy,hz) over the whole 16-bit coordinate range. For a 2D surface the z table alone is 65,536u32entries, so 256 KiB of CPU memory per live tiled title texture. The entries depend only on the coordinate bits the block's pattern masks actually use, which is 1 to 32 entries. Each table now covers the power of two above the highest such bit, or one entry when none is used.offset_zalready indexes the tables modulo their length, so every offset is unchanged.What is in it
crates/xcl/src/gpu/tiling.rs:Layout::from_bitssizes each high-coordinate table from the OR of the masksbits[..blk]use on that axis, above the in-block bits.high_coordinate_tables_keep_their_offsets_at_one_period. Every 2D mode and thick 3D mode, element size and pipe configuration in the existing test sets is compared against tables of the full 16-bit range, for coordinates up to 2^18 and past 32 bits. It fails before the change ("2D mode 1 e 0 …: 65536 z entries").Tested
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4: 677 passed, 0 failed, 41 ignored.gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.cargo test --release -p xcl --lib tiling: 12 passed. The new test fails with the old table size.Regression run
main:
PR:
The main run was the first after a fresh build of a new main and filled the shader cache; I don't attribute the frame difference to this change.
Not tested
AI use
@MesshM on GitHub · 2026-11-24 00:28 UTC · original
Test run of
a94e1511e0a5f378ff10e4daf701ebaa9da506ebon AMD (RDNA4), which Not tested lists.Tested
backend 'real' – AMD Radeon RX 9060 XT (16191 MiB VRAM))stable-x86_64-pc-windows-msvc, debug.\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 677 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 637 passed, 0 failed, 21 ignoredSKIPPEDon this adapter, so the two wave64 tests skipped on the RTX 4070 ran and passed heremaina6f5f7a: 676 passed, 0 failed, 41 ignored; the only difference is the new testLayout::from_bitschange reverted,cargo test -p xcl --lib high_coordinate_tables: 0 passed, 1 failed (2D mode 1 e 0 PipeConfig { pipes_log2: 0, pkrs_log2: 0 }: 65536 z entries), as the description saysReview of the change: the high-coordinate tables are read only in
offset_z(tiling.rs:176), always ast[(c / b) % t.len()]. The new size is a power of two above the highest mask bit used on that axis, so it divides the old length and every lookup gives the same entry; with no bit used the table has one entry, as before. I found nothing to change.Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build, memory use not measured.Run and report by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@mastrr9 on GitHub · 2026-11-24 00:30 UTC · original
Code audit + NVIDIA RTX 5080 test run on
a94e1511e0a5f378ff10e4daf701ebaa9da506eb:Review
Looks clean and mathematically exact:
offset_zindexes high-coordinate tables with(c / b) % t.len(), andused = OR_{i < blk} ((bits[i] >> shift) & 0xFFFF) >> l.min(16)masks every bit ofc / bthat can affect any parity term.1 << (32 - used.leading_zeros())is always a power of two in1..=1 << (16 - l.min(16))(1 whenused == 0, e.g. 2Dhz), preserving exact periodicity while shrinking 2Dhztables from 256 KiB to 4 bytes.Tested
rustc 1.100.0(MSVC), debug build.cargo build --workspace && cargo test --workspace -- --test-threads=4: 677 passed, 0 failed, 41 ignored.gpu::tiling::tests::high_coordinate_tables_keep_their_offsets_at_one_period: passed.SKIPPEDGPU tests (2, wave32-only adapter):gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64.Not tested
scripts/smoke.ps1run (test suite only).AI use: code review and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above.
@TheHoracio on GitHub · 2026-11-24 00:36 UTC · original
Test report on AMD RDNA3: RX 7800 XT (16 GB), driver 32.0.32015.7029, Ryzen 7 9800X3D, Windows 11 Pro 10.0.26300, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug build. No retail data was used.
Tested: the PR head
a94e151as it is (on its basea6f5f7a, not merged onto current main).cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4: 677 passed, 0 failed, 41 ignored, no SKIPPED tests.high_coordinate_tables_keep_their_offsets_at_one_periodpasses. This covers the AMD GPUs item under Not tested for RDNA3, for the test suite only.Not tested: a regression run on a title, a release build, and the head merged onto current
main.AI use: Claude Code ran the commands and drafted this comment; the runs are real runs on the hardware above.
@alpz1000 on GitHub · 2026-11-24 01:47 UTC · original
Independent CPU-side layout construction benchmark on an Intel Core i5-8400, Windows 11 Home 26200.9974, Rust 1.100.0 x86_64-pc-windows-msvc. Compared base
a6f5f7a74cc620c1f88a9e3669a633d10c3c8212with PR heada94e1511e0a5f378ff10e4daf701ebaa9da506eb.Tested: identical temporary release-mode Cargo example calling
Layout::new(mode, 2, PipeConfig { pipes_log2: 0, pkrs_log2: 0 }). Timings include construction and drop. Each process measured the median of ten batches of 200 layouts after one warm-up batch. Process order was base, PR, PR, base.cargo test --locked --release -p xcl --lib gpu::tiling::testsalso passed 12/12, including the high-coordinate offset regression. The temporary example was removed afterward.Not tested: retail performance, memory savings in a running title, or the full workspace suite. This benchmark measures only synthetic layout construction, with no GPU or game files needed.
AI use: OpenAI Codex (GPT-6) wrote the temporary benchmark, ran both builds and the tests, and drafted the report.
@imnicho on GitHub · 2026-11-24 02:05 UTC · original
Test report on a retail title streaming its world – the run listed under Not tested.
a94e151merged ontomain2997c9a, release; #334, #266 and #490 are merged in both builds as well (this PC does not get to the world's streaming in a useful time without them).Machine: Intel Core i7-7700K (4 cores / 8 threads), 16 GB RAM, NVIDIA GeForce RTX 5080 16 GB (driver 610.47), Windows 10 22H2 (19045), rustc 1.100.0. The newer retail title of the README, the same pad script (
XCL_PRESS_AT) for both, one run each.gpu::tiling::Layout::from_bits(underLayout::new←Chain::new_3d); the title presented almost no frame in that time, and in two earlier runs on that stack its null write (#232) came there.VirtualQueryEx(committed regions by allocation; residency sampled at one page in 16 withQueryWorkingSetEx), not from XCL's counters. Allocations of up to 16 MB are where the process heap's segments are.CopyFromSubresource, called with seven arguments (the fix is in #539; I had the same one locally).Not tested: AMD and Intel GPUs; more than one run of each build; the frame rate in the world (not reached).
AI use: Claude Code with Claude Fable 5.2 ran the builds and runs and wrote this report; every number is from a run on the machine named. No game files are attached.