Skip to content

[VK] Gate debug utils messenger on runtime config instead of NDEBUG#1269

Merged
MarijnS95 merged 1 commit into
llvm:mainfrom
Traverse-Research:worktree-vk-debug-utils-gate
Jun 5, 2026
Merged

[VK] Gate debug utils messenger on runtime config instead of NDEBUG#1269
MarijnS95 merged 1 commit into
llvm:mainfrom
Traverse-Research:worktree-vk-debug-utils-gate

Conversation

@MarijnS95
Copy link
Copy Markdown
Collaborator

@MarijnS95 MarijnS95 commented Jun 3, 2026

registerDebugUtilCallback was only invoked inside #ifndef NDEBUG, leaving the function unused (and triggering -Wunused-function) in NDEBUG builds. The extension registration itself had already been converted to runtime config flags in #382; the call site was missed.

Tie the callback to whether VK_EXT_debug_utils was actually enabled, and pull the extension in whenever either EnableDebugLayer or EnableValidationLayer is set — so validation messages route through the callback. This matches how the DX backend couples the two flags in lib/API/DX/Device.cpp.

🤖 Generated with Claude Code

The extension registration was already converted to runtime config flags
in llvm#382, but the call site for `registerDebugUtilCallback` was left
gated on `#ifndef NDEBUG`. In `NDEBUG` builds this made the function
unused and triggered `-Wunused-function`, and at the same time decoupled
the callback from whether `VK_EXT_debug_utils` was actually loaded.

Tie the callback to the extension actually being enabled, and pull the
extension in whenever either `EnableDebugLayer` or `EnableValidationLayer`
is set so validation messages route through the callback (matching the
DX backend's coupling in `lib/API/DX/Device.cpp`).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MarijnS95 MarijnS95 requested a review from llvm-beanz June 3, 2026 08:29
@MarijnS95
Copy link
Copy Markdown
Collaborator Author

I.e. I've been seeing this on cmake-default debug builds:

LLVM/OffloadTest/lib/API/VK/Device.cpp:287:33: warning: ‘VkDebugUtilsMessengerEXT_T* registerDebugUtilCallback(VkInstance)’ defined but not used [-Wunused-function]
  287 | static VkDebugUtilsMessengerEXT registerDebugUtilCallback(VkInstance Instance) {
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~

@MarijnS95 MarijnS95 requested a review from bogner June 4, 2026 09:14
@MarijnS95 MarijnS95 merged commit 3eb318a into llvm:main Jun 5, 2026
24 of 28 checks passed
@MarijnS95 MarijnS95 deleted the worktree-vk-debug-utils-gate branch June 5, 2026 23:12
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