[PR #1713] vulkan: coalesce equal image layout ranges (VK-IMAGE-LAYOUT-RANGE-COALESCING) #1726

Open
opened 2026-11-26 21:18:45 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1713
Author: @akimfomin
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: codex/vulkan-image-layout-range-coalescing


📝 Commits (1)

  • ef9ae1f vulkan: coalesce equal layout ranges (VK-IMAGE-LAYOUT-RANGE-COALESCING)

📊 Changes

2 files changed (+90 additions, -15 deletions)

View changed files

📝 runtime/src/vulkan_replay.h (+59 -7)
📝 runtime/test/d3d12_state_map_test.cpp (+31 -8)

📄 Description

Claimed in the coordination issue as: VK-IMAGE-LAYOUT-RANGE-COALESCING

What and why

Merge adjacent initialized rectangles with the same prior Vulkan image layout and aspect. The replay still issues the same ordered calls and synchronization scopes. Mixed first-use cells keep individual pieces. Uniform, small mixed, and singleton-only ranges retain fast paths. There is a regression case for a two-mip, two-layer stripe beside first-use cells.

DadaCap suggested a separate follow-up in #1284. This change applies to main itself, and a local combination with #1284 also passed.

Tested

On Windows, Clang 23.1.6 built and ran d3d12_state_map_test, replay_texture_barrier_test, and 96 seeded per-cell geometry cases on current main 626d1281 and on this patch. The same tests and a rollback/commit fixture passed on both arms of the combined tree with #1284 head 2c178819. The combined partial-release case uses 3 instead of 12 image barriers. The ordered fixture uses 5 instead of 14 with the same per-cell layouts and scopes. Same-layout recording allocates zero in both arms.

The earlier two-core CPU benchmark measured 640 to 2 records and 41.7–47.1% less partition time on stripes. Mostly-undefined and checkerboard partitions did not improve in that benchmark. Pinned benchmark and fixture sources

GPUs tested: none on this exact head. The linked earlier Vulkan readback used RTX 4070 Ti SUPER and tested a different revision.

AI-assisted: yes (Codex). PortBridge

Checklist

  • Based on current main and merges cleanly.
  • One topic and a separate follow-up.
  • No game inputs, keys or decryption.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1713 **Author:** [@akimfomin](https://github.com/akimfomin) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `codex/vulkan-image-layout-range-coalescing` --- ### 📝 Commits (1) - [`ef9ae1f`](https://github.com/ubiquitarianism/leonida/commit/ef9ae1fd54d5c452eb31236c1ca86debe0a5fda9) vulkan: coalesce equal layout ranges (VK-IMAGE-LAYOUT-RANGE-COALESCING) ### 📊 Changes **2 files changed** (+90 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `runtime/src/vulkan_replay.h` (+59 -7) 📝 `runtime/test/d3d12_state_map_test.cpp` (+31 -8) </details> ### 📄 Description Claimed in the coordination issue as: [VK-IMAGE-LAYOUT-RANGE-COALESCING](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7157843511) ### What and why Merge adjacent initialized rectangles with the same prior Vulkan image layout and aspect. The replay still issues the same ordered calls and synchronization scopes. Mixed first-use cells keep individual pieces. Uniform, small mixed, and singleton-only ranges retain fast paths. There is a regression case for a two-mip, two-layer stripe beside first-use cells. DadaCap suggested a separate follow-up in #1284. This change applies to main itself, and a local combination with #1284 also passed. ### Tested On Windows, Clang 23.1.6 built and ran `d3d12_state_map_test`, `replay_texture_barrier_test`, and 96 seeded per-cell geometry cases on current main `626d1281` and on this patch. The same tests and a rollback/commit fixture passed on both arms of the combined tree with #1284 head `2c178819`. The combined partial-release case uses 3 instead of 12 image barriers. The ordered fixture uses 5 instead of 14 with the same per-cell layouts and scopes. Same-layout recording allocates zero in both arms. The earlier two-core CPU benchmark measured 640 to 2 records and 41.7–47.1% less partition time on stripes. Mostly-undefined and checkerboard partitions did not improve in that benchmark. [Pinned benchmark and fixture sources](https://github.com/akimfomin/PortBridge/tree/049b46286518c20d98dc74ae700e66599110d964/research/continued-layout-range-coalescing) GPUs tested: none on this exact head. The linked earlier Vulkan readback used RTX 4070 Ti SUPER and tested a different revision. AI-assisted: yes (Codex). [PortBridge](https://github.com/akimfomin/PortBridge) ### Checklist - [x] Based on current main and merges cleanly. - [x] One topic and a separate follow-up. - [x] No game inputs, keys or decryption. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1726
No description provided.