vulkan: copy descriptor table slots directly into mapped staging #1196

Closed
Kadamitas wants to merge 1 commit from upstream-pr/1196 into main
Kadamitas commented 2026-11-24 20:00:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kadamitas on 2026-11-24T20:00:44Z.


Claimed in the coordination issue as bulk-copy occupied descriptor staging slots.

What and why

Full bindless table uploads currently write every slot in small fragments, even though the descriptor and value records are already laid out in upload order. Bulk-copy full tables and consecutive slot ranges. Full vector and pointer uploads share the serializer. Removing the occupied marker preserves the descriptor kind, and the layout and tombstone values are preserved.

Tested

  • The existing descriptor_table_test passed on Windows after the Nov 27 rebase, including partial range reads and the kind-preserving marker path.
  • A synthetic byte comparison matched 2,309,432 bytes across aligned and unaligned destinations, with marker clearing enabled and disabled, including insert, erase, clear and rehash.
  • Before the rebase, on a Ryzen 9 7950X with MSVC /O2, a 40 MiB write-combined staging copy took 5.49–5.64 ms before and 1.39–1.44 ms after. Each result is the median of nine groups of four copies, with baseline and patch measured in alternating order. This measures CPU staging time.

GPUs tested: N/A. The benchmark used native Windows write-combined host pages.

AI-assisted: yes.

Checklist

  • Based on current main (43a9d562d).
  • One topic.
  • No game data, keys or decryption.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5479381592 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1196). Originally posted by [Kadamitas](https://github.com/Kadamitas) on 2026-11-24T20:00:44Z. --- Claimed in the coordination issue as [bulk-copy occupied descriptor staging slots](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7142898070). ### What and why Full bindless table uploads currently write every slot in small fragments, even though the descriptor and value records are already laid out in upload order. Bulk-copy full tables and consecutive slot ranges. Full vector and pointer uploads share the serializer. Removing the occupied marker preserves the descriptor kind, and the layout and tombstone values are preserved. ### Tested - The existing `descriptor_table_test` passed on Windows after the Nov 27 rebase, including partial range reads and the kind-preserving marker path. - A synthetic byte comparison matched 2,309,432 bytes across aligned and unaligned destinations, with marker clearing enabled and disabled, including insert, erase, clear and rehash. - Before the rebase, on a Ryzen 9 7950X with MSVC /O2, a 40 MiB write-combined staging copy took 5.49–5.64 ms before and 1.39–1.44 ms after. Each result is the median of nine groups of four copies, with baseline and patch measured in alternating order. This measures CPU staging time. GPUs tested: N/A. The benchmark used native Windows write-combined host pages. AI-assisted: yes. ### Checklist - [x] Based on current `main` (`43a9d562d`). - [x] One topic. - [x] No game data, keys or decryption.
Deedlyy commented 2026-11-24 20:07:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Deedlyy on 2026-11-24T20:07:59Z.


Recommendation: [MERGE]

Reasoning: Bindless descriptor-table uploads memcpy the occupied slot range directly into staging instead of writing each slot in fragments. New static_asserts pin the trivially-copyable 40-byte layout the copy relies on, the clear_pad path still zeroes the marker word, and both entry points share one serializer. I checked the moved private: label: no member's access changes. Byte-identical output was verified over 2.3 MB of synthetic cases, with a roughly 4x faster CPU staging copy. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 3/10

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7143086394 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1196#issuecomment-7143086394). Originally posted by [Deedlyy](https://github.com/Deedlyy) on 2026-11-24T20:07:59Z. --- **Recommendation:** [MERGE] **Reasoning:** Bindless descriptor-table uploads memcpy the occupied slot range directly into staging instead of writing each slot in fragments. New static_asserts pin the trivially-copyable 40-byte layout the copy relies on, the `clear_pad` path still zeroes the marker word, and both entry points share one serializer. I checked the moved `private:` label: no member's access changes. Byte-identical output was verified over 2.3 MB of synthetic cases, with a roughly 4x faster CPU staging copy. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 3/10
zmasi commented 2026-11-28 22:10:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:10:55Z.


Independent Verification Report — 72ff4abc7c + origin/main (c7753ed98a)

Environment: Windows 11 (26200), AMD Ryzen 9 5950X, MSVC 19.44.35228 (x64, /std:c++20 /EHsc /W4 /permissive- /utf-8, Debug /Od /MDd & Release /O2 /MD).
Verdict: PASS (Ready to merge) — clean Git merge with origin/main (f66d98d0c22d) and combined Batch 11 set (6a93c1e1e828).

1. Build, Layout Invariant & Correctness Verification

  • static_assert(std::is_trivially_copyable_v<DescriptorEntry> && sizeof(DescriptorEntry) == 40 && offsetof(DescriptorEntry, key) == 0 && offsetof(DescriptorEntry, index) == 32 && offsetof(DescriptorEntry, kind) == 36) verified at compile time on MSVC 19.44.
  • descriptor_table_test (Debug /Od /MDd & Release /O2 /MD): PASS (descriptor_table_test: all tests passed (0 failures)), 0 warnings in descriptor_table.h, confirming bit-identical output across build_gpu_buffer, write_to_buffer (clear_occupied = false & true), and read_slots.

2. Measured Throughput (262,144-slot DescriptorTable, 500 iterations of write_to_buffer + read_slots, MSVC /O2 /MD)

  • origin/main (per-slot uint32_t[10] staging loops): 1,181.17 ms (8.88 GB/s)
  • 72ff4abc7c (direct DescriptorEntry memcpy): 478.50 ms (21.91 GB/s) — 2.47x faster.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246553261 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1196#issuecomment-7246553261). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T22:10:55Z. --- ### Independent Verification Report — `72ff4abc7c` + `origin/main` (`c7753ed98a`) **Environment:** Windows 11 (`26200`), AMD Ryzen 9 5950X, MSVC `19.44.35228` (`x64`, `/std:c++20 /EHsc /W4 /permissive- /utf-8`, Debug `/Od /MDd` & Release `/O2 /MD`). **Verdict:** **PASS (Ready to merge)** — clean Git merge with `origin/main` (`f66d98d0c22d`) and combined Batch 11 set (`6a93c1e1e828`). #### 1. Build, Layout Invariant & Correctness Verification - `static_assert(std::is_trivially_copyable_v<DescriptorEntry> && sizeof(DescriptorEntry) == 40 && offsetof(DescriptorEntry, key) == 0 && offsetof(DescriptorEntry, index) == 32 && offsetof(DescriptorEntry, kind) == 36)` verified at compile time on MSVC `19.44`. - `descriptor_table_test` (Debug `/Od /MDd` & Release `/O2 /MD`): **PASS** (`descriptor_table_test: all tests passed (0 failures)`), `0` warnings in `descriptor_table.h`, confirming bit-identical output across `build_gpu_buffer`, `write_to_buffer` (`clear_occupied = false` & `true`), and `read_slots`. #### 2. Measured Throughput (`262,144`-slot `DescriptorTable`, `500` iterations of `write_to_buffer` + `read_slots`, MSVC `/O2 /MD`) - `origin/main` (per-slot `uint32_t[10]` staging loops): `1,181.17 ms` (`8.88 GB/s`) - `72ff4abc7c` (direct `DescriptorEntry` `memcpy`): `478.50 ms` (`21.91 GB/s`) — **2.47x faster**. AI-assisted.
TheGeogeo commented 2026-11-29 06:52:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T06:52:46Z.


Tested 72ff4abc7 merged (no commit) with main ef3299584. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300; MSVC 19.52 (Visual Studio 18), Ninja, RelWithDebInfo. check_no_game_data.py is clean.

  • No new test, and none can show a red: the change is meant to keep the same bytes (a faster copy path). descriptor_table passes on main and on the merge. It covers build_gpu_buffer, write_to_buffer(clear_occupied=true) and read_slots. The new static_asserts (trivially copyable, size 40, offsets 0/32/36) pin the layout the memcpy relies on.
  • No regression: the merge rebuilds 200 executables. Of their 312 other tests, only xbox_present fails, as on plain main here.
  • LINK: gta6rt.exe linked without ws2_32.lib gives main's 26 unresolved Rust-std symbols, nothing new. Its imports are identical to main's.
  • The speed claim is not checked by any test, and I did not measure it.
  • Merge order: it conflicts with #1739 in descriptor_table.h, in two places:
    • read_slots: #1196's memcpy (count * sizeof(DescriptorEntry), a size_t) already covers #1739's widening, so take #1196's version;
    • the moved private: / mark() area needs a manual merge.

No blocker from my side. AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7252124557 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1196#issuecomment-7252124557). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T06:52:46Z. --- Tested `72ff4abc7` merged (no commit) with `main` `ef3299584`. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300; MSVC 19.52 (Visual Studio 18), Ninja, RelWithDebInfo. `check_no_game_data.py` is clean. - No new test, and none can show a red: the change is meant to keep the same bytes (a faster copy path). `descriptor_table` passes on `main` and on the merge. It covers `build_gpu_buffer`, `write_to_buffer(clear_occupied=true)` and `read_slots`. The new `static_assert`s (trivially copyable, size 40, offsets 0/32/36) pin the layout the `memcpy` relies on. - No regression: the merge rebuilds 200 executables. Of their 312 other tests, only `xbox_present` fails, as on plain `main` here. - LINK: `gta6rt.exe` linked without `ws2_32.lib` gives `main`'s 26 unresolved Rust-std symbols, nothing new. Its imports are identical to `main`'s. - The speed claim is not checked by any test, and I did not measure it. - Merge order: it conflicts with #1739 in `descriptor_table.h`, in two places: - `read_slots`: #1196's `memcpy` (`count * sizeof(DescriptorEntry)`, a `size_t`) already covers #1739's widening, so take #1196's version; - the moved `private:` / `mark()` area needs a manual merge. No blocker from my side. AI-assisted (Claude Code).
aslan2142 commented 2026-12-01 16:33:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:33:40Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7317809124 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1196#issuecomment-7317809124). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:33:40Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

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!1196
No description provided.