Hi!

On Wed, 28 Jan 2015 20:59:45 +0300, Ilya Verbin <iver...@gmail.com> wrote:
> On 28 Jan 18:05, Thomas Schwinge wrote:
> > +  fprintf (out, "#define PTX_ID 1\n");
> > +  fprintf (out, "static __attribute__((constructor)) void init 
> > (void)\n{\n");
> > +  fprintf (out, "  GOMP_offload_register (__OPENMP_TARGET__, PTX_ID,\n");
> 
> The file include/gomp-constants.h already contains:
> #define GOMP_DEVICE_NVIDIA_PTX          5
> 
> I guess it would be better to include gomp-constants.h into mkoffload and to 
> use
> this define.

Thanks!  You're right indeed -- I mistakenly committed an older version
of this file.  Committed to trunk in r220619:

commit ab0e6fbc36cacaa619dfacec41e17a681a28562a
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Feb 11 14:15:28 2015 +0000

    nvptx mkoffload: Don't hard-code GOMP_DEVICE_NVIDIA_PTX.
    
        gcc/
        * config/nvptx/mkoffload.c: Include "gomp-constants.h".
        (process): Use its GOMP_DEVICE_NVIDIA_PTX instead of (wrongly)
        hard-coding PTX_ID.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220619 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog                | 6 ++++++
 gcc/config/nvptx/mkoffload.c | 5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git gcc/ChangeLog gcc/ChangeLog
index 2fa7ff2..1479dcb 100644
--- gcc/ChangeLog
+++ gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-02-11  Thomas Schwinge  <tho...@codesourcery.com>
+
+       * config/nvptx/mkoffload.c: Include "gomp-constants.h".
+       (process): Use its GOMP_DEVICE_NVIDIA_PTX instead of (wrongly)
+       hard-coding PTX_ID.
+
 2015-02-11  H.J. Lu  <hongjiu...@intel.com>
 
        * doc/sourcebuild.texi (pie_enabled): Document.
diff --git gcc/config/nvptx/mkoffload.c gcc/config/nvptx/mkoffload.c
index 38ccdba..8f359cf 100644
--- gcc/config/nvptx/mkoffload.c
+++ gcc/config/nvptx/mkoffload.c
@@ -35,6 +35,7 @@
 #include "obstack.h"
 #include "diagnostic-core.h"
 #include "collect-utils.h"
+#include "gomp-constants.h"
 
 const char tool_name[] = "nvptx mkoffload";
 
@@ -791,9 +792,9 @@ process (FILE *in, FILE *out)
   fprintf (out, "extern void GOMP_offload_register (const void *, int, void 
*);\n");
 
   fprintf (out, "extern void *__OPENMP_TARGET__[];\n\n");
-  fprintf (out, "#define PTX_ID 1\n");
   fprintf (out, "static __attribute__((constructor)) void init (void)\n{\n");
-  fprintf (out, "  GOMP_offload_register (__OPENMP_TARGET__, PTX_ID,\n");
+  fprintf (out, "  GOMP_offload_register (__OPENMP_TARGET__, %d,\n",
+          GOMP_DEVICE_NVIDIA_PTX);
   fprintf (out, "                         &target_data);\n");
   fprintf (out, "};\n");
 }


Grüße,
 Thomas

Attachment: pgpaqE_j2EL5W.pgp
Description: PGP signature

Reply via email to