Hi!

On Thu, 24 Sep 2015 09:25:54 +0200, Jakub Jelinek <ja...@redhat.com> wrote:
> On Wed, Sep 23, 2015 at 08:22:16PM +0300, Alexander Monakov wrote:
> > This patch allows to meaningfully invoke mkoffload with -fopenmp.  The check
> > for -fopenacc flag is specific to gomp4 branch: trunk does not have it.
> > 
> >     * config/nvptx/mkoffload.c (main): Do not check for -fopenacc.
> 
> LGTM.

No; see <https://gcc.gnu.org/PR67822>.  I installed the following on
trunk in r228414 (as obvious), "inverting" the -fopenacc check that we
currently have on gomp-4_0-branch to instead skip generating an
offloading image if -fopenmp is specified.  You're welcome to work on the
PR, of course.

commit cba229716b3a369e96c71189d98a46ca3ada2717
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Oct 2 19:27:30 2015 +0000

    [PR target/67822] OpenMP offloading to nvptx fails
    
        gcc/
        PR target/67822
        * config/nvptx/mkoffload.c (main): Scan the argument vector for
        -fopenmp, and skip generating an offloading image if specified.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228414 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog                | 6 ++++++
 gcc/config/nvptx/mkoffload.c | 7 +++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git gcc/ChangeLog gcc/ChangeLog
index 3f7561a..1317a2d 100644
--- gcc/ChangeLog
+++ gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-10-02  Thomas Schwinge  <tho...@codesourcery.com>
+
+       PR target/67822
+       * config/nvptx/mkoffload.c (main): Scan the argument vector for
+       -fopenmp, and skip generating an offloading image if specified.
+
 2015-10-02  Uros Bizjak  <ubiz...@gmail.com>
 
        * system.h (ROUND_UP): New macro definition.
diff --git gcc/config/nvptx/mkoffload.c gcc/config/nvptx/mkoffload.c
index 926c82b..69eb4ea 100644
--- gcc/config/nvptx/mkoffload.c
+++ gcc/config/nvptx/mkoffload.c
@@ -1030,6 +1030,7 @@ main (int argc, char **argv)
   expandargv (&argc, &argv);
 
   /* Scan the argument vector.  */
+  bool fopenmp = false;
   for (int i = 1; i < argc; i++)
     {
 #define STR "-foffload-abi="
@@ -1044,6 +1045,8 @@ main (int argc, char **argv)
                         "unrecognizable argument of option " STR);
        }
 #undef STR
+      else if (strcmp (argv[i], "-fopenmp") == 0)
+       fopenmp = true;
       else if (strcmp (argv[i], "-v") == 0)
        verbose = true;
     }
@@ -1082,8 +1085,8 @@ main (int argc, char **argv)
     fatal_error (input_location, "cannot open '%s'", ptx_cfile_name);
 
   /* PR libgomp/65099: Currently, we only support offloading in 64-bit
-     configurations.  */
-  if (offload_abi == OFFLOAD_ABI_LP64)
+     configurations.  PR target/67822: OpenMP offloading to nvptx fails.  */
+  if (offload_abi == OFFLOAD_ABI_LP64 && !fopenmp)
     {
       ptx_name = make_temp_file (".mkoffload");
       obstack_ptr_grow (&argv_obstack, "-o");


Grüße,
 Thomas

Attachment: signature.asc
Description: PGP signature

Reply via email to