diff --git a/src/runtime/vulkan/vulkan.cc b/src/runtime/vulkan/vulkan.cc index d82f6f40a143..b7fe2b1ceb21 100644 --- a/src/runtime/vulkan/vulkan.cc +++ b/src/runtime/vulkan/vulkan.cc @@ -412,8 +412,13 @@ class VulkanDeviceAPI final : public DeviceAPI { } static VulkanDeviceAPI* Global() { - static VulkanDeviceAPI* inst = new VulkanDeviceAPI(); - return inst; + // Most of the TVM Global() functions allocate with "new" and do + // not deallocate, as the OS can clean up any leftover buffers at + // the end. In this case, we need the VulkanDeviceAPI destructor + // to call vkDestroyInstance, to prevent a segfault on exit when + // using some nvidia drivers. + static VulkanDeviceAPI inst; + return &inst; } const VulkanContext& context(size_t device_id) const {