From def7312e361b9db4d512aaa3038acbb382b7c969 Mon Sep 17 00:00:00 2001 From: Andy Jost Date: Thu, 18 Dec 2025 10:13:32 -0800 Subject: [PATCH] Adds defensive code in device _get_attribute to gracefully handle queries against older drivers. --- cuda_core/cuda/core/_device.pyx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cuda_core/cuda/core/_device.pyx b/cuda_core/cuda/core/_device.pyx index 2d775b6580..657fbefa69 100644 --- a/cuda_core/cuda/core/_device.pyx +++ b/cuda_core/cuda/core/_device.pyx @@ -58,8 +58,12 @@ cdef class DeviceProperties: cdef inline _get_attribute(self, cydriver.CUdevice_attribute attr): """Retrieve the attribute value directly from the driver.""" cdef int val + cdef cydriver.CUresult err with nogil: - HANDLE_RETURN(cydriver.cuDeviceGetAttribute(&val, attr, self._handle)) + err = cydriver.cuDeviceGetAttribute(&val, attr, self._handle) + if err == cydriver.CUresult.CUDA_ERROR_INVALID_VALUE: + return 0 + HANDLE_RETURN(err) return val cdef _get_cached_attribute(self, attr):