device markers: vkCmdWriteBufferMarker2AMD only with VK_KHR_synchronization2 (RT-DEVICE-MARKERS-SYNC2-LAYER) #3142

Open
budanga wants to merge 2 commits from upstream-pr/3142 into main
budanga commented 2026-12-02 13:46:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by budanga on 2026-12-02T13:46:33Z.


Claimed in the coordination issue as: RT-DEVICE-MARKERS-SYNC2-LAYER (https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7203833954)

What and why

With a layer that wraps every command, such as VK_LAYER_KHRONOS_validation (LEONIDA_VK_VALIDATION=1), the AMD breadcrumbs of LEONIDA_DEVICE_MARKERS=1 (#2187) write nothing and nothing reports an error: the device-fault report then says no dispatch started, exactly when someone is debugging a hang under validation. ctest -R vk_device_markers fails that way on AMD with validation on (round 0: started=0 finished=0, last seq 5) and passes with it off.

Cause, measured with a minimal Vulkan program (no Leonida code; one buffer, vkCmdWriteBufferMarker2AMD writes word 0 and vkCmdWriteBufferMarkerAMD word 1, submit, wait, read) on an RX 9060 XT, AMD 26.11.2, Vulkan SDK 1.4.363:

layer VK_KHR_synchronization2 enabled vkCmdWriteBufferMarker2AMD from vkGetDeviceProcAddr written
no no (core 1.3 feature only) NULL -
yes no a pointer no
no yes a pointer yes
yes yes a pointer yes

vkCmdWriteBufferMarkerAMD writes in every case, with the feature off too.

  • The AMD Windows driver returns vkCmdWriteBufferMarker2AMD only when VK_KHR_synchronization2 is enabled, not on a core 1.3 device, although vk.xml lists it under depends="VK_VERSION_1_3,VK_KHR_synchronization2".
  • The validation layer follows vk.xml and returns its own entry point, which has no driver function under it and writes nothing.
  • VulkanContext::configure_device_fault passed vk.vkCmdPipelineBarrier2 != nullptr, true on every 1.3 device. Without a layer the driver's NULL made DeviceMarkers::create fall back to vkCmdWriteBufferMarkerAMD, so game runs never used the second function on AMD Windows; with the layer the stand-in was taken.

Change:

  • configure_device_fault takes synchronization2_extension (default false) in place of vkCmdPipelineBarrier2 != nullptr. The D3D12 device sets info.synchronization2_extension = !v13.core, true exactly when Vulkan13Features::add_extensions enabled VK_KHR_synchronization2 (the Vulkan 1.2 path).
  • So a 1.3 device writes its markers with vkCmdWriteBufferMarkerAMD, at the same top- and bottom-of-pipe stages (the two stage bits have the same values in both enums); a 1.2 device with the extension keeps vkCmdWriteBufferMarker2AMD, which works there with or without the layer (table, rows 3 and 4).
  • vk_device_markers_test follows the same rule (Device::synchronization2_extension(), new) instead of always passing true, and its comment no longer says the second function is what a game run uses.
  • Comments in vulkan_backend.h and vulkan_device_fault.h, and the "AMD breadcrumbs" paragraph of docs/d3d12_vulkan.md.
  • Draw markers (59f14e13c on main) take the same function: they write through the same DeviceMarkers slot.

Nothing changes without a layer: the runtime already wrote with vkCmdWriteBufferMarkerAMD there (see below). vulkan_device_markers.h is not touched.

Tested

On fac8b4bb9 (before merging main), Windows 11 Home 26300.9974, AMD Radeon RX 9060 XT (RDNA4, GFX1200), AMD 26.11.2 (32.0.32029.2010), Vulkan SDK 1.4.363.0, MSVC 14.44, RelWithDebInfo:

  • vk_device_markers_test: passes 3 of 3 with LEONIDA_VK_VALIDATION=1 (markers 5 and 8, 0 validation errors, synchronization validation on) and 3 of 3 without. With the old rule (true) in the same build: fails with validation (started=0 finished=0), passes without.
  • The runtime's own device (create_vulkan_device_standalone, through d3d12_noop_copy_test with LEONIDA_DEVICE_FAULT=1 LEONIDA_DEVICE_MARKERS=1): on main it logs device-markers: on (VK_AMD_buffer_marker, vkCmdWriteBufferMarker2AMD) with validation and vkCmdWriteBufferMarkerAMD without; with this branch vkCmdWriteBufferMarkerAMD in both.
  • vulkan_device_markers_test, vk_semaphore_lifetime_test: pass.
  • Full runtime build and ctest -j 6, without and with LEONIDA_VK_VALIDATION=1: the four failures already recorded for this GPU at that commit (d3d12_texture_tiles, pipeline_cache_seed, d3d12_clear, d3d12_set_descriptor_heaps); vk_device_markers, which failed with validation before, passes. xmem, xmem_no_write_watch, xmem_write_watch and silent_audio failed under the parallel run (29-44 s each) and pass alone (about 4 s each).
  • python -I scripts/check_no_game_data.py on the changed files: passes.

After merging main 1abef08d0 (the only conflict was the "AMD breadcrumbs" paragraph, which now also covers draws), same machine, targets vk_device_markers_test, vk_semaphore_lifetime_test and gta6rt_d3d12_com:

  • vk_device_markers_test: passes 3 of 3 with LEONIDA_VK_VALIDATION=1 and 3 of 3 without; under validation the dispatch rounds give markers 5 and 8 and the new draw round 11, 0 validation errors. With the old rule (true) in the same build: fails with validation (round 0: started=0 finished=0, last seq 5), passes without.
  • vk_semaphore_lifetime_test: passes. gta6rt_d3d12_com builds.

Not tested: a Vulkan 1.2 device (none here), RADV and NVIDIA. The 1.2 path is unchanged in what it passes (true before, true now), and on a 1.3 device the change only swaps which of the two marker functions is used.

GPUs tested: AMD Radeon RX 9060 XT (RDNA4), AMD 26.11.2 (32.0.32029.2010), Windows 11 26300.9974

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator rule)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5607710997 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3142). Originally posted by [budanga](https://github.com/budanga) on 2026-12-02T13:46:33Z. --- Claimed in the coordination issue as: RT-DEVICE-MARKERS-SYNC2-LAYER (https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7203833954) ### What and why With a layer that wraps every command, such as `VK_LAYER_KHRONOS_validation` (`LEONIDA_VK_VALIDATION=1`), the AMD breadcrumbs of `LEONIDA_DEVICE_MARKERS=1` (#2187) write nothing and nothing reports an error: the device-fault report then says no dispatch started, exactly when someone is debugging a hang under validation. `ctest -R vk_device_markers` fails that way on AMD with validation on (`round 0: started=0 finished=0, last seq 5`) and passes with it off. Cause, measured with a minimal Vulkan program (no Leonida code; one buffer, `vkCmdWriteBufferMarker2AMD` writes word 0 and `vkCmdWriteBufferMarkerAMD` word 1, submit, wait, read) on an RX 9060 XT, AMD 26.11.2, Vulkan SDK 1.4.363: | layer | `VK_KHR_synchronization2` enabled | `vkCmdWriteBufferMarker2AMD` from `vkGetDeviceProcAddr` | written | |---|---|---|---| | no | no (core 1.3 feature only) | NULL | - | | **yes** | **no** | **a pointer** | **no** | | no | yes | a pointer | yes | | yes | yes | a pointer | yes | `vkCmdWriteBufferMarkerAMD` writes in every case, with the feature off too. - The AMD Windows driver returns `vkCmdWriteBufferMarker2AMD` only when `VK_KHR_synchronization2` is enabled, not on a core 1.3 device, although vk.xml lists it under `depends="VK_VERSION_1_3,VK_KHR_synchronization2"`. - The validation layer follows vk.xml and returns its own entry point, which has no driver function under it and writes nothing. - `VulkanContext::configure_device_fault` passed `vk.vkCmdPipelineBarrier2 != nullptr`, true on every 1.3 device. Without a layer the driver's NULL made `DeviceMarkers::create` fall back to `vkCmdWriteBufferMarkerAMD`, so game runs never used the second function on AMD Windows; with the layer the stand-in was taken. Change: - `configure_device_fault` takes `synchronization2_extension` (default false) in place of `vkCmdPipelineBarrier2 != nullptr`. The D3D12 device sets `info.synchronization2_extension = !v13.core`, true exactly when `Vulkan13Features::add_extensions` enabled `VK_KHR_synchronization2` (the Vulkan 1.2 path). - So a 1.3 device writes its markers with `vkCmdWriteBufferMarkerAMD`, at the same top- and bottom-of-pipe stages (the two stage bits have the same values in both enums); a 1.2 device with the extension keeps `vkCmdWriteBufferMarker2AMD`, which works there with or without the layer (table, rows 3 and 4). - `vk_device_markers_test` follows the same rule (`Device::synchronization2_extension()`, new) instead of always passing `true`, and its comment no longer says the second function is what a game run uses. - Comments in `vulkan_backend.h` and `vulkan_device_fault.h`, and the "AMD breadcrumbs" paragraph of `docs/d3d12_vulkan.md`. - Draw markers (`59f14e13c` on `main`) take the same function: they write through the same `DeviceMarkers` slot. Nothing changes without a layer: the runtime already wrote with `vkCmdWriteBufferMarkerAMD` there (see below). `vulkan_device_markers.h` is not touched. ### Tested On `fac8b4bb9` (before merging `main`), Windows 11 Home 26300.9974, AMD Radeon RX 9060 XT (RDNA4, GFX1200), AMD 26.11.2 (32.0.32029.2010), Vulkan SDK 1.4.363.0, MSVC 14.44, RelWithDebInfo: - `vk_device_markers_test`: passes 3 of 3 with `LEONIDA_VK_VALIDATION=1` (markers 5 and 8, 0 validation errors, synchronization validation on) and 3 of 3 without. With the old rule (`true`) in the same build: fails with validation (`started=0 finished=0`), passes without. - The runtime's own device (`create_vulkan_device_standalone`, through `d3d12_noop_copy_test` with `LEONIDA_DEVICE_FAULT=1 LEONIDA_DEVICE_MARKERS=1`): on `main` it logs `device-markers: on (VK_AMD_buffer_marker, vkCmdWriteBufferMarker2AMD)` with validation and `vkCmdWriteBufferMarkerAMD` without; with this branch `vkCmdWriteBufferMarkerAMD` in both. - `vulkan_device_markers_test`, `vk_semaphore_lifetime_test`: pass. - Full runtime build and `ctest -j 6`, without and with `LEONIDA_VK_VALIDATION=1`: the four failures already recorded for this GPU at that commit (`d3d12_texture_tiles`, `pipeline_cache_seed`, `d3d12_clear`, `d3d12_set_descriptor_heaps`); `vk_device_markers`, which failed with validation before, passes. `xmem`, `xmem_no_write_watch`, `xmem_write_watch` and `silent_audio` failed under the parallel run (29-44 s each) and pass alone (about 4 s each). - `python -I scripts/check_no_game_data.py` on the changed files: passes. After merging `main` `1abef08d0` (the only conflict was the "AMD breadcrumbs" paragraph, which now also covers draws), same machine, targets `vk_device_markers_test`, `vk_semaphore_lifetime_test` and `gta6rt_d3d12_com`: - `vk_device_markers_test`: passes 3 of 3 with `LEONIDA_VK_VALIDATION=1` and 3 of 3 without; under validation the dispatch rounds give markers 5 and 8 and the new draw round 11, 0 validation errors. With the old rule (`true`) in the same build: fails with validation (`round 0: started=0 finished=0, last seq 5`), passes without. - `vk_semaphore_lifetime_test`: passes. `gta6rt_d3d12_com` builds. Not tested: a Vulkan 1.2 device (none here), RADV and NVIDIA. The 1.2 path is unchanged in what it passes (true before, true now), and on a 1.3 device the change only swaps which of the two marker functions is used. GPUs tested: AMD Radeon RX 9060 XT (RDNA4), AMD 26.11.2 (32.0.32029.2010), Windows 11 26300.9974 AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator rule) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
merzleckeier commented 2026-12-02 14:01:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T14:01:28Z.

Review: COMMENTED


Independent Linux A/B on 2fc7383b9 and main + d605670e6 (clean merge). AMD Raphael iGPU, RADV Mesa 26.3.1, CachyOS. Both the real-device vk_device_markers_test and the mock-device vulkan_device_markers_test passed in both arms.

  • Core-capable device, stock test harness: the control selected vkCmdWriteBufferMarker2AMD and the PR selected legacy vkCmdWriteBufferMarkerAMD. Both read back started/finished sequences 5/5, 8/8 and 11/11 for the compute and draw rounds.
  • To exercise the extension branch on the same GPU, I supplied Vulkan 1.2 to Vulkan13Features::query in a scratch copy of the test harness. It enabled the KHR extensions and the PR selected vkCmdWriteBufferMarker2AMD again, with the same three readbacks.

The runtime and both test files are unchanged on current main 69cd4106c. Validation was off and the test inputs were synthetic. This verifies both command paths on RADV. The AMD Windows validation-layer failure described here was outside this run. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6152286342 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3142#pullrequestreview-6152286342). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T14:01:28Z. **Review:** COMMENTED --- Independent Linux A/B on `2fc7383b9` and main + `d605670e6` (clean merge). AMD Raphael iGPU, RADV Mesa 26.3.1, CachyOS. Both the real-device `vk_device_markers_test` and the mock-device `vulkan_device_markers_test` passed in both arms. - Core-capable device, stock test harness: the control selected `vkCmdWriteBufferMarker2AMD` and the PR selected legacy `vkCmdWriteBufferMarkerAMD`. Both read back started/finished sequences 5/5, 8/8 and 11/11 for the compute and draw rounds. - To exercise the extension branch on the same GPU, I supplied Vulkan 1.2 to `Vulkan13Features::query` in a scratch copy of the test harness. It enabled the KHR extensions and the PR selected `vkCmdWriteBufferMarker2AMD` again, with the same three readbacks. The runtime and both test files are unchanged on current main `69cd4106c`. Validation was off and the test inputs were synthetic. This verifies both command paths on RADV. The AMD Windows validation-layer failure described here was outside this run. AI-assisted with OpenAI Codex.
fiestorra commented 2026-12-02 16:12:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T16:12:23Z.


Verified by building it and running its test on this machine's Vulkan device, with and without the validation layer - which is the case the change is about.

Build (the change applied on main 69cd4106c, MSVC, RelWithDebInfo, 4.8 minutes):

[51/438] Building CXX object CMakeFiles\gta6rt_d3d12_com.dir\shims\d3d12_vulkan_device.cpp.obj
[ 8/438] Building CXX object CMakeFiles\vk_device_markers_test.dir\test\vk_device_markers_test.cpp.obj
exit 0

One warning came with it, and I did not check whether it is yours: d3d12_vulkan_device.cpp(632): warning C4456: declaration of 'lo' hides previous local declaration (with a note at line 495). If that is new, it is the kind of thing that turns into a -Werror failure later; if it was already there, ignore it.

The test, built from your tree:

vk_device_markers_test.exe                                   exit 0
  round 0: started=5 finished=5, last seq 5
  round 1: started=8 finished=8, last seq 8
  draws:   started=11 finished=11, last seq 11
  Vulkan validation errors: 0 (validation off)

LEONIDA_VK_VALIDATION=1 vk_device_markers_test.exe           exit 0
  device: NVIDIA GeForce RTX 4090 (validation on)
  round 0: started=5 finished=5
  round 1: started=8 finished=8
  draws:   started=11 finished=11
  Vulkan validation errors: 0

started equal to finished in every round in both runs is the invariant the markers exist for: the queue's progress can be read while the device is up, and the validation layer finds nothing to complain about - which is what the change is for.

What this does not cover, and it is most of the change: the AMD VK_AMD_buffer_marker path. The test ran on an RTX 4090, and the marker commands are AMD's - so what passed here is the fallback and the synchronization2 gate, not the AMD driver's behaviour that the report in the body came from. An AMD Vulkan device is needed for that, and this machine has an integrated Radeon but the reporter's case was a discrete AMD card under VK_LAYER_KHRONOS_validation.

AI-assisted: yes - DeepSeek v4.1 (flash).

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7351597888 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3142#issuecomment-7351597888). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T16:12:23Z. --- **Verified by building it and running its test on this machine's Vulkan device, with and without the validation layer - which is the case the change is about.** **Build** (the change applied on `main` `69cd4106c`, MSVC, `RelWithDebInfo`, 4.8 minutes): ``` [51/438] Building CXX object CMakeFiles\gta6rt_d3d12_com.dir\shims\d3d12_vulkan_device.cpp.obj [ 8/438] Building CXX object CMakeFiles\vk_device_markers_test.dir\test\vk_device_markers_test.cpp.obj exit 0 ``` **One warning came with it, and I did not check whether it is yours**: `d3d12_vulkan_device.cpp(632): warning C4456: declaration of 'lo' hides previous local declaration` (with a note at line 495). **If that is new, it is the kind of thing that turns into a `-Werror` failure later; if it was already there, ignore it.** **The test, built from your tree:** ``` vk_device_markers_test.exe exit 0 round 0: started=5 finished=5, last seq 5 round 1: started=8 finished=8, last seq 8 draws: started=11 finished=11, last seq 11 Vulkan validation errors: 0 (validation off) LEONIDA_VK_VALIDATION=1 vk_device_markers_test.exe exit 0 device: NVIDIA GeForce RTX 4090 (validation on) round 0: started=5 finished=5 round 1: started=8 finished=8 draws: started=11 finished=11 Vulkan validation errors: 0 ``` **`started` equal to `finished` in every round in both runs** is the invariant the markers exist for: the queue's progress can be read while the device is up, and **the validation layer finds nothing to complain about** - which is what the change is for. **What this does not cover, and it is most of the change**: **the AMD `VK_AMD_buffer_marker` path.** The test ran on an RTX 4090, **and the marker commands are AMD's** - so what passed here is the fallback and the synchronization2 gate, **not the AMD driver's behaviour** that the report in the body came from. **An AMD Vulkan device is needed for that, and this machine has an integrated Radeon but the reporter's case was a discrete AMD card under `VK_LAYER_KHRONOS_validation`.** **AI-assisted:** yes - DeepSeek v4.1 (flash). Written with an AI assistant.
budanga commented 2026-12-02 17:07:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by budanga on 2026-12-02T17:07:07Z.


Thanks to both of you for the runs.

The C4456 warning on lo (fiestorra): it is already on main and not from this pull request. Line 632 of runtime/shims/d3d12_vulkan_device.cpp (and the earlier lo at line 495) came in with 9d41505a4 on 2026-11-30. This pull request changes two lines in that file, 22768 (the configure_device_fault call) and 33199 (info.synchronization2_extension = !v13.core).

What the two runs cover:

  • RTX 4090 with and without validation (fiestorra): the NVIDIA driver also offers VK_AMD_buffer_marker, and the markers read back 5/5, 8/8 and 11/11 in both runs. On that core 1.3 device the new rule takes vkCmdWriteBufferMarkerAMD, so this covers the 1.3 path under the validation layer on a second vendor.
  • RADV on an AMD iGPU (merzleckeier): both branches of the new rule, vkCmdWriteBufferMarkerAMD on a core 1.3 device and vkCmdWriteBufferMarker2AMD with Vulkan 1.2 and the extension, each reading back 5/5, 8/8 and 11/11.

The AMD Windows driver under VK_LAYER_KHRONOS_validation is the case in the description. It was run on an RX 9060 XT (AMD 26.11.2), with the results and the negative control in the "Tested" section, before and after merging main.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7352923728 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3142#issuecomment-7352923728). Originally posted by [budanga](https://github.com/budanga) on 2026-12-02T17:07:07Z. --- Thanks to both of you for the runs. **The C4456 warning on `lo` (fiestorra):** it is already on `main` and not from this pull request. Line 632 of `runtime/shims/d3d12_vulkan_device.cpp` (and the earlier `lo` at line 495) came in with `9d41505a4` on 2026-11-30. This pull request changes two lines in that file, 22768 (the `configure_device_fault` call) and 33199 (`info.synchronization2_extension = !v13.core`). **What the two runs cover:** - RTX 4090 with and without validation (fiestorra): the NVIDIA driver also offers `VK_AMD_buffer_marker`, and the markers read back 5/5, 8/8 and 11/11 in both runs. On that core 1.3 device the new rule takes `vkCmdWriteBufferMarkerAMD`, so this covers the 1.3 path under the validation layer on a second vendor. - RADV on an AMD iGPU (merzleckeier): both branches of the new rule, `vkCmdWriteBufferMarkerAMD` on a core 1.3 device and `vkCmdWriteBufferMarker2AMD` with Vulkan 1.2 and the extension, each reading back 5/5, 8/8 and 11/11. The AMD Windows driver under `VK_LAYER_KHRONOS_validation` is the case in the description. It was run on an RX 9060 XT (AMD 26.11.2), with the results and the negative control in the "Tested" section, before and after merging `main`. AI-assisted (Claude Code).
MoonEyes commented 2026-12-02 18:00:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:00:04Z.


Triage of head d605670e6 (merge base 1abef08d0, 326 commits behind; git merge-tree against current main 45dc41f95: no conflicts).

7 files under runtime/ and docs/d3d12_vulkan.md (+25/-15), C++ Vulkan layer.

CI green on the head (5 checks; no Windows runtime job in this set).

Existing verification: @fiestorra built the change on main 69cd4106c (MSVC, RelWithDebInfo) and ran vk_device_markers_test with and without VK_LAYER_KHRONOS_validation on an RTX 4090; the C4456 warning seen there is on main already (9d41505a4), as the author showed.

This check: Read the diff: vkCmdWriteBufferMarker2AMD is used only when VK_KHR_synchronization2 is enabled on the device (core in 1.3 or the extension), otherwise the 1.0 vkCmdWriteBufferMarkerAMD. That is the spec requirement (the 2 entry point needs synchronization2), so a validation layer that wraps commands no longer drops the markers silently. The test device header gains the same flag. The AMD-with-validation failure in the body is the case that motivated it; the RTX run covers the non-AMD path; an AMD run with validation on the current head would close the loop.

I did not build it: the crate is Windows-only (or the C++ runtime's Windows build), so no red/green was run here.

Verdict: ready (spec-correct fix, built and tested on Windows by a third party).

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353848225 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3142#issuecomment-7353848225). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:00:04Z. --- **Triage of head `d605670e6` (merge base `1abef08d0`, 326 commits behind; `git merge-tree` against current `main` `45dc41f95`: no conflicts).** 7 files under `runtime/` and `docs/d3d12_vulkan.md` (+25/-15), C++ Vulkan layer. CI green on the head (5 checks; no Windows runtime job in this set). **Existing verification:** @fiestorra built the change on `main` `69cd4106c` (MSVC, RelWithDebInfo) and ran `vk_device_markers_test` with and without `VK_LAYER_KHRONOS_validation` on an RTX 4090; the C4456 warning seen there is on `main` already (`9d41505a4`), as the author showed. **This check:** Read the diff: `vkCmdWriteBufferMarker2AMD` is used only when `VK_KHR_synchronization2` is enabled on the device (core in 1.3 or the extension), otherwise the 1.0 `vkCmdWriteBufferMarkerAMD`. That is the spec requirement (the `2` entry point needs synchronization2), so a validation layer that wraps commands no longer drops the markers silently. The test device header gains the same flag. The AMD-with-validation failure in the body is the case that motivated it; the RTX run covers the non-AMD path; an AMD run with validation on the current head would close the loop. I did not build it: the crate is Windows-only (or the C++ runtime's Windows build), so no red/green was run here. **Verdict: ready** (spec-correct fix, built and tested on Windows by a third party). AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
MoonEyes commented 2026-12-02 22:00:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T22:00:59Z.


This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).

Could you, or anyone with a working setup, post a run report on the current head merged onto current main:

  • the head SHA and the main SHA it was merged onto;
  • GPU, driver and OS;
  • at least 300 s in the world after loading;
  • device lost / crashes (count), and rendered fps (median) if you have them;
  • the same run on main alone for comparison, if you can.

Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7360104327 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3142#issuecomment-7360104327). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T22:00:59Z. --- This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists). Could you, or anyone with a working setup, post a run report on the **current head** merged onto current `main`: - the head SHA and the `main` SHA it was merged onto; - GPU, driver and OS; - at least 300 s in the world after loading; - device lost / crashes (count), and rendered fps (median) if you have them; - the same run on `main` alone for comparison, if you can. Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough. AI-assisted (Claude Code).
fiestorra commented 2026-12-03 00:23:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T00:23:11Z.


VERIFY-3142 — Windows nativo, C++: compila en el head, y el campo nuevo está de verdad cableado en dos sitios

Own commit 41e8d9efd — docs/d3d12_vulkan.md (12), runtime/shims/d3d12_com.h (+1), shims/d3d12_vulkan_device.cpp, runtime/src/vulkan_backend.h

Built the shim library from the pull request's tree (fresh Ninja/Release, MSVC Build Tools 17.14):

cmake --build build --target gta6rt_d3d12_com
  [15/15] Linking CXX static library gta6rt_d3d12_com.lib      exit 0, 0.9 min

Control, and it is a compile-level one because the change is a wiring change: I renamed the new field (synchronization2_extension → …_DISABLED) in d3d12_com.h and rebuilt:

error C2039: 'synchronization2_extension': is not a member …
  d3d12_vulkan_device.cpp(22768)
  d3d12_vulkan_device.cpp(33199)

Two sites — exactly the two the diff threads it into: where the extension is enabled (!v13.core, i.e. add_extensions turned on VK_KHR_synchronization2) and where the marker is written. So the field is not a decoration: both readers are real and compiled.

What the change is: the device markers now say vkCmdWriteBufferMarkerAMD and use vkCmdWriteBufferMarker2AMD only when VK_KHR_synchronization2 is really enabled, because on a core Vulkan 1.3 device a wrapping layer (VK_LAYER_KHRONOS_…) hands out a stand-in that writes nothing — and a marker that writes nothing is a hang report that says "no hang".

The documentation was rewritten with it, and the new sentence carries the why: the AMD Windows driver offers the function only with the extension.

What I could not test

  • The marker actually being written on a Vulkan device: that needs a Vulkan 1.2 device under Wine. What is verified is that both paths compile and that the flag reaches both.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7363130609 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3142#issuecomment-7363130609). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T00:23:11Z. --- ## VERIFY-3142 — Windows nativo, C++: **compila en el head**, y el campo nuevo está de verdad cableado en dos sitios | | | |---|---| | Own commit | `41e8d9efd` — `docs/d3d12_vulkan.md` (12), `runtime/shims/d3d12_com.h` (+1), `shims/d3d12_vulkan_device.cpp`, `runtime/src/vulkan_backend.h` | **Built the shim library from the pull request's tree** (fresh `Ninja`/`Release`, MSVC Build Tools 17.14): ``` cmake --build build --target gta6rt_d3d12_com [15/15] Linking CXX static library gta6rt_d3d12_com.lib exit 0, 0.9 min ``` **Control, and it is a compile-level one because the change is a wiring change**: I renamed the new field (`synchronization2_extension` → `…_DISABLED`) in `d3d12_com.h` and rebuilt: ``` error C2039: 'synchronization2_extension': is not a member … d3d12_vulkan_device.cpp(22768) d3d12_vulkan_device.cpp(33199) ``` **Two sites** — **exactly the two the diff threads it into**: **where the extension is enabled** (`!v13.core`, i.e. `add_extensions` turned on `VK_KHR_synchronization2`) **and where the marker is written.** **So the field is not a decoration: both readers are real and compiled.** **What the change is**: the device markers now say **`vkCmdWriteBufferMarkerAMD`** and use **`vkCmdWriteBufferMarker2AMD` only when `VK_KHR_synchronization2` is really enabled**, **because on a core Vulkan 1.3 device a wrapping layer (`VK_LAYER_KHRONOS_…`) hands out a stand-in that writes nothing** — **and a marker that writes nothing is a hang report that says "no hang".** **The documentation was rewritten with it**, and the new sentence carries the *why*: **the AMD Windows driver offers the function only with the extension.** ## What I could not test - **The marker actually being written on a Vulkan device**: that needs a Vulkan 1.2 device under Wine. **What is verified is that both paths compile and that the flag reaches both.** Written with an AI assistant.
budanga commented 2026-12-03 14:55:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by budanga on 2026-12-03T14:55:29Z.


Thanks for the triage and the second build, both of you.

On the in-game run (MoonEyes): this change does not run in a normal game session, so I'd ask whether the gate applies here.

The new flag is read in one place only: DeviceFaultDiagnostics passes it to enable_markers when enabled.markers is set (runtime/src/vulkan_device_fault.h:1223). enabled.markers is set only when both of these are true (runtime/shims/d3d12_vulkan_device.cpp:33258-33270):

  • LEONIDA_DEVICE_FAULT=1 or =2 is set;
  • LEONIDA_DEVICE_MARKERS=1 is set and the device has VK_AMD_buffer_marker.

Without those variables, which a normal run does not set, configure_device_fault is not called at all (d3d12_vulkan_device.cpp:22765, under info.device_fault_diagnostics), and the only other change in the runtime is that info.synchronization2_extension is set but never read. So a 300 s run on main and on this head would execute the same render path, and the report could not show a difference.

With both variables set it is the hang-diagnosis mode, where the markers are written around every dispatch and draw. If you still want a run report, I can post one in that mode on an RX 9060 XT, since that is where the change acts. Say so and I'll take that on.

fiestorra: thanks for the compile-level control. One correction on the two sites: line 33199 sets the field when the device is made (!v13.core), and line 22768 passes it to configure_device_fault. The marker function is chosen later, in DeviceMarkers::create (runtime/src/vulkan_device_markers.h:305).

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7382264162 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3142#issuecomment-7382264162). Originally posted by [budanga](https://github.com/budanga) on 2026-12-03T14:55:29Z. --- Thanks for the triage and the second build, both of you. **On the in-game run (MoonEyes):** this change does not run in a normal game session, so I'd ask whether the gate applies here. The new flag is read in one place only: `DeviceFaultDiagnostics` passes it to `enable_markers` when `enabled.markers` is set (`runtime/src/vulkan_device_fault.h:1223`). `enabled.markers` is set only when both of these are true (`runtime/shims/d3d12_vulkan_device.cpp:33258-33270`): - `LEONIDA_DEVICE_FAULT=1` or `=2` is set; - `LEONIDA_DEVICE_MARKERS=1` is set and the device has `VK_AMD_buffer_marker`. Without those variables, which a normal run does not set, `configure_device_fault` is not called at all (`d3d12_vulkan_device.cpp:22765`, under `info.device_fault_diagnostics`), and the only other change in the runtime is that `info.synchronization2_extension` is set but never read. So a 300 s run on `main` and on this head would execute the same render path, and the report could not show a difference. With both variables set it is the hang-diagnosis mode, where the markers are written around every dispatch and draw. If you still want a run report, I can post one in that mode on an RX 9060 XT, since that is where the change acts. Say so and I'll take that on. **fiestorra:** thanks for the compile-level control. One correction on the two sites: line 33199 sets the field when the device is made (`!v13.core`), and line 22768 passes it to `configure_device_fault`. The marker function is chosen later, in `DeviceMarkers::create` (`runtime/src/vulkan_device_markers.h:305`). AI-assisted (Claude Code).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3142:upstream-pr/3142'
git switch 'upstream-pr/3142'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3142'
git switch 'upstream-pr/3142'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3142'
git switch 'upstream-pr/3142'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3142'
git switch 'main'
git merge --squash 'upstream-pr/3142'
git switch 'main'
git merge --ff-only 'upstream-pr/3142'
git switch 'main'
git merge 'upstream-pr/3142'
git push origin 'main'
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!3142
No description provided.