public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/94648] New: [OpenMP] DEVICE_HOST_FALLBACK when no actual device + omp_target_alloc + omp_get_default_device
@ 2020-04-18 11:17 burnus at gcc dot gnu.org
2023-06-22 9:50 ` [Bug libgomp/94648] " burnus at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-04-18 11:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94648
Bug ID: 94648
Summary: [OpenMP] DEVICE_HOST_FALLBACK when no actual device +
omp_target_alloc + omp_get_default_device
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Keywords: openmp, 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: ---
That's with sollve_vv, tests/4.5/target_data/test_target_data_map_alloc.c
https://github.com/SOLLVE/sollve_vv.git
If one runs that test case on a system without offloading support compiled it,
it fails:
int *d_sum = (int *)omp_target_alloc(sizeof(int), omp_get_default_device());
#pragma omp target is_device_ptr(d_sum)
* The omp_get_default_device () function returns '0'
* omp_target_alloc contains:
if (device_num == GOMP_DEVICE_HOST_FALLBACK)
return malloc (size);
struct gomp_device_descr *devicep = resolve_device (device_num);
if (devicep == NULL)
return NULL;
As devicep == NULL, it fails.
I wonder whether
omp_get_default_device ()
should return -2 == GOMP_DEVICE_HOST_FALLBACK in this case – namely, if no
devices are available and, possibly, if OMP_DEFAULT_DEVICE is not explicitly
set.
At least that seems to make more sense than "0" and then failing to
return omp_target_alloc.
"TABLE2.1:ICV Initial Values" lists
default-device-var OMP_DEFAULT_DEVICE Implementation defined
Thus, I think it would be permitted. (But I might have missed some fine print.)
* * *
#include <assert.h>
#include <omp.h>
int main()
{
int sum = 0;
int *d_sum = (int *) omp_target_alloc (sizeof (int),
omp_get_default_device ());
assert (d_sum);
#pragma omp target is_device_ptr(d_sum) map(from:sum)
{
*d_sum = 42;
sum = *d_sum;
}
assert (sum == 42);
return 0;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug libgomp/94648] [OpenMP] DEVICE_HOST_FALLBACK when no actual device + omp_target_alloc + omp_get_default_device
2020-04-18 11:17 [Bug libgomp/94648] New: [OpenMP] DEVICE_HOST_FALLBACK when no actual device + omp_target_alloc + omp_get_default_device burnus at gcc dot gnu.org
@ 2023-06-22 9:50 ` burnus at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2023-06-22 9:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94648
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Seemingly it was fixed at some point.
The testcase fails with GCC 10.3.1 20210507 but works with GCC 11.4.1 20230621
and GCC 12/13/mainline.
Close as FIXED:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-22 9:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-18 11:17 [Bug libgomp/94648] New: [OpenMP] DEVICE_HOST_FALLBACK when no actual device + omp_target_alloc + omp_get_default_device burnus at gcc dot gnu.org
2023-06-22 9:50 ` [Bug libgomp/94648] " burnus at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).