diff mbox

[nvptx,offloading] Only 64-bit configurations are currently supported (was: nvptx-tools and nvptx-newlib)

Message ID 87zj364rq1.fsf@kepler.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge July 8, 2015, 3:03 p.m. UTC
Hi!

On Wed, 18 Feb 2015 09:50:15 +0100, I wrote:
> So far, we have concentrated only on the 64-bit x86_64 configuration;
> 32-bit has several known issues to be resolved.
> <https://gcc.gnu.org/PR65099> filed.

I have committed the following patch in r225560.  This gets us rid of the
lots of "expected FAILs" in the 32-bit part of
RUNTESTFLAGS='--target_board=unix\{-m64,-m32\}' testing, for example.

commit fe265ad3c9624da88f43be349137696449148f4f
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Jul 8 14:59:59 2015 +0000

    [nvptx offloading] Only 64-bit configurations are currently supported
    
    	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/trunk@225560 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog                                      |    6 +++
 gcc/config/nvptx/mkoffload.c                       |   56 +++++++++++---------
 libgomp/ChangeLog                                  |   10 ++++
 libgomp/plugin/plugin-nvptx.c                      |    5 ++
 libgomp/testsuite/libgomp.oacc-c++/c++.exp         |    6 +++
 libgomp/testsuite/libgomp.oacc-c/c.exp             |    6 +++
 libgomp/testsuite/libgomp.oacc-fortran/fortran.exp |    6 +++
 7 files changed, 70 insertions(+), 25 deletions(-)



Grüße,
 Thomas

Comments

Thomas Schwinge July 14, 2015, 8:05 p.m. UTC | #1
Hi!

OK for gcc-5-branch?

On Wed, 8 Jul 2015 17:03:02 +0200, I wrote:
> On Wed, 18 Feb 2015 09:50:15 +0100, I wrote:
> > So far, we have concentrated only on the 64-bit x86_64 configuration;
> > 32-bit has several known issues to be resolved.
> > <https://gcc.gnu.org/PR65099> filed.
> 
> I have committed the following patch in r225560.  This gets us rid of the
> lots of "expected FAILs" in the 32-bit part of
> RUNTESTFLAGS='--target_board=unix\{-m64,-m32\}' testing, for example.
> 
> commit fe265ad3c9624da88f43be349137696449148f4f
> Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
> Date:   Wed Jul 8 14:59:59 2015 +0000
> 
>     [nvptx offloading] Only 64-bit configurations are currently supported
>     
>     	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/trunk@225560 138bc75d-0d04-0410-961f-82ee72b054a4
> ---
>  gcc/ChangeLog                                      |    6 +++
>  gcc/config/nvptx/mkoffload.c                       |   56 +++++++++++---------
>  libgomp/ChangeLog                                  |   10 ++++
>  libgomp/plugin/plugin-nvptx.c                      |    5 ++
>  libgomp/testsuite/libgomp.oacc-c++/c++.exp         |    6 +++
>  libgomp/testsuite/libgomp.oacc-c/c.exp             |    6 +++
>  libgomp/testsuite/libgomp.oacc-fortran/fortran.exp |    6 +++
>  7 files changed, 70 insertions(+), 25 deletions(-)
> 
> diff --git gcc/ChangeLog gcc/ChangeLog
> index 33a2fa0..4c83723 100644
> --- gcc/ChangeLog
> +++ gcc/ChangeLog
> @@ -1,3 +1,9 @@
> +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.
> +
>  2015-07-08  Martin Liska  <mliska@suse.cz>
>  
>  	PR bootstrap/66744
> diff --git gcc/config/nvptx/mkoffload.c gcc/config/nvptx/mkoffload.c
> index 8687154..8bc08bf 100644
> --- gcc/config/nvptx/mkoffload.c
> +++ 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 libgomp/ChangeLog libgomp/ChangeLog
> index 8839397..34f3a1c 100644
> --- libgomp/ChangeLog
> +++ libgomp/ChangeLog
> @@ -1,3 +1,13 @@
> +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.
> +
>  2015-07-08  Tom de Vries  <tom@codesourcery.com>
>  
>  	* testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c (main): Fix
> diff --git libgomp/plugin/plugin-nvptx.c libgomp/plugin/plugin-nvptx.c
> index ee3a0ae..b67d301 100644
> --- libgomp/plugin/plugin-nvptx.c
> +++ 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 libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
> index 80d1359..3b97024 100644
> --- libgomp/testsuite/libgomp.oacc-c++/c++.exp
> +++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
> @@ -85,6 +85,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 libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
> index c0c70bb..326b988 100644
> --- libgomp/testsuite/libgomp.oacc-c/c.exp
> +++ 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 libgomp/testsuite/libgomp.oacc-fortran/fortran.exp libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
> index a8f62e8..a8aaff0 100644
> --- libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
> +++ 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 {


Grüße,
 Thomas
Richard Biener July 14, 2015, 8:10 p.m. UTC | #2
On July 14, 2015 10:05:52 PM GMT+02:00, Thomas Schwinge <thomas@codesourcery.com> wrote:
>Hi!
>
>OK for gcc-5-branch?

OK

Richard

>On Wed, 8 Jul 2015 17:03:02 +0200, I wrote:
>> On Wed, 18 Feb 2015 09:50:15 +0100, I wrote:
>> > So far, we have concentrated only on the 64-bit x86_64
>configuration;
>> > 32-bit has several known issues to be resolved.
>> > <https://gcc.gnu.org/PR65099> filed.
>> 
>> I have committed the following patch in r225560.  This gets us rid of
>the
>> lots of "expected FAILs" in the 32-bit part of
>> RUNTESTFLAGS='--target_board=unix\{-m64,-m32\}' testing, for example.
>> 
>> commit fe265ad3c9624da88f43be349137696449148f4f
>> Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
>> Date:   Wed Jul 8 14:59:59 2015 +0000
>> 
>>     [nvptx offloading] Only 64-bit configurations are currently
>supported
>>     
>>     	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/trunk@225560
>138bc75d-0d04-0410-961f-82ee72b054a4
>> ---
>>  gcc/ChangeLog                                      |    6 +++
>>  gcc/config/nvptx/mkoffload.c                       |   56
>+++++++++++---------
>>  libgomp/ChangeLog                                  |   10 ++++
>>  libgomp/plugin/plugin-nvptx.c                      |    5 ++
>>  libgomp/testsuite/libgomp.oacc-c++/c++.exp         |    6 +++
>>  libgomp/testsuite/libgomp.oacc-c/c.exp             |    6 +++
>>  libgomp/testsuite/libgomp.oacc-fortran/fortran.exp |    6 +++
>>  7 files changed, 70 insertions(+), 25 deletions(-)
>> 
>> diff --git gcc/ChangeLog gcc/ChangeLog
>> index 33a2fa0..4c83723 100644
>> --- gcc/ChangeLog
>> +++ gcc/ChangeLog
>> @@ -1,3 +1,9 @@
>> +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.
>> +
>>  2015-07-08  Martin Liska  <mliska@suse.cz>
>>  
>>  	PR bootstrap/66744
>> diff --git gcc/config/nvptx/mkoffload.c gcc/config/nvptx/mkoffload.c
>> index 8687154..8bc08bf 100644
>> --- gcc/config/nvptx/mkoffload.c
>> +++ 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 libgomp/ChangeLog libgomp/ChangeLog
>> index 8839397..34f3a1c 100644
>> --- libgomp/ChangeLog
>> +++ libgomp/ChangeLog
>> @@ -1,3 +1,13 @@
>> +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.
>> +
>>  2015-07-08  Tom de Vries  <tom@codesourcery.com>
>>  
>>  	* testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c (main): Fix
>> diff --git libgomp/plugin/plugin-nvptx.c
>libgomp/plugin/plugin-nvptx.c
>> index ee3a0ae..b67d301 100644
>> --- libgomp/plugin/plugin-nvptx.c
>> +++ 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 libgomp/testsuite/libgomp.oacc-c++/c++.exp
>libgomp/testsuite/libgomp.oacc-c++/c++.exp
>> index 80d1359..3b97024 100644
>> --- libgomp/testsuite/libgomp.oacc-c++/c++.exp
>> +++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
>> @@ -85,6 +85,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 libgomp/testsuite/libgomp.oacc-c/c.exp
>libgomp/testsuite/libgomp.oacc-c/c.exp
>> index c0c70bb..326b988 100644
>> --- libgomp/testsuite/libgomp.oacc-c/c.exp
>> +++ 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 libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
>libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
>> index a8f62e8..a8aaff0 100644
>> --- libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
>> +++ 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 {
>
>
>Grüße,
> Thomas
diff mbox

Patch

diff --git gcc/ChangeLog gcc/ChangeLog
index 33a2fa0..4c83723 100644
--- gcc/ChangeLog
+++ gcc/ChangeLog
@@ -1,3 +1,9 @@ 
+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.
+
 2015-07-08  Martin Liska  <mliska@suse.cz>
 
 	PR bootstrap/66744
diff --git gcc/config/nvptx/mkoffload.c gcc/config/nvptx/mkoffload.c
index 8687154..8bc08bf 100644
--- gcc/config/nvptx/mkoffload.c
+++ 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 libgomp/ChangeLog libgomp/ChangeLog
index 8839397..34f3a1c 100644
--- libgomp/ChangeLog
+++ libgomp/ChangeLog
@@ -1,3 +1,13 @@ 
+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.
+
 2015-07-08  Tom de Vries  <tom@codesourcery.com>
 
 	* testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c (main): Fix
diff --git libgomp/plugin/plugin-nvptx.c libgomp/plugin/plugin-nvptx.c
index ee3a0ae..b67d301 100644
--- libgomp/plugin/plugin-nvptx.c
+++ 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 libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
index 80d1359..3b97024 100644
--- libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -85,6 +85,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 libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
index c0c70bb..326b988 100644
--- libgomp/testsuite/libgomp.oacc-c/c.exp
+++ 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 libgomp/testsuite/libgomp.oacc-fortran/fortran.exp libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
index a8f62e8..a8aaff0 100644
--- libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
+++ 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 {