check_sparse_queue_family: skip CONCURRENT contract on single-family GPUs (OLD-7268) #618

Merged
KarolKurzyna merged 2 commits from upstream-pr/618 into main 2026-11-24 16:39:21 +00:00
KarolKurzyna commented 2026-11-24 10:00:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KarolKurzyna on 2026-11-24T10:00:10Z.


Claimed in the coordination issue as: OLD-7268 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7128154815)

Carried over from upstream ItsNotRexed/Leonida PR #7268 (b75d669b0a, incorporating @wasonidas's review suggestions), where it received 5/5 independent PASS reviews (@claudetools-gh, @rideinstead, @garuspl, @airp1ane, @lines9686-rgb).

What was wrong

  1. On single-queue-family GPUs with sparse binding (such as Intel UHD Graphics 770 on Windows, which exposes 1 queue family with GRAPHICS | COMPUTE | TRANSFER | SPARSE_BINDING), VulkanDevice selects the same family for graphics, compute, and DMA, so only 1 distinct sparse-capable family exists and VK_SHARING_MODE_EXCLUSIVE is valid per the Vulkan specification. However, runtime/test/check_sparse_queue_family.py unconditionally failed when VK_SHARING_MODE_CONCURRENT was absent from vkCreateBuffer / vkCreateImage in the VK_LAYER_LUNARG_api_dump output.
  2. When multiple queue families were present in the dump, the script needed to mirror runtime/src/queue_families.h (pick_queue_families followed by sparse_capable_queue_families) in exact selection order and strictly validate vkGetPhysicalDeviceQueueFamilyProperties against pQueueFamilyPropertyCount.

What changed

  • Mirror runtime/src/queue_families.h (pick_queue_families -> sparse_capable_queue_families) in runtime/test/check_sparse_queue_family.py: pick the first non-graphics async compute and fine-grained (1x1x1) DMA transfer families first, fall back to the graphics family if the chosen family lacks VK_QUEUE_SPARSE_BINDING_BIT, and require VK_SHARING_MODE_CONCURRENT only when >= 2 distinct sparse-capable families are selected.
  • Strictly validate vkGetPhysicalDeviceQueueFamilyProperties dumps against pQueueFamilyPropertyCount and contiguous indices 0..count-1 so truncated or malformed dumps are never silently ignored.
  • Add synthetic unit tests in tests/test_check_sparse_queue_family.py covering single-family GPUs, non-sparse compute/DMA ahead of sparse families, and incomplete/malformed property dumps (29/29 pass).

Tested

  • python -I -m unittest tests/test_check_sparse_queue_family.py -v: 29/29 PASS.
  • NVIDIA GeForce RTX 3070 Ti (621.24, 3 sparse-capable queue families, Windows 11): ctest -R d3d12_sparse_queue_family PASS (verifies VK_SHARING_MODE_CONCURRENT across 3 families).
  • Intel(R) UHD Graphics 770 (101.6129, 1 sparse-capable queue family, Windows 11): ctest -R d3d12_sparse_queue_family PASS (was failing before fix).

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5469984117 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/618). Originally posted by [KarolKurzyna](https://github.com/KarolKurzyna) on 2026-11-24T10:00:10Z. --- Claimed in the coordination issue as: OLD-7268 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7128154815) Carried over from upstream `ItsNotRexed/Leonida` PR `#7268` (`b75d669b0a`, incorporating `@wasonidas`'s review suggestions), where it received **5/5 independent `PASS` reviews** (`@claudetools-gh`, `@rideinstead`, `@garuspl`, `@airp1ane`, `@lines9686-rgb`). ### What was wrong 1. On single-queue-family GPUs with sparse binding (such as Intel UHD Graphics 770 on Windows, which exposes 1 queue family with `GRAPHICS | COMPUTE | TRANSFER | SPARSE_BINDING`), `VulkanDevice` selects the same family for graphics, compute, and DMA, so only 1 distinct sparse-capable family exists and `VK_SHARING_MODE_EXCLUSIVE` is valid per the Vulkan specification. However, `runtime/test/check_sparse_queue_family.py` unconditionally failed when `VK_SHARING_MODE_CONCURRENT` was absent from `vkCreateBuffer` / `vkCreateImage` in the `VK_LAYER_LUNARG_api_dump` output. 2. When multiple queue families were present in the dump, the script needed to mirror `runtime/src/queue_families.h` (`pick_queue_families` followed by `sparse_capable_queue_families`) in exact selection order and strictly validate `vkGetPhysicalDeviceQueueFamilyProperties` against `pQueueFamilyPropertyCount`. ### What changed - Mirror `runtime/src/queue_families.h` (`pick_queue_families` -> `sparse_capable_queue_families`) in `runtime/test/check_sparse_queue_family.py`: pick the first non-graphics async compute and fine-grained (`1x1x1`) DMA transfer families first, fall back to the graphics family if the chosen family lacks `VK_QUEUE_SPARSE_BINDING_BIT`, and require `VK_SHARING_MODE_CONCURRENT` only when `>= 2` distinct sparse-capable families are selected. - Strictly validate `vkGetPhysicalDeviceQueueFamilyProperties` dumps against `pQueueFamilyPropertyCount` and contiguous indices `0..count-1` so truncated or malformed dumps are never silently ignored. - Add synthetic unit tests in `tests/test_check_sparse_queue_family.py` covering single-family GPUs, non-sparse compute/DMA ahead of sparse families, and incomplete/malformed property dumps (`29/29` pass). ### Tested - `python -I -m unittest tests/test_check_sparse_queue_family.py -v`: **29/29 PASS**. - **NVIDIA GeForce RTX 3070 Ti** (`621.24`, 3 sparse-capable queue families, Windows 11): `ctest -R d3d12_sparse_queue_family` **PASS** (verifies `VK_SHARING_MODE_CONCURRENT` across 3 families). - **Intel(R) UHD Graphics 770** (`101.6129`, 1 sparse-capable queue family, Windows 11): `ctest -R d3d12_sparse_queue_family` **PASS** (was failing before fix). AI-assisted.
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!618
No description provided.