From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 4A8F8385DC0F; Fri, 8 Mar 2024 15:36:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A8F8385DC0F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709912167; bh=Pv5VGeVQx/YeecNwppfKvRMp8DE5Q8mT5GyxbSJAILA=; h=From:To:Subject:Date:From; b=WsURTx41GfPf6xn/BMDQgpBFmPxEpuzRWRDssUu1VgfuQzg3i5ymtG+F9yNY/h/pb 5/M+js7/BUswzXa8jb3nPPUWnMRxFHw3fmVEOWDigFTBqZj4+l/qnbN+8F4S95J/iq f9s+0jmcw/MOyRLc4S40sLAkaMPCxP9yA8w1vvk0= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-9396] nvptx: 'cuDeviceGetCount' failure is fatal X-Act-Checkin: gcc X-Git-Author: Thomas Schwinge X-Git-Refname: refs/heads/master X-Git-Oldrev: ab70addf560e18210d238edfd605fc91fcce9df1 X-Git-Newrev: 37078f241a22c45db6380c5e9a79b4d08054bb3d Message-Id: <20240308153607.4A8F8385DC0F@sourceware.org> Date: Fri, 8 Mar 2024 15:36:07 +0000 (GMT) List-Id: https://gcc.gnu.org/g:37078f241a22c45db6380c5e9a79b4d08054bb3d commit r14-9396-g37078f241a22c45db6380c5e9a79b4d08054bb3d Author: Thomas Schwinge Date: Thu Mar 7 13:18:23 2024 +0100 nvptx: 'cuDeviceGetCount' failure is fatal 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. Diff: --- libgomp/plugin/plugin-nvptx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c index 2bc7b850671..ced6e014ece 100644 --- a/libgomp/plugin/plugin-nvptx.c +++ b/libgomp/plugin/plugin-nvptx.c @@ -612,7 +612,7 @@ nvptx_get_num_devices (void) } } - CUDA_CALL_ERET (-1, cuDeviceGetCount, &n); + CUDA_CALL_ASSERT (cuDeviceGetCount, &n); return n; }