[gcn][nvptx] Add warning to mkoffload for 32bit host code mkoffload in principle handles 32bit and 64bit offload targets, but 32bit support has no been implemented. Before this patch, offloading is then silently disabled for the respective target. With the patch, the user gets a warning by mkoffload (and the programm continues to be build with out offloading code). gcc/ChangeLog: * config/gcn/mkoffload.cc (main): Warn for -foffload-abi=ilp32 that no offload code will be generated. * config/nvptx/mkoffload.cc (main): Likewise. libgomp/ChangeLog: * testsuite/lib/libgomp-dg.exp (libgomp-dg-prune): Prune warning by mkoffload that 32-bit offloading is not supported. * testsuite/libgomp.c-c++-common/requires-1.c: Silence a FAIL for 'ia32' targets as for them no offload code is generated. * testsuite/libgomp.c-c++-common/requires-3.c: Likewise. * testsuite/libgomp.c-c++-common/requires-7.c: Likewise. * testsuite/libgomp.c-c++-common/variable-not-offloaded.c: Likewise. * testsuite/libgomp.fortran/requires-1.f90: Likewise. gcc/config/gcn/mkoffload.cc | 5 ++++- gcc/config/nvptx/mkoffload.cc | 5 ++++- libgomp/testsuite/lib/libgomp-dg.exp | 3 +++ libgomp/testsuite/libgomp.c-c++-common/requires-1.c | 8 +++++--- libgomp/testsuite/libgomp.c-c++-common/requires-3.c | 8 +++++--- libgomp/testsuite/libgomp.c-c++-common/requires-7.c | 10 ++++++---- .../testsuite/libgomp.c-c++-common/variable-not-offloaded.c | 4 ++-- libgomp/testsuite/libgomp.fortran/requires-1.f90 | 8 +++++--- 8 files changed, 34 insertions(+), 17 deletions(-) diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc index 9a438de331a..c37c269d4d2 100644 --- a/gcc/config/gcn/mkoffload.cc +++ b/gcc/config/gcn/mkoffload.cc @@ -1143,7 +1143,10 @@ main (int argc, char **argv) fatal_error (input_location, "cannot open %qs", gcn_cfile_name); /* Currently, we only support offloading in 64-bit configurations. */ - if (offload_abi == OFFLOAD_ABI_LP64) + if (offload_abi == OFFLOAD_ABI_ILP32) + warning (0, "offload code generation skipped: offloading with 32-bit host " + "code is currently not supported"); + else if (offload_abi == OFFLOAD_ABI_LP64) { const char *mko_dumpbase = concat (dumppfx, ".mkoffload", NULL); const char *hsaco_dumpbase = concat (dumppfx, ".mkoffload.hsaco", NULL); diff --git a/gcc/config/nvptx/mkoffload.cc b/gcc/config/nvptx/mkoffload.cc index 503b1abcefd..a7ff32cf8bd 100644 --- a/gcc/config/nvptx/mkoffload.cc +++ b/gcc/config/nvptx/mkoffload.cc @@ -798,7 +798,10 @@ main (int argc, char **argv) /* PR libgomp/65099: Currently, we only support offloading in 64-bit configurations. */ - if (offload_abi == OFFLOAD_ABI_LP64) + if (offload_abi == OFFLOAD_ABI_ILP32) + warning (0, "offload code generation skipped: offloading with 32-bit host " + "code is currently not supported"); + else if (offload_abi == OFFLOAD_ABI_LP64) { char *mko_dumpbase = concat (dumppfx, ".mkoffload", NULL); if (save_temps) diff --git a/libgomp/testsuite/lib/libgomp-dg.exp b/libgomp/testsuite/lib/libgomp-dg.exp index ebf78e17e6d..9c9a5f2ed4b 100644 --- a/libgomp/testsuite/lib/libgomp-dg.exp +++ b/libgomp/testsuite/lib/libgomp-dg.exp @@ -3,5 +3,8 @@ proc libgomp-dg-test { prog do_what extra_tool_flags } { } proc libgomp-dg-prune { system text } { + global additional_prunes + lappend additional_prunes "offloading with 32-bit host code is currently not supported" + return [gcc-dg-prune $system $text] } diff --git a/libgomp/testsuite/libgomp.c-c++-common/requires-1.c b/libgomp/testsuite/libgomp.c-c++-common/requires-1.c index 31996f1ecf6..2168db476c2 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/requires-1.c +++ b/libgomp/testsuite/libgomp.c-c++-common/requires-1.c @@ -20,7 +20,9 @@ main (void) return 0; } -/* { dg-error "OpenMP 'requires' directive with non-identical clauses in multiple compilation units: 'unified_shared_memory' vs. 'unified_address'" "" { target *-*-* } 0 } - { dg-note {requires-1\.c' has 'unified_shared_memory'} {} { target *-*-* } 0 } - { dg-note {requires-1-aux\.c' has 'unified_address'} {} { target *-*-* } 0 } */ +/* Skip for ia32 as mkoffload requires 64 bit (and warns otherwise); cf. PR libgomp/65099. */ + +/* { dg-error "OpenMP 'requires' directive with non-identical clauses in multiple compilation units: 'unified_shared_memory' vs. 'unified_address'" "" { target { ! ia32 } } 0 } + { dg-note {requires-1\.c' has 'unified_shared_memory'} {} { target { ! ia32 } } 0 } + { dg-note {requires-1-aux\.c' has 'unified_address'} {} { target { ! ia32 } } 0 } */ /* { dg-excess-errors "Ignore messages like: errors during merging of translation units|mkoffload returned 1 exit status" } */ diff --git a/libgomp/testsuite/libgomp.c-c++-common/requires-3.c b/libgomp/testsuite/libgomp.c-c++-common/requires-3.c index a549a19ebbb..694ea6965b3 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/requires-3.c +++ b/libgomp/testsuite/libgomp.c-c++-common/requires-3.c @@ -20,7 +20,9 @@ main (void) return 0; } -/* { dg-error "OpenMP 'requires' directive with non-identical clauses in multiple compilation units: 'unified_address, unified_shared_memory' vs. 'unified_address'" "" { target *-*-* } 0 } - { dg-note {requires-3\.c' has 'unified_address, unified_shared_memory'} {} { target *-*-* } 0 } - { dg-note {requires-3-aux\.c' has 'unified_address'} {} { target *-*-* } 0 } */ +/* Skip for ia32 as mkoffload requires 64 bit (and warns otherwise); cf. PR libgomp/65099. */ + +/* { dg-error "OpenMP 'requires' directive with non-identical clauses in multiple compilation units: 'unified_address, unified_shared_memory' vs. 'unified_address'" "" { target { ! ia32 } } 0 } + { dg-note {requires-3\.c' has 'unified_address, unified_shared_memory'} {} { target { ! ia32 } } 0 } + { dg-note {requires-3-aux\.c' has 'unified_address'} {} { target { ! ia32 } } 0 } */ /* { dg-excess-errors "Ignore messages like: errors during merging of translation units|mkoffload returned 1 exit status" } */ diff --git a/libgomp/testsuite/libgomp.c-c++-common/requires-7.c b/libgomp/testsuite/libgomp.c-c++-common/requires-7.c index 63afcc92b9a..305f4b34e03 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/requires-7.c +++ b/libgomp/testsuite/libgomp.c-c++-common/requires-7.c @@ -20,13 +20,15 @@ main (void) return 0; } -/* { dg-error "OpenMP 'requires' directive with non-identical clauses in multiple compilation units: 'unified_shared_memory' vs. 'unified_address'" "" { target *-*-* } 0 } - { dg-note {requires-7\.c' has 'unified_shared_memory'} {} { target *-*-* } 0 } +/* Skip for ia32 as mkoffload requires 64 bit (and warns otherwise); cf. PR libgomp/65099. */ + +/* { dg-error "OpenMP 'requires' directive with non-identical clauses in multiple compilation units: 'unified_shared_memory' vs. 'unified_address'" "" { target { ! ia32 } } 0 } + { dg-note {requires-7\.c' has 'unified_shared_memory'} {} { target { ! ia32 } } 0 } TODO We're currently not streaming location information for the OpenMP directives used in 'requires-7-aux.c', so we're not seeing the source file name here (but a temporary '*.o' instead; for details, see ): - { dg-note {requires-7-aux\.c' has 'unified_address'} {} { xfail *-*-* } 0 } + { dg-note {requires-7-aux\.c' has 'unified_address'} {} { xfail { *-*-* } } 0 } ..., but we may still verify that the rest of the diagnostic is correct: - { dg-note {' has 'unified_address'} {} { target *-*-* } 0 } */ + { dg-note {' has 'unified_address'} {} { target { ! ia32 } } 0 } */ /* { dg-excess-errors "Ignore messages like: errors during merging of translation units|mkoffload returned 1 exit status" } */ diff --git a/libgomp/testsuite/libgomp.c-c++-common/variable-not-offloaded.c b/libgomp/testsuite/libgomp.c-c++-common/variable-not-offloaded.c index fe2a8b26242..707ef1798e7 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/variable-not-offloaded.c +++ b/libgomp/testsuite/libgomp.c-c++-common/variable-not-offloaded.c @@ -1,7 +1,7 @@ /* { dg-do link } */ -/* { dg-excess-errors "lto1, mkoffload and lto-wrapper fatal errors" { target { offload_target_nvptx || offload_target_amdgcn } } } */ +/* { dg-excess-errors "lto1, mkoffload and lto-wrapper fatal errors" { target { { ! ia32 } && { offload_target_nvptx || offload_target_amdgcn } } } } */ -int var; /* { dg-error "variable 'var' has been referenced in offloaded code but hasn't been marked to be included in the offloaded code" "" { target { offload_target_nvptx || offload_target_amdgcn } } } */ +int var; /* { dg-error "variable 'var' has been referenced in offloaded code but hasn't been marked to be included in the offloaded code" "" { target { { ! ia32 } && { offload_target_nvptx || offload_target_amdgcn } } } } */ #pragma omp declare target void __attribute__((noinline, noclone)) diff --git a/libgomp/testsuite/libgomp.fortran/requires-1.f90 b/libgomp/testsuite/libgomp.fortran/requires-1.f90 index 9a0c33461f8..3a2eb357ebc 100644 --- a/libgomp/testsuite/libgomp.fortran/requires-1.f90 +++ b/libgomp/testsuite/libgomp.fortran/requires-1.f90 @@ -22,13 +22,15 @@ program main call foo () end -! { dg-error "OpenMP 'requires' directive with non-identical clauses in multiple compilation units: 'unified_shared_memory' vs. 'unified_address'" "" { target *-*-* } 0 } -! { dg-note {requires-1\.f90' has 'unified_shared_memory'} {} { target *-*-* } 0 } +! Skip for ia32 as mkoffload requires 64 bit (and warns otherwise); cf. PR libgomp/65099. + +! { dg-error "OpenMP 'requires' directive with non-identical clauses in multiple compilation units: 'unified_shared_memory' vs. 'unified_address'" "" { target { ! ia32 } } 0 } +! { dg-note {requires-1\.f90' has 'unified_shared_memory'} {} { target { ! ia32 } } 0 } ! TODO We're currently not streaming location information for the OpenMP ! directives used in 'requires-7-aux.c', so we're not seeing the source file ! name here (but a temporary '*.o' instead; for details, see ! ): ! { dg-note {requires-1-aux\.f90' has 'unified_address'} {} { xfail *-*-* } 0 } ! ..., but we may still verify that the rest of the diagnostic is correct: -! { dg-note {' has 'unified_address'} {} { target *-*-* } 0 } +! { dg-note {' has 'unified_address'} {} { target { ! ia32 } } 0 } ! { dg-excess-errors "Ignore messages like: errors during merging of translation units|mkoffload returned 1 exit status" }