[PR #1099] [MERGED] runtime: order consecutive buffer copies on the same queue (RT-STREAM-TRANSFER-BARRIER) #1133

Closed
opened 2026-11-26 20:20:12 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1099
Author: @Moriz82
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @QemmHD

Base: main ← Head: split/rt-stream-transfer-barrier


📝 Commits (1)

  • ddcffa6 runtime: order consecutive buffer copies on the same queue (RT-STREAM-TRANSFER-BARRIER)

📊 Changes

3 files changed (+64 additions, -5 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+3 -0)
📝 runtime/src/vulkan_replay.h (+23 -0)
📝 runtime/test/replay_copy_offset_test.cpp (+38 -5)

📄 Description

Claimed in the coordination issue as: RT-STREAM-TRANSFER-BARRIER (claim).

Part of the split of #984 into small pull requests.

Depends on: none
Overlaps: #354 (closed without merging) supplies the transfer dependency. This child credits that contribution, adds the rollback switch and tests the emitted commands.

What and why

A D3D12 queue can submit overlapping buffer copies back to back. Without a Vulkan memory dependency, a later copy can read or overwrite bytes before the earlier transfer write finishes. Emit a transfer-stage memory barrier before each plain buffer copy, including the first one in a list. A preceding list on the same queue can have written those bytes. Real Vulkan contexts provide the barrier entry point. The existing query mock also exercises a context that omits it. Set LEONIDA_ORDER_BUFFER_COPIES=0 to restore the old behavior.

Tested

Cross-built with clang-cl 23 and the xwin SDK. Ran the command-recording fixtures under Proton Experimental (Wine 11) on CachyOS Linux 7.3, Ryzen 5 5600X, 16 GB.

cmake --build runtime/build/boot --target gta6rt replay_copy_offset_test replay_query_edges_test -j6
ctest --test-dir runtime/build/boot -j1 -R '^replay_(copy_offset|query_edges)$' --output-on-failure
(cd runtime/build/boot && LEONIDA_ORDER_BUFFER_COPIES=0 "$WINE" replay_copy_offset_test.exe --expect-unordered)
Configuration Single copy ordered Back-to-back copies ordered Result
Main plus tests 0/1 0/2 Both ordering assertions failed.
Child, default 1/1 2/2 Both replay fixtures passed.
Child, switch set to 0 0/1 0/2 The explicit unordered control passed.

GPUs tested: none. The fixtures record Vulkan commands and check the stage and access masks. Native Windows, AMD, Intel and a game boot were not tested.
AI-assisted: yes

Checklist

  • One commit on upstream main at the cut. Clean merge check.
  • One copy-ordering change with a regression test and a rollback control.
  • Changed-file game-data guard and whitespace check passed.
  • No translator rule changed.

🤖 Generated with Claude Code


🔄 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/1099 **Author:** [@Moriz82](https://github.com/Moriz82) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@QemmHD](https://github.com/QemmHD) **Base:** `main` ← **Head:** `split/rt-stream-transfer-barrier` --- ### 📝 Commits (1) - [`ddcffa6`](https://github.com/ubiquitarianism/leonida/commit/ddcffa634e606ce959c1276b26eb63fb8c8297d5) runtime: order consecutive buffer copies on the same queue (RT-STREAM-TRANSFER-BARRIER) ### 📊 Changes **3 files changed** (+64 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+3 -0) 📝 `runtime/src/vulkan_replay.h` (+23 -0) 📝 `runtime/test/replay_copy_offset_test.cpp` (+38 -5) </details> ### 📄 Description Claimed in the coordination issue as: RT-STREAM-TRANSFER-BARRIER ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140536595)). Part of the split of #984 into small pull requests. Depends on: none Overlaps: #354 (closed without merging) supplies the transfer dependency. This child credits that contribution, adds the rollback switch and tests the emitted commands. ### What and why A D3D12 queue can submit overlapping buffer copies back to back. Without a Vulkan memory dependency, a later copy can read or overwrite bytes before the earlier transfer write finishes. Emit a transfer-stage memory barrier before each plain buffer copy, including the first one in a list. A preceding list on the same queue can have written those bytes. Real Vulkan contexts provide the barrier entry point. The existing query mock also exercises a context that omits it. Set `LEONIDA_ORDER_BUFFER_COPIES=0` to restore the old behavior. ### Tested Cross-built with clang-cl 23 and the xwin SDK. Ran the command-recording fixtures under Proton Experimental (Wine 11) on CachyOS Linux 7.3, Ryzen 5 5600X, 16 GB. ```sh cmake --build runtime/build/boot --target gta6rt replay_copy_offset_test replay_query_edges_test -j6 ctest --test-dir runtime/build/boot -j1 -R '^replay_(copy_offset|query_edges)$' --output-on-failure (cd runtime/build/boot && LEONIDA_ORDER_BUFFER_COPIES=0 "$WINE" replay_copy_offset_test.exe --expect-unordered) ``` | Configuration | Single copy ordered | Back-to-back copies ordered | Result | | --- | --- | --- | --- | | Main plus tests | 0/1 | 0/2 | Both ordering assertions failed. | | Child, default | 1/1 | 2/2 | Both replay fixtures passed. | | Child, switch set to 0 | 0/1 | 0/2 | The explicit unordered control passed. | GPUs tested: none. The fixtures record Vulkan commands and check the stage and access masks. Native Windows, AMD, Intel and a game boot were not tested. AI-assisted: yes ### Checklist - [x] One commit on upstream main at the cut. Clean merge check. - [x] One copy-ordering change with a regression test and a rollback control. - [x] Changed-file game-data guard and whitespace check passed. - [x] No translator rule changed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:20:12 +01:00
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#1133
No description provided.