aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>2015-07-15 11:55:13 +0000
committertschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>2015-07-15 11:55:13 +0000
commit18b34bf24f4fc64073d3fcdc92e8416334ff6b1f (patch)
treec779a127ab8c06d5090b3b113488da7f09c0b9ba
parent0aaaae3ed019d1cb8b47c23e36f8a94997310678 (diff)
[PR libgomp/65099] nvptx offloading: only 64-bit configurations are currently supported
Backport trunk r225560: PR libgomp/65099 gcc/ * config/nvptx/mkoffload.c (main): Create an offload image only in 64-bit configurations. libgomp/ * plugin/plugin-nvptx.c (nvptx_get_num_devices): Return 0 if not in a 64-bit configuration. * testsuite/libgomp.oacc-c++/c++.exp: Don't attempt nvidia offloading testing if no such device is available. * testsuite/libgomp.oacc-c/c.exp: Likewise. * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@225824 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/nvptx/mkoffload.c56
-rw-r--r--libgomp/ChangeLog12
-rw-r--r--libgomp/plugin/plugin-nvptx.c5
-rw-r--r--libgomp/testsuite/libgomp.oacc-c++/c++.exp6
-rw-r--r--libgomp/testsuite/libgomp.oacc-c/c.exp6
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/fortran.exp6
7 files changed, 74 insertions, 25 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 84ed053705b..7534e33f3e8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2015-07-15 Thomas Schwinge <thomas@codesourcery.com>
+ Backport trunk r225560:
+
+ 2015-07-08 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR libgomp/65099
+ * config/nvptx/mkoffload.c (main): Create an offload image only in
+ 64-bit configurations.
+
Backport trunk r222583:
2015-04-29 Thomas Schwinge <thomas@codesourcery.com>
diff --git a/gcc/config/nvptx/mkoffload.c b/gcc/config/nvptx/mkoffload.c
index 8687154a1ac..8bc08bfeaeb 100644
--- a/gcc/config/nvptx/mkoffload.c
+++ b/gcc/config/nvptx/mkoffload.c
@@ -993,37 +993,43 @@ main (int argc, char **argv)
obstack_ptr_grow (&argv_obstack, argv[ix]);
}
- ptx_name = make_temp_file (".mkoffload");
- obstack_ptr_grow (&argv_obstack, "-o");
- obstack_ptr_grow (&argv_obstack, ptx_name);
- obstack_ptr_grow (&argv_obstack, NULL);
- const char **new_argv = XOBFINISH (&argv_obstack, const char **);
-
- char *execpath = getenv ("GCC_EXEC_PREFIX");
- char *cpath = getenv ("COMPILER_PATH");
- char *lpath = getenv ("LIBRARY_PATH");
- unsetenv ("GCC_EXEC_PREFIX");
- unsetenv ("COMPILER_PATH");
- unsetenv ("LIBRARY_PATH");
-
- fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true);
- obstack_free (&argv_obstack, NULL);
-
- xputenv (concat ("GCC_EXEC_PREFIX=", execpath, NULL));
- xputenv (concat ("COMPILER_PATH=", cpath, NULL));
- xputenv (concat ("LIBRARY_PATH=", lpath, NULL));
-
- in = fopen (ptx_name, "r");
- if (!in)
- fatal_error (input_location, "cannot open intermediate ptx file");
-
ptx_cfile_name = make_temp_file (".c");
out = fopen (ptx_cfile_name, "w");
if (!out)
fatal_error (input_location, "cannot open '%s'", ptx_cfile_name);
- process (in, out);
+ /* PR libgomp/65099: Currently, we only support offloading in 64-bit
+ configurations. */
+ if (!target_ilp32)
+ {
+ ptx_name = make_temp_file (".mkoffload");
+ obstack_ptr_grow (&argv_obstack, "-o");
+ obstack_ptr_grow (&argv_obstack, ptx_name);
+ obstack_ptr_grow (&argv_obstack, NULL);
+ const char **new_argv = XOBFINISH (&argv_obstack, const char **);
+
+ char *execpath = getenv ("GCC_EXEC_PREFIX");
+ char *cpath = getenv ("COMPILER_PATH");
+ char *lpath = getenv ("LIBRARY_PATH");
+ unsetenv ("GCC_EXEC_PREFIX");
+ unsetenv ("COMPILER_PATH");
+ unsetenv ("LIBRARY_PATH");
+
+ fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true);
+ obstack_free (&argv_obstack, NULL);
+
+ xputenv (concat ("GCC_EXEC_PREFIX=", execpath, NULL));
+ xputenv (concat ("COMPILER_PATH=", cpath, NULL));
+ xputenv (concat ("LIBRARY_PATH=", lpath, NULL));
+
+ in = fopen (ptx_name, "r");
+ if (!in)
+ fatal_error (input_location, "cannot open intermediate ptx file");
+
+ process (in, out);
+ }
+
fclose (out);
compile_native (ptx_cfile_name, outname, collect_gcc);
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 69ed38c5c1b..692dd751a64 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,5 +1,17 @@
2015-07-15 Thomas Schwinge <thomas@codesourcery.com>
+ Backport trunk r225560:
+
+ 2015-07-08 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR libgomp/65099
+ * plugin/plugin-nvptx.c (nvptx_get_num_devices): Return 0 if not
+ in a 64-bit configuration.
+ * testsuite/libgomp.oacc-c++/c++.exp: Don't attempt nvidia
+ offloading testing if no such device is available.
+ * testsuite/libgomp.oacc-c/c.exp: Likewise.
+ * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
+
Backport trunk r223801:
2015-05-28 Julian Brown <julian@codesourcery.com>
diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c
index 583ec87aeee..f9754b98f5a 100644
--- a/libgomp/plugin/plugin-nvptx.c
+++ b/libgomp/plugin/plugin-nvptx.c
@@ -777,6 +777,11 @@ nvptx_get_num_devices (void)
int n;
CUresult r;
+ /* PR libgomp/65099: Currently, we only support offloading in 64-bit
+ configurations. */
+ if (sizeof (void *) != 8)
+ return 0;
+
/* This function will be called before the plugin has been initialized in
order to enumerate available devices, but CUDA API routines can't be used
until cuInit has been called. Just call it now (but don't yet do any
diff --git a/libgomp/testsuite/libgomp.oacc-c++/c++.exp b/libgomp/testsuite/libgomp.oacc-c++/c++.exp
index f486f9b97ba..8941432b3e8 100644
--- a/libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ b/libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -80,6 +80,12 @@ if { $lang_test_file_found } {
set acc_mem_shared 0
}
nvidia {
+ if { ![check_effective_target_openacc_nvidia_accel_present] } {
+ # Don't bother; execution testing is going to FAIL.
+ untested "$subdir $offload_target_openacc offloading"
+ continue
+ }
+
# Copy ptx file (TEMPORARY)
remote_download host $srcdir/libgomp.oacc-c-c++-common/subr.ptx
diff --git a/libgomp/testsuite/libgomp.oacc-c/c.exp b/libgomp/testsuite/libgomp.oacc-c/c.exp
index c0c70bbacad..326b988d99a 100644
--- a/libgomp/testsuite/libgomp.oacc-c/c.exp
+++ b/libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -48,6 +48,12 @@ foreach offload_target_openacc $offload_targets_s_openacc {
set acc_mem_shared 0
}
nvidia {
+ if { ![check_effective_target_openacc_nvidia_accel_present] } {
+ # Don't bother; execution testing is going to FAIL.
+ untested "$subdir $offload_target_openacc offloading"
+ continue
+ }
+
# Copy ptx file (TEMPORARY)
remote_download host $srcdir/libgomp.oacc-c-c++-common/subr.ptx
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
index a8f62e84d67..a8aaff0e2b1 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
+++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
@@ -77,6 +77,12 @@ if { $lang_test_file_found } {
set acc_mem_shared 0
}
nvidia {
+ if { ![check_effective_target_openacc_nvidia_accel_present] } {
+ # Don't bother; execution testing is going to FAIL.
+ untested "$subdir $offload_target_openacc offloading"
+ continue
+ }
+
set acc_mem_shared 0
}
default {