upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/vulkan_backend.h
diff options
context:
space:
mode:
authorquartz-heron-58 <245169279+quartz-heron-58@users.noreply.github.com>2026-11-25 00:57:36 +0800
committerquartz-heron-58 <245169279+quartz-heron-58@users.noreply.github.com>2026-11-25 00:57:36 +0800
commit35e38baee361f55cdbcb0c7b9febe4b48481fdcf (patch)
treebe4283d0e42473298ffaade7597edd1aac8f7db8 /runtime/src/vulkan_backend.h
parentda74b96810eba31eb15d1cfd576fe4c69f159912 (diff)
vulkan: a loss the driver shows only as a counter of UINT64_MAX is recorded
VulkanFence::completed() passed a counter of UINT64_MAX on to the title when vkGetSemaphoreCounterValue succeeded with it, so the layer never learned its device was lost. It now asks vkDeviceWaitIdle under the submit lock and records the loss on VK_ERROR_DEVICE_LOST, after which the driver answers vkGetDeviceFaultInfoEXT. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/vulkan_backend.h')
-rw-r--r--runtime/src/vulkan_backend.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/src/vulkan_backend.h b/runtime/src/vulkan_backend.h
index 7f0723483..b3ed5f6c3 100644
--- a/runtime/src/vulkan_backend.h
+++ b/runtime/src/vulkan_backend.h
@@ -1819,6 +1819,23 @@ public:
1819 return UINT64_MAX; 1819 return UINT64_MAX;
1820 } 1820 }
1821 if (result != VK_SUCCESS) return 0; 1821 if (result != VK_SUCCESS) return 0;
1822 // A driver can show a lost device here without an error: the query succeeds and the counter reads UINT64_MAX
1823 // (measured on NVIDIA 621.24, RTX 4080; vkWaitSemaphores on it succeeds too). A title reads that value as
1824 // "device removed" and stops, so without this the layer never learned its device was gone and said nothing.
1825 // No fence of the layer is signalled to UINT64_MAX, but the value alone is not taken as proof: vkDeviceWaitIdle
1826 // is asked, under the submit lock its queues need, and only its VK_ERROR_DEVICE_LOST records the loss. That
1827 // call is also what lets the driver answer vkGetDeviceFaultInfoEXT, which it refuses before it has reported
1828 // the loss through a return code.
1829 if (value == UINT64_MAX) {
1830 VkResult idle = VK_SUCCESS;
1831 {
1832 std::lock_guard lock(context_.submit_mutex());
1833 idle = context_.vk.vkDeviceWaitIdle(context_.device());
1834 }
1835 if (idle == VK_ERROR_DEVICE_LOST)
1836 context_.mark_device_lost("a fence's counter read UINT64_MAX and vkDeviceWaitIdle then returned "
1837 "VK_ERROR_DEVICE_LOST");
1838 }
1822 return value; 1839 return value;
1823 } 1840 }
1824 1841