public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libgomp/94648] New: [OpenMP] DEVICE_HOST_FALLBACK when no actual device + omp_target_alloc + omp_get_default_device Date: Sat, 18 Apr 2020 11:17:38 +0000 [thread overview] Message-ID: <bug-94648-4@http.gcc.gnu.org/bugzilla/> (raw) 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; }
next reply other threads:[~2020-04-18 11:17 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-18 11:17 burnus at gcc dot gnu.org [this message] 2023-06-22 9:50 ` [Bug libgomp/94648] " burnus at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-94648-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).