From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 894653858C52; Thu, 5 Oct 2023 17:28:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 894653858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696526885; bh=iTrQ3Ds9qmb0s1rZTzrXZJQOa+iyGTKgUGA48SDCe/w=; h=From:To:Subject:Date:From; b=lagZ4GDPECW/HBvok9J/qFoZXoMjowt6sLEof7kYjPLPOZfQFHO0WxWyh1P0avOW3 YXeHVaIpdCFgE8Ohf7iFS1a77xXfiJzT+YzRso5/L77ikH53phIeTIq4khpqngK9/Y Kt20i5K+HUZwQzAMRr2B8hnqYJ9wWWHMuCUdqVlA= From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libgomp/111707] New: omp_target_alloc and omp_target_is_present - corner case handling & spec conformance Date: Thu, 05 Oct 2023 17:28:05 +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: 14.0 X-Bugzilla-Keywords: documentation, 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=3D111707 Bug ID: 111707 Summary: omp_target_alloc and omp_target_is_present - corner case handling & spec conformance Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: documentation, 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: --- To be checked / updated. Besides fixing the code, also libgomp.texi needs to be updated. omp_target_alloc: For size =3D=3D 0, the spec meanwhile requires that NULL is returned. However, we call 'malloc' on the host which might return a a non-NULL pointer that can be passed to 'free'. And on the device side, an GOMP_error diagnostic is printed to stderr for nvptx and gcn if the allocation fails. Both the HSA and CUDA documentation imply that size=3D=3D0 is an error. omp_target_is_present OpenMP states that this functions checks whether the pointer is mapped. In GCC, we also return 'true' for shared memory systems and for the device_num being the host. The question is whether that's OK or not. Does a SELF MAP qualify or not? (self map - A mapping operation that, when corresponding storage is not already present, results in corresponding storage that is the same as its original storage.) [The current behavior is about to be documented, but we can change it.]=