diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2022-09-12 15:25:13 +0200 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2022-09-12 15:25:13 +0200 |
commit | 6b43f556f392a7165582aca36a19fe7389d995b2 (patch) | |
tree | 7823adb3d376ebb0d0c71a3177ee2def6f861c94 /gcc | |
parent | 06b30eecdd9822842a0ff21548ab92f01adb2795 (diff) | |
download | gcc-6b43f556f392a7165582aca36a19fe7389d995b2.zip gcc-6b43f556f392a7165582aca36a19fe7389d995b2.tar.gz gcc-6b43f556f392a7165582aca36a19fe7389d995b2.tar.bz2 |
nvptx/mkoffload.cc: Warn instead of error when reverse offload is not possible
Reverse offload requests at least -misa=sm_35; with this patch, a warning
instead of an error is shown, still permitting reverse offload for all
other configured device types. This is achieved by not calling
GOMP_offload_register_ver (and stopping generating pointless 'static const char'
variables, once known.)
The tool_name as progname changes adds "nvptx " and "gcn " to the
"mkoffload: warning/error:" diagnostic.
gcc/ChangeLog:
* config/nvptx/mkoffload.cc (process): Replace a fatal_error by
a warning + not enabling offloading if -misa=sm_30 prevents
reverse offload.
(main): Use tool_name as progname for diagnostic.
* config/gcn/mkoffload.cc (main): Likewise.
libgomp/ChangeLog:
* libgomp.texi (Offload-Target Specifics: nvptx): Document
that reverse offload requires >= -march=sm_35.
* testsuite/libgomp.c-c++-common/requires-4.c: Build for nvptx
with -misa=sm_35.
* testsuite/libgomp.c-c++-common/requires-5.c: Likewise.
* testsuite/libgomp.c-c++-common/requires-6.c: Likewise.
* testsuite/libgomp.c-c++-common/reverse-offload-1.c: Likewise.
* testsuite/libgomp.fortran/reverse-offload-1.f90: Likewise.
* testsuite/libgomp.c/reverse-offload-sm30.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/gcn/mkoffload.cc | 2 | ||||
-rw-r--r-- | gcc/config/nvptx/mkoffload.cc | 18 |
2 files changed, 15 insertions, 5 deletions
diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc index 24d3273..6403780 100644 --- a/gcc/config/gcn/mkoffload.cc +++ b/gcc/config/gcn/mkoffload.cc @@ -805,7 +805,7 @@ main (int argc, char **argv) FILE *cfile = stdout; const char *outname = 0; - progname = "mkoffload"; + progname = tool_name; diagnostic_initialize (global_dc, 0); obstack_init (&files_to_cleanup); diff --git a/gcc/config/nvptx/mkoffload.cc b/gcc/config/nvptx/mkoffload.cc index 834b205..854cd72 100644 --- a/gcc/config/nvptx/mkoffload.cc +++ b/gcc/config/nvptx/mkoffload.cc @@ -324,9 +324,19 @@ process (FILE *in, FILE *out, uint32_t omp_requires) { if (sm_ver && sm_ver[0] == '3' && sm_ver[1] == '0' && sm_ver[2] == '\n') - fatal_error (input_location, - "%<omp requires reverse_offload%> requires at least " - "%<sm_35%> for %<-misa=%>"); + { + warning_at (input_location, 0, + "%<omp requires reverse_offload%> requires at " + "least %<sm_35%> for " + "%<-foffload-options=nvptx-none=-march=%> - disabling" + " offload-code generation for this device type"); + /* As now an empty file is compiled and there is no call to + GOMP_offload_register_ver, this device type is effectively + disabled. */ + fflush (out); + ftruncate (fileno (out), 0); + return; + } sm_ver2 = sm_ver; version2 = version; } @@ -526,7 +536,7 @@ main (int argc, char **argv) FILE *out = stdout; const char *outname = 0; - progname = "mkoffload"; + progname = tool_name; diagnostic_initialize (global_dc, 0); if (atexit (mkoffload_cleanup) != 0) |