From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C75F83858C52; Fri, 12 May 2023 23:08:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C75F83858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683932882; bh=Fqm7AMl+YHqIm99nqBWsEiSgqa7qpon9l5i8QBm98Ok=; h=From:To:Subject:Date:From; b=DrTvyiMeqp8Vp6DIGesaH/unxAe6CUgS8QHI61IWfmDcb3wpiL3uBsEDXXzwwvPM7 yM2Yh+uf2VPhBF6ZiXpT0e8z2VZUV8S/hUF+tipaHU7iToRFaUwWz6+26jWRzSlFTo UQYpyU1/a2a3Im85/TTVh/Om80itIlV3PrTNkqwE= From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libgomp/109837] New: [OpenMP] despite 'requires unified_address' there is segfault when 'is_device_ptr' is not used Date: Fri, 12 May 2023 23:08:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libgomp X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109837 Bug ID: 109837 Summary: [OpenMP] despite 'requires unified_address' there is segfault when 'is_device_ptr' is not used Product: gcc Version: 13.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org CC: jakub at gcc dot gnu.org Target Milestone: --- Cf. https://github.com/SOLLVE/sollve_vv/pull/734 for a testcase. For nvptx, we currently have: GOMP_OFFLOAD_get_num_devices (unsigned int omp_requires_mask) ... && ((omp_requires_mask & ~(GOMP_REQUIRES_UNIFIED_ADDRESS | GOMP_REQUIRES_REVERSE_OFFLOAD)) !=3D 0)) That is: we accept for nvptx omp requires unfied_address However, while the address space is the same, the following is not handled: > the is_device_ptr clause is not necessary to obtain device addresses from= device pointers for use inside target regions. Expected: (A) Mapping related: is_device_ptr can be left out. (B) omp_target_is_accessible - will properly work for such pointers. For nvptx, the check can be done via cudaPointerGetAttributes if I understand https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__UNIFIED.html correctly. * * * NOTE: Something similar is needed for GCN, except that its GOMP_OFFLOAD_get_num_devices currently returns -1 when GOMP_REQUIRES_UNIFIED_ADDRESS has been requested. It seems as if hsa_amd_pointer_info is the function to be used, cf. https://github.com/RadeonOpenCompute/ROCR-Runtime/blob/master/src/inc/hsa_e= xt_amd.h=