Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions runtime/shims/d3d12_vulkan_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1964,6 +1964,18 @@ struct DeviceState {
VkPipelineCache pipeline_cache_handle = VK_NULL_HANDLE;
std::atomic<ULONGLONG> next_checkpoint{GetTickCount64() + 120000};
std::atomic<unsigned> active_compiles{0};
// vkSetDebugUtilsObjectNameEXT when the instance enabled VK_EXT_debug_utils, else null. Compute pipelines carry
// their shader's name, so a crash-diagnostic dump or a capture names the dispatch that faulted.
PFN_vkSetDebugUtilsObjectNameEXT set_object_name = nullptr;

void name_object(VkObjectType type, std::uint64_t handle, const char* name) const {
if (!set_object_name || !handle || !name || !*name) return;
VkDebugUtilsObjectNameInfoEXT info{VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT};
info.objectType = type;
info.objectHandle = handle;
info.pObjectName = name;
set_object_name(this->info.device, &info);
}

VkPipelineCache pipeline_cache() {
std::call_once(pipeline_cache_once, [this] {
Expand Down Expand Up @@ -9159,6 +9171,8 @@ class PipelineState final
if (took >= 2000)
std::fprintf(stderr, "[rt] d3d12: compute pipeline %s took %.1f s to build (%zu B SPIR-V)\n",
entry->name.c_str(), double(took) / 1000.0, bytes);
device_.name_object(VK_OBJECT_TYPE_PIPELINE, std::uint64_t(reinterpret_cast<std::uintptr_t>(built)),
entry->name.c_str());
maybe_checkpoint(cache);
pipeline_.pipeline = built;
compute_failed_ = false;
Expand Down Expand Up @@ -11142,6 +11156,7 @@ class Device final
load(labels.queue_begin, "vkQueueBeginDebugUtilsLabelEXT");
load(labels.queue_end, "vkQueueEndDebugUtilsLabelEXT");
state_.context->enable_debug_labels(labels);
load(state_.set_object_name, "vkSetDebugUtilsObjectNameEXT");
if (!state_.context->debug_labels())
std::fprintf(stderr, "[rt] d3d12: VK_EXT_debug_utils entry points missing; debug markers are off\n");
}
Expand Down