xg_xs copy_elements: dispatch fixed element widths 1/2/4/8/16 to a compile-time-sized copy loop (RT-TEXEL-COPY-FIXEDWIDTH) #1880

Merged
thiefyzheng merged 1 commit from upstream-pr/1880 into main 2026-12-01 11:11:20 +00:00
thiefyzheng commented 2026-11-25 14:01:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thiefyzheng on 2026-11-25T14:01:14Z.


RT-TEXEL-COPY-FIXEDWIDTH

Claimed on #1608 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7164508666); implements the first of @cheltyi's two findings (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7164354183): runtime/shims/xg_xs_layout.h's copy_elements issued a runtime-sized memcpy per texel/block — the path TitleImageUpload::write uses during runtime texture refresh. The finder's prototype (876 comparisons, ASan/UBSan clean, 4.54→0.596 ms on a synthetic 1024x1024 RGBA8 tiled texture under MinGW GCC 16.2 -O3) is the origin of this change; those numbers are the finder's, not re-measured here.

What

  • The per-element x-loop moved into copy_tiled_row<Into, Width>; copy_elements does ONE switch (bytes) per row: widths 1/2/4/8/16 get a compile-time Width, everything else takes Width = 0 — a verbatim copy of the old runtime-size loop. Address math untouched; linear textures still copy whole rows and never reach the element loop.

Verification

  • New runtime/test/texel_copy_test.cpp (ctest texel_copy, no GPU): runs copy_elements against a verbatim copy of the old loop, comparing the WHOLE destination buffer (bytes the copy must not touch are checked too). Corpus: 17 textures — R8, R16, RGBA8, RGBA16F, RGBA32F, BC1, BC3, BC5 (all five specialized widths) — tiled 4kb/64kb, linear, full mip chains with tails, arrays, 1D linear, 3D volumes; every case at 3 pointer misalignments × 3 pitch paddings; BOTH directions; and every case re-run with the width forced to 3/6/12 to prove the fallback path is unchanged.
  • g++ 20, ASan+UBSan: 306 checks, 0 failures. Guard check: breaking the width-4 path on purpose makes the test fail 27 checks.
  • MSVC /W4 /permissive- (VS 2022, winvm): texel_copy_test built; ctest -R texel_copy Passed (4.57 s).
  • NOT done here: timing (the finder's prototype numbers stand as the only measurements; frame-time benefit needs a streaming/dynamic-texture workload owner, as the finding itself says); xg_xs_test and d3d12_existing_heap_test were not run (no device on this host).

Attribution

AI-assisted (Claude Sonnet 5.5 worker implementation, contributor verification incl. the winvm MSVC build, orchestration).

Rebase verification — 2026-11-30

  • Rebased onto 71a769d7d85208f86c6e2e50263aca7df1becce9; head 1cd6eaf7c67e05d0f9183da0869843acc498fadb.
  • Linux GCC 14.2 C++20 ASan+UBSan focused test: 306 checks, 0 failures (scratch-only DXGI constants, no repository changes).
  • Portable CMake runtime build; ctest 56/56 passed, optional shader_library_corpus skipped.
  • Windows/MSVC, GPU/device tests and performance benchmarks were not rerun after this rebase.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5492814317 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1880). Originally posted by [thiefyzheng](https://github.com/thiefyzheng) on 2026-11-25T14:01:14Z. --- ## RT-TEXEL-COPY-FIXEDWIDTH Claimed on #1608 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7164508666); implements the first of @cheltyi's two findings (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7164354183): `runtime/shims/xg_xs_layout.h`'s `copy_elements` issued a runtime-sized `memcpy` per texel/block — the path `TitleImageUpload::write` uses during runtime texture refresh. The finder's prototype (876 comparisons, ASan/UBSan clean, 4.54→0.596 ms on a synthetic 1024x1024 RGBA8 tiled texture under MinGW GCC 16.2 -O3) is the origin of this change; those numbers are the finder's, not re-measured here. ### What - The per-element x-loop moved into `copy_tiled_row<Into, Width>`; `copy_elements` does ONE `switch (bytes)` per row: widths 1/2/4/8/16 get a compile-time `Width`, everything else takes `Width = 0` — a verbatim copy of the old runtime-size loop. Address math untouched; linear textures still copy whole rows and never reach the element loop. ### Verification - New `runtime/test/texel_copy_test.cpp` (ctest `texel_copy`, no GPU): runs `copy_elements` against a verbatim copy of the old loop, comparing the WHOLE destination buffer (bytes the copy must not touch are checked too). Corpus: 17 textures — R8, R16, RGBA8, RGBA16F, RGBA32F, BC1, BC3, BC5 (all five specialized widths) — tiled 4kb/64kb, linear, full mip chains with tails, arrays, 1D linear, 3D volumes; every case at 3 pointer misalignments × 3 pitch paddings; BOTH directions; and every case re-run with the width forced to 3/6/12 to prove the fallback path is unchanged. - g++ 20, ASan+UBSan: **306 checks, 0 failures**. Guard check: breaking the width-4 path on purpose makes the test fail 27 checks. - **MSVC `/W4 /permissive-` (VS 2022, winvm)**: `texel_copy_test` built; `ctest -R texel_copy` **Passed** (4.57 s). - **NOT done here**: timing (the finder's prototype numbers stand as the only measurements; frame-time benefit needs a streaming/dynamic-texture workload owner, as the finding itself says); `xg_xs_test` and `d3d12_existing_heap_test` were not run (no device on this host). ### Attribution AI-assisted (Claude Sonnet 5.5 worker implementation, contributor verification incl. the winvm MSVC build, orchestration). ### Rebase verification — 2026-11-30 - Rebased onto `71a769d7d85208f86c6e2e50263aca7df1becce9`; head `1cd6eaf7c67e05d0f9183da0869843acc498fadb`. - Linux GCC 14.2 C++20 ASan+UBSan focused test: **306 checks, 0 failures** (scratch-only DXGI constants, no repository changes). - Portable CMake runtime build; ctest **56/56 passed**, optional `shader_library_corpus` skipped. - Windows/MSVC, GPU/device tests and performance benchmarks were **not rerun** after this rebase.
ecox982745 commented 2026-11-25 14:17:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-25T14:17:20Z.


On a Ryzen 7 7800X3D with MSVC 19.44 /O2, the once-per-row dispatch in this PR took 0.357 ms to copy a synthetic 1024×1024 RGBA8 texture into its tiled layout. The original took 2.126 ms, and #1882's per-element dispatch took 0.909 ms in the same benchmark.

CPU time per 1024×1024 copy (ms) Original 5e95fa2f4 #1880 7f9e656e3 #1882 cc4ac4101
RGBA8 into tiled, 64 KiB D 2.126 0.357 0.909
RGBA8 out of tiled 2.127 0.357 0.902
BC7 into tiled, 64 KiB S 0.111 0.052 0.095
BC7 out of tiled 0.103 0.043 0.086
Linear RGBA8 control, into / out 0.074 / 0.074 0.074 / 0.074 0.072 / 0.071

I built one executable per revision from the same benchmark source. The two PR parents have identical xg_xs_layout.h and gfx10_tiling.h. Each process used one pinned CPU thread and reused its buffers and column scratch. For each layout it ran five warm-up round trips and timed the next 15 copies in each direction, checking the final round trip byte-for-byte. The table gives the median across six process runs per build, using all six orderings of the three builds. For RGBA8 into tiled, the six run medians ranged from 0.357–0.362 ms on this PR and 0.908–0.942 ms on #1882. These are warm CPU copy timings. End-to-end texture streaming and frame times are still open.

On this PR the two CPU suites passed (xg_xs 465 checks, texel_copy 306 checks), and all three d3d12_existing_heap CTest variants passed on native Windows 11 with an RTX 4090 (616.64). I also compiled the same 306-check corpus against #1882's header and got zero failures.

Synthetic inputs. AI-assisted verification with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7165045954 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1880#issuecomment-7165045954). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-25T14:17:20Z. --- On a Ryzen 7 7800X3D with MSVC 19.44 `/O2`, the once-per-row dispatch in this PR took **0.357 ms** to copy a synthetic 1024×1024 RGBA8 texture into its tiled layout. The original took **2.126 ms**, and #1882's per-element dispatch took **0.909 ms** in the same benchmark. | CPU time per 1024×1024 copy (ms) | Original `5e95fa2f4` | #1880 `7f9e656e3` | #1882 `cc4ac4101` | | --- | ---: | ---: | ---: | | RGBA8 into tiled, 64 KiB D | 2.126 | 0.357 | 0.909 | | RGBA8 out of tiled | 2.127 | 0.357 | 0.902 | | BC7 into tiled, 64 KiB S | 0.111 | 0.052 | 0.095 | | BC7 out of tiled | 0.103 | 0.043 | 0.086 | | Linear RGBA8 control, into / out | 0.074 / 0.074 | 0.074 / 0.074 | 0.072 / 0.071 | I built one executable per revision from the same benchmark source. The two PR parents have identical `xg_xs_layout.h` and `gfx10_tiling.h`. Each process used one pinned CPU thread and reused its buffers and column scratch. For each layout it ran five warm-up round trips and timed the next 15 copies in each direction, checking the final round trip byte-for-byte. The table gives the median across six process runs per build, using all six orderings of the three builds. For RGBA8 into tiled, the six run medians ranged from 0.357–0.362 ms on this PR and 0.908–0.942 ms on #1882. These are warm CPU copy timings. End-to-end texture streaming and frame times are still open. On this PR the two CPU suites passed (`xg_xs` 465 checks, `texel_copy` 306 checks), and all three `d3d12_existing_heap` CTest variants passed on native Windows 11 with an RTX 4090 (616.64). I also compiled the same 306-check corpus against #1882's header and got zero failures. Synthetic inputs. AI-assisted verification with OpenAI Codex.
thiefyzheng commented 2026-11-25 14:24:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thiefyzheng on 2026-11-25T14:24:50Z.


@ecox982745 — thank you; this closes the items the PR body listed as not-run. Recording for the merge decision: at 7f9e656e3 on a Ryzen 7 7800X3D / MSVC /O2, the row-level dispatch is 5.95x the original (0.357 ms vs 2.126 ms for RGBA8 1024x1024 into tiled, both directions) with linear-copy control unchanged (0.074 ms); xg_xs 465 checks and texel_copy 306 checks pass, and all three d3d12_existing_heap variants pass on native Windows 11 / RTX 4090 (616.64) — the device tests we couldn't run. Frame-time on a streaming workload remains open, as the finding said it would.

Noting your benchmark also covers #1882 (per-element dispatch, same finding): on the identical benchmark it is 0.909 ms — byte-exact as well, ours is the row-level dispatch at 0.357 ms. The claim on this finding (RT-TEXEL-COPY-FIXEDWIDTH, comment 7164508666, 13:53 UTC) and #1880 (opened 14:05) both precede #1882 (opened 14:11, no claiming: for the item); per the board's claim-before-code rules I've noted that on #1882 — maintainers' call, of course. AI-assisted (orchestrator).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7165239918 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1880#issuecomment-7165239918). Originally posted by [thiefyzheng](https://github.com/thiefyzheng) on 2026-11-25T14:24:50Z. --- @ecox982745 — thank you; this closes the items the PR body listed as not-run. Recording for the merge decision: at `7f9e656e3` on a Ryzen 7 7800X3D / MSVC `/O2`, the row-level dispatch is **5.95x the original** (0.357 ms vs 2.126 ms for RGBA8 1024x1024 into tiled, both directions) with linear-copy control unchanged (0.074 ms); `xg_xs` **465 checks** and `texel_copy` **306 checks** pass, and all three `d3d12_existing_heap` variants pass on native Windows 11 / RTX 4090 (616.64) — the device tests we couldn't run. Frame-time on a streaming workload remains open, as the finding said it would. Noting your benchmark also covers #1882 (per-element dispatch, same finding): on the identical benchmark it is 0.909 ms — byte-exact as well, ours is the row-level dispatch at 0.357 ms. The claim on this finding (RT-TEXEL-COPY-FIXEDWIDTH, comment 7164508666, 13:53 UTC) and #1880 (opened 14:05) both precede #1882 (opened 14:11, no claiming: for the item); per the board's claim-before-code rules I've noted that on #1882 — maintainers' call, of course. AI-assisted (orchestrator).
MoonEyes commented 2026-11-25 18:16:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-25T18:16:01Z.


Second run of the device tests for #1880 at head 7f9e656e3, after @ecox982745's on an RTX 4090. One thing to report: a single failure I could not reproduce.

Config: Windows 11 (26300), RTX 4060 desktop, NVIDIA 610.88, MSVC 19.44, RelWithDebInfo, Vulkan SDK 1.4.363.0. Test targets only, no game files.

  • xg_xs (465 checks), texel_copy (306 checks), d3d12_existing_heap_no_write_watch, d3d12_existing_heap_write_watch: pass.
  • d3d12_existing_heap: failed once on the first ctest pass, then passed 23 of 23 direct reruns. The failure was in the concurrent stress section: vulkan slot-133 heap-lock faults: the write-watched half is not hot after the stress, then line 1757: !failed. That check guards the test's own validity (the watched half must stay hot), it is not a data comparison. An MSVC build was running on the machine at that moment.
  • Control: the same test built with xg_xs_layout.h from the merge base (98c2f7777) passed 20 of 20, alternated with the PR binary. I could not reproduce the failure on either side.

So: one unreproduced failure in a timing-dependent section, and no evidence either way that this PR causes it. Not covered: timing/frame benefit, full runtime build, full ctest.

AI-assisted: yes (Claude Code ran the tests)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7170673377 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1880#issuecomment-7170673377). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-25T18:16:01Z. --- Second run of the device tests for #1880 at head `7f9e656e3`, after @ecox982745's on an RTX 4090. One thing to report: a single failure I could not reproduce. Config: Windows 11 (26300), RTX 4060 desktop, NVIDIA 610.88, MSVC 19.44, RelWithDebInfo, Vulkan SDK 1.4.363.0. Test targets only, no game files. - `xg_xs` (465 checks), `texel_copy` (306 checks), `d3d12_existing_heap_no_write_watch`, `d3d12_existing_heap_write_watch`: pass. - `d3d12_existing_heap`: failed once on the first ctest pass, then passed 23 of 23 direct reruns. The failure was in the concurrent stress section: `vulkan slot-133 heap-lock faults: the write-watched half is not hot after the stress`, then `line 1757: !failed`. That check guards the test's own validity (the watched half must stay hot), it is not a data comparison. An MSVC build was running on the machine at that moment. - Control: the same test built with `xg_xs_layout.h` from the merge base (`98c2f7777`) passed 20 of 20, alternated with the PR binary. I could not reproduce the failure on either side. So: one unreproduced failure in a timing-dependent section, and no evidence either way that this PR causes it. Not covered: timing/frame benefit, full runtime build, full ctest. AI-assisted: yes (Claude Code ran the tests)
thiefyzheng commented 2026-11-25 19:57:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thiefyzheng on 2026-11-25T19:57:24Z.


@MoonEyes — thank you. Recording for the merge decision: the one d3d12_existing_heap failure (write-watched half not hot after the concurrent stress, a check on the test's own validity, with an MSVC build running) did not reproduce in 23/23 reruns on the PR build or 20/20 alternating with the merge-base header, so there is no evidence it comes from this change. The device tests (xg_xs 465, texel_copy 306, both write-watch variants) pass on the RTX 4060 and, per @ecox982745, the RTX 4090. Frame-time on a streaming workload is still not measured.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7172989507 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1880#issuecomment-7172989507). Originally posted by [thiefyzheng](https://github.com/thiefyzheng) on 2026-11-25T19:57:24Z. --- @MoonEyes — thank you. Recording for the merge decision: the one `d3d12_existing_heap` failure (write-watched half not hot after the concurrent stress, a check on the test's own validity, with an MSVC build running) did not reproduce in 23/23 reruns on the PR build or 20/20 alternating with the merge-base header, so there is no evidence it comes from this change. The device tests (`xg_xs` 465, `texel_copy` 306, both write-watch variants) pass on the RTX 4060 and, per @ecox982745, the RTX 4090. Frame-time on a streaming workload is still not measured. AI-assisted (Claude Code).
zmasi commented 2026-11-28 23:06:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T23:06:36Z.


Native Windows 11 + MSVC 19.44 + RTX 3090 Vulkan Verification (7f9e656e37 + origin/main adfb3821a2)

Verdict: PASS (0 blockers, 0 new /W4 warnings; 4.7x-8.0x RGBA8 & 2.0x-2.3x BC7 speedup confirmed)

Environment & Merge Check

  • Host: Windows 11 (10.0.26200), MSVC 19.44.35228 (x64, /W4 /permissive- /utf-8 /O2 /EHsc), NVIDIA GeForce RTX 3090 (Ampere, ReBAR enabled)
  • Merge hygiene: Clean merge onto origin/main (adfb3821a2, git merge-tree --write-tree rc=0).

Red -> Green, CPU A/B Benchmark & RTX 3090 GPU Results

  • CPU Correctness (PR #1880 + origin/main):
    • texel_copy_test.exe: PASS (306 checks, 0 failures, 1.95 s, 0 new /W4 warnings).
    • xg_xs_test.exe: PASS (519 checks, 0 failures, 0.43 s).
  • Pinned-Thread CPU A/B Microbenchmark (1024x1024 mip 0, 5 warmups + median of 25 round-trips, byte-exact verified):
    • RGBA8 (kSwizzled | k64kbD): into 2.428 ms -> 0.514 ms (4.72x), out 3.164 ms -> 0.395 ms (8.01x).
    • BC7 (kSwizzled | k64kbS): into 0.125 ms -> 0.061 ms (2.05x), out 0.113 ms -> 0.049 ms (2.31x).
  • RTX 3090 GPU Neighbor Suite (d3d12_existing_heap_test.exe linked with #1880's xg_xs_layout.h):
    • d3d12_existing_heap (default): PASS (rc=0, 8/8 OpenExistingHeapFromAddress cases + concurrent write-watch stress clean).
    • d3d12_host_prefix (--host-prefix-only): PASS (rc=0, 0.89 s).
    • d3d12_mapped_plane_async (--mapped-plane-async): PASS (rc=0, 0.35 s).
    • d3d12_existing_heap_no_write_watch (LEONIDA_WRITE_WATCH=0): PASS (rc=0, 7.12 s).
    • d3d12_existing_heap_write_watch (LEONIDA_WRITE_WATCH=1): PASS (rc=0, 9.09 s).

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7247205787 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1880#issuecomment-7247205787). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T23:06:36Z. --- ### Native Windows 11 + MSVC `19.44` + RTX 3090 Vulkan Verification (`7f9e656e37` + `origin/main` `adfb3821a2`) **Verdict**: **PASS** (0 blockers, 0 new `/W4` warnings; 4.7x-8.0x RGBA8 & 2.0x-2.3x BC7 speedup confirmed) #### Environment & Merge Check - **Host**: Windows 11 (`10.0.26200`), MSVC `19.44.35228` (`x64`, `/W4 /permissive- /utf-8 /O2 /EHsc`), **NVIDIA GeForce RTX 3090** (Ampere, ReBAR enabled) - **Merge hygiene**: Clean merge onto `origin/main` (`adfb3821a2`, `git merge-tree --write-tree` `rc=0`). #### Red -> Green, CPU A/B Benchmark & RTX 3090 GPU Results - **CPU Correctness (`PR #1880 + origin/main`)**: - `texel_copy_test.exe`: **PASS** (`306 checks, 0 failures`, `1.95 s`, `0` new `/W4` warnings). - `xg_xs_test.exe`: **PASS** (`519 checks, 0 failures`, `0.43 s`). - **Pinned-Thread CPU A/B Microbenchmark (`1024x1024` mip 0, 5 warmups + median of 25 round-trips, byte-exact verified)**: - `RGBA8` (`kSwizzled | k64kbD`): `into` **`2.428 ms -> 0.514 ms` (`4.72x`)**, `out` **`3.164 ms -> 0.395 ms` (`8.01x`)**. - `BC7` (`kSwizzled | k64kbS`): `into` **`0.125 ms -> 0.061 ms` (`2.05x`)**, `out` **`0.113 ms -> 0.049 ms` (`2.31x`)**. - **RTX 3090 GPU Neighbor Suite (`d3d12_existing_heap_test.exe` linked with `#1880`'s `xg_xs_layout.h`)**: - `d3d12_existing_heap` (default): **PASS** (`rc=0`, `8/8` `OpenExistingHeapFromAddress` cases + concurrent write-watch stress clean). - `d3d12_host_prefix` (`--host-prefix-only`): **PASS** (`rc=0`, `0.89 s`). - `d3d12_mapped_plane_async` (`--mapped-plane-async`): **PASS** (`rc=0`, `0.35 s`). - `d3d12_existing_heap_no_write_watch` (`LEONIDA_WRITE_WATCH=0`): **PASS** (`rc=0`, `7.12 s`). - `d3d12_existing_heap_write_watch` (`LEONIDA_WRITE_WATCH=1`): **PASS** (`rc=0`, `9.09 s`). AI-assisted.
OreoFR commented 2026-11-29 02:41:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T02:41:19Z.


Verified by OreoFR

  • Base: main aa918e5d9 + PR head 7f9e656e3
  • Test: ctest -R ^texel_copy$
  • Red on main: passes (the new test covers behaviour already on main)
  • Green with the PR: passes; package builds, full ctest shows no new failure
  • Verdict: NO RED (optimization; the new test also passes on main)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

Note: shares runtime/CMakeLists.txt with the open #2566; a rebase may be needed if #2566 lands first.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249584666 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1880#issuecomment-7249584666). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T02:41:19Z. --- **Verified by OreoFR** - Base: main `aa918e5d9` + PR head `7f9e656e3` - Test: `ctest -R ^texel_copy$` - Red on main: passes (the new test covers behaviour already on main) - Green with the PR: passes; package builds, full ctest shows no new failure - Verdict: NO RED (optimization; the new test also passes on main) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 Note: shares `runtime/CMakeLists.txt` with the open #2566; a rebase may be needed if #2566 lands first. AI-assisted (Claude Code, Claude Opus 5.5).
thiefyzheng commented 2026-11-30 23:39:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thiefyzheng on 2026-11-30T23:39:09Z.


Rebased onto current main (71a769d7d85208f86c6e2e50263aca7df1becce9); new head is 1cd6eaf7c67e05d0f9183da0869843acc498fadb. The runtime/CMakeLists.txt conflict was resolved additively, preserving both main's d3d12_xs_alloc_size_test and this PR's texel_copy_test; the fixed-width implementation and focused test are otherwise unchanged.

Rebased-head verification (Linux, CPU-only, synthetic data):

  • g++ 14.2.0, C++20, ASan+UBSan texel_copy_test: 306 checks, 0 failures. (A scratch-only DXGI enum header supplied the Windows constants outside the repository.)
  • Portable CMake runtime build succeeded; ctest -j4: 56/56 passed, shader_library_corpus skipped because its optional corpus is absent. Windows-only texel_copy is not part of this Linux ctest set and was run directly as above.
  • check_no_game_data.py on all three changed files and git diff --check: clean.

Not rerun: Windows/MSVC build, device tests, GPU correctness tests or performance benchmarks. Earlier Windows/NVIDIA measurements remain historical results, not a benchmark of this rebased head.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7295372136 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1880#issuecomment-7295372136). Originally posted by [thiefyzheng](https://github.com/thiefyzheng) on 2026-11-30T23:39:09Z. --- Rebased onto current `main` (`71a769d7d85208f86c6e2e50263aca7df1becce9`); new head is `1cd6eaf7c67e05d0f9183da0869843acc498fadb`. The `runtime/CMakeLists.txt` conflict was resolved additively, preserving both main's `d3d12_xs_alloc_size_test` and this PR's `texel_copy_test`; the fixed-width implementation and focused test are otherwise unchanged. Rebased-head verification (Linux, CPU-only, synthetic data): - `g++ 14.2.0`, C++20, ASan+UBSan `texel_copy_test`: **306 checks, 0 failures**. (A scratch-only DXGI enum header supplied the Windows constants outside the repository.) - Portable CMake runtime build succeeded; `ctest -j4`: **56/56 passed**, `shader_library_corpus` skipped because its optional corpus is absent. Windows-only `texel_copy` is not part of this Linux ctest set and was run directly as above. - `check_no_game_data.py` on all three changed files and `git diff --check`: clean. Not rerun: Windows/MSVC build, device tests, GPU correctness tests or performance benchmarks. Earlier Windows/NVIDIA measurements remain historical results, not a benchmark of this rebased head.
ecox982745 commented 2026-12-01 01:16:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-12-01T01:16:03Z.


Independent native Windows rebase check. I merged head 1cd6eaf7c into main d920d850d without conflicts, giving tree 0a24df8bd. A clean MSVC 19.44 Release build compiled all three stock targets. CTest registered them and each passed three consecutive serial runs.

CPU test Checks per run Failures
texel_copy 306 0
d3d12_xs_alloc_size 62 0
xg_xs 519 0

This verifies the native CMake rebase kept the newly added copy test and main's adjacent allocation-size test. The tests used synthetic inputs and ran on the CPU.

AI-assisted with OpenAI Codex (GPT-6.2 Sol).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7297297640 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1880#issuecomment-7297297640). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-12-01T01:16:03Z. --- Independent native Windows rebase check. I merged head `1cd6eaf7c` into main `d920d850d` without conflicts, giving tree `0a24df8bd`. A clean MSVC 19.44 Release build compiled all three stock targets. CTest registered them and each passed three consecutive serial runs. | CPU test | Checks per run | Failures | | --- | ---: | ---: | | `texel_copy` | 306 | 0 | | `d3d12_xs_alloc_size` | 62 | 0 | | `xg_xs` | 519 | 0 | This verifies the native CMake rebase kept the newly added copy test and main's adjacent allocation-size test. The tests used synthetic inputs and ran on the CPU. AI-assisted with OpenAI Codex (GPT-6.2 Sol).
aslan2142 commented 2026-12-01 11:11:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:11:16Z.

Review: APPROVED


Clean, well-scoped optimization: dispatching fixed-width copy_elements<N> specializations for 1/2/4/8/16-byte texels eliminates variable-length memcpy calls in the inner swizzle/deswizzle loop while keeping the generic fallback for other strides. The 306-check byte-exact round-trip test (runtime/test/texel_copy_test.cpp) and independent A/B timings confirm correctness and the 4.7x-8.0x RGBA8 speedup, and all CI checks are green. Merging.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130072482 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1880#pullrequestreview-6130072482). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:11:16Z. **Review:** APPROVED --- Clean, well-scoped optimization: dispatching fixed-width `copy_elements<N>` specializations for 1/2/4/8/16-byte texels eliminates variable-length `memcpy` calls in the inner swizzle/deswizzle loop while keeping the generic fallback for other strides. The 306-check byte-exact round-trip test (`runtime/test/texel_copy_test.cpp`) and independent A/B timings confirm correctness and the 4.7x-8.0x RGBA8 speedup, and all CI checks are green. Merging. *(AI-assisted review.)*
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1880
No description provided.