]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
nvptx: 'cuDeviceGetCount' failure is fatal
authorThomas Schwinge <tschwinge@baylibre.com>
Thu, 7 Mar 2024 12:18:23 +0000 (13:18 +0100)
committerThomas Schwinge <tschwinge@baylibre.com>
Fri, 8 Mar 2024 15:35:28 +0000 (16:35 +0100)
Per commit 683f11843974f0bdf42f79cdcbb0c2b43c7b81b0
"OpenMP: Move omp requires checks to libgomp", we're now using 'return -1'
from 'GOMP_OFFLOAD_get_num_devices' for 'omp_requires_mask' purposes.  This
missed that via 'nvptx_get_num_devices', we could also 'return -1' for
'cuDeviceGetCount' failure.  Before, this meant (in 'gomp_target_init') to
silently ignore the plugin/device -- which also has been doubtful behavior.
Let's instead turn 'cuDeviceGetCount' failure into a fatal error, similar to
other errors during device initialization.

libgomp/
* plugin/plugin-nvptx.c (nvptx_get_num_devices):
'cuDeviceGetCount' failure is fatal.

libgomp/plugin/plugin-nvptx.c

index 2bc7b850671acb096c7d85ac73f8140f57482c5b..ced6e014ecee2b076a1b57e6188ca67725d89a68 100644 (file)
@@ -612,7 +612,7 @@ nvptx_get_num_devices (void)
        }
     }
 
-  CUDA_CALL_ERET (-1, cuDeviceGetCount, &n);
+  CUDA_CALL_ASSERT (cuDeviceGetCount, &n);
   return n;
 }