Skip to content

Reject out-of-range GPU indices in the descriptor benchmark - #808

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
gabrielsteglich:fix/descriptor-bench-device-index
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
gabrielsteglich:fix/descriptor-bench-device-index

Conversation

@gabrielsteglich

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as a D3D-56 follow-up.

What and why

vk_descriptor_bench parsed --device as a uint32_t and then stored it in a signed int. On the base commit 8df277f, --device 2147483648 and --device 4294967295 both ran the benchmark on the default GPU and returned success.

This keeps explicit indices as std::optional<uint32_t> values. An omitted index selects a GPU automatically. An explicit index is checked against the enumerated device count, so an out-of-range index returns exit code 2 before dispatch. The CPU self-test now checks that the largest uint32_t stays an explicit index.

Tested

Windows 11 Pro (build 26200), RTX 3090 (NVIDIA 621.01), MSVC 19.44 (RelWithDebInfo), and Vulkan SDK 1.4.363.0.

  • Built vk_descriptor_bench and passed vk_descriptor_bench_selftest in CTest.
  • Confirmed exit code 2 for device indices 1, 2147483647, 2147483648, 4294967295, and 4294967296 on this one-adapter system. Both --device 0 and automatic selection completed on the RTX 3090.
  • With LEONIDA_VK_VALIDATION=1, the quick device-local benchmark completed 33 measured scenarios at 1,000, 10,000, and 100,000 entries (11 each).
  • git diff --check passed.

AI-assisted implementation and testing.

Checklist

  • No game data, keys or decryption, including in the test inputs or logs.
  • Translator contract entry in docs/design.md (not applicable to this benchmark CLI change).

@quackottu quackottu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested f282a0d on NVIDIA GeForce RTX 5070, driver 621.24, Windows 11 Pro (26300), VS 2022 Build Tools, Vulkan SDK 1.4.363.0, with LEONIDA_VK_VALIDATION=1 and LEONIDA_D3D12=vulkan: pass

  • ctest -C RelWithDebInfo: 97% tests passed, 1 tests failed out of 31
  • 30 test programs in the build pass with 0 validation errors
  • d3d12_clear_test fails (format 28 case 0 byte 2: Vulkan 7f, WARP 80) exactly as on main 67204bf, so not from this PR: NVIDIA rounds a 0.5 UNORM clear to 0x7f, which #521 addresses
  • d3d12_vulkan_device_test reports 10 synchronization-validation WRITE_AFTER_WRITE hazards on back-to-back copies (so ctest's d3d12_vulkan_device fails). main 8df277f shows the same 10 here, so not from this PR: it's @guimsolutions's finding in #634, which #782 addresses

Implicit Vulkan layers (overlays) were off through an empty VK_IMPLICIT_LAYER_PATH.

@ItsNotRexed
ItsNotRexed merged commit 7837b8b into ItsNotRexed:main Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants