[gcn] Fix 'omp-device-properties-gcn' handling
authorThomas Schwinge <thomas@codesourcery.com>
Thu, 23 Apr 2020 19:45:34 +0000 (21:45 +0200)
committerThomas Schwinge <thomas@codesourcery.com>
Wed, 29 Apr 2020 07:46:07 +0000 (09:46 +0200)
Fix-up for commit 955cd057454b323419e06affa7df7d59dc3cd1fb "Add
gcc/config/gcn/t-omp-device for OpenMP declare variant kind/arch/isa".

With AMD GCN offloading configured, I'm seeing occasional GCC build hangs.
I've now captured and analyzed one of them:

    $ ps -f
    UID        PID  PPID  C STIME TTY          TIME CMD
    [...]
    tschwing  5113  4508  0 20:24 pts/5    00:00:00 /bin/sh -c rm -f tmp-omp-device-properties.h; \ for kind in kind arch isa; do \   echo 'const char omp_offload_device_'${kind}'[] = ' \     >> tmp-omp-device-properties.h; \   for prop in no
    tschwing  5126  5113  0 20:24 pts/5    00:00:00 sed -n s/^kind: //p
    tschwing  5127  5113  0 20:24 pts/5    00:00:00 sed s/[[:blank:]]/ /g;s/  */ /g;s/^ //;s/ $//;s/ /\\0/g;s/^/"/;s/$/\\0\\0"/
    [...]
    $ pstree -p $$
    [...]---sh(5113)-+-sed(5126)
                     `-sed(5127)
    $ ls -lrt build-gcc/gcc/*omp-device*
    -rw-r--r-- 1 tschwing eeg  39 Apr 23 20:24 build-gcc/gcc/omp-device-properties-nvptx
    -rw-r--r-- 1 tschwing eeg 634 Apr 23 20:24 build-gcc/gcc/omp-device-properties-i386
    -rw-r--r-- 1 tschwing eeg  58 Apr 23 20:24 build-gcc/gcc/tmp-omp-device-properties.h

Notably missing is the 'omp-device-properties-gcn' file...

    $ grep ^ build-gcc/gcc/*omp-device*
    build-gcc/gcc/omp-device-properties-i386:kind: cpu
    build-gcc/gcc/omp-device-properties-i386:arch: x86 x86_64 i386 i486 i586 i686 ia32
    build-gcc/gcc/omp-device-properties-i386:isa: sse4 cx16 [...]
    build-gcc/gcc/omp-device-properties-nvptx:kind: gpu
    build-gcc/gcc/omp-device-properties-nvptx:arch: nvptx
    build-gcc/gcc/omp-device-properties-nvptx:isa: sm_30 sm_35
    build-gcc/gcc/tmp-omp-device-properties.h:const char omp_offload_device_kind[] =
    build-gcc/gcc/tmp-omp-device-properties.h:"amdgcn-amdhsa\0"

..., which we here seem to be intending to fill into
'tmp-omp-device-properties.h'.

    $ grep ^omp_device_properties\ = build-gcc/gcc/Makefile
    omp_device_properties =  amdgcn-amdhsa= nvptx-none=omp-device-properties-nvptx x86_64-intelmicemul-linux-gnu=omp-device-properties-i386

Given the 's-omp-device-properties-h' Makefile rule, indeed there is an
unescaped '$${props}', which is meant to be the filename following the equals
sign -- but there is none for 'amdgcn-amdhsa=', so this tries to read from
'stdin'!

The real problem of course is elsewhere.

gcc/
* configure.ac <$enable_offload_targets>: 'amdgcn' is 'gcn'.
* configure: Regenerate.

gcc/ChangeLog
gcc/configure
gcc/configure.ac

index ef851ef84626c45d5ce60e46a1a5a3d527489f50..85d1c2b6f758868735b8b777fb79519cd124bb77 100644 (file)
@@ -1,5 +1,8 @@
 2020-04-29  Thomas Schwinge  <thomas@codesourcery.com>
 
+       * configure.ac <$enable_offload_targets>: 'amdgcn' is 'gcn'.
+       * configure: Regenerate.
+
        PR target/94279
        * rtlanal.c (set_noop_p): Handle non-constant selectors.
 
index 9e22c5a286f6183f8c5d245ef10028aa7376b602..83101072aea0b940b7d316217ba4248f5c248057 100755 (executable)
@@ -7924,7 +7924,7 @@ for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do
        omp_device_property=omp-device-properties-i386
        omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/i386/t-omp-device"
        ;;
-      gcn*-*)
+      amdgcn*-*)
        omp_device_property=omp-device-properties-gcn
        omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/gcn/t-omp-device"
        ;;
index cd62312b813c4c7b84fe01849ec10c4c550e665e..b604047ae456a928218fc19c00279af12553b2ab 100644 (file)
@@ -1049,7 +1049,7 @@ for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do
        omp_device_property=omp-device-properties-i386
        omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/i386/t-omp-device"
        ;;
-      gcn*-*)
+      amdgcn*-*)
        omp_device_property=omp-device-properties-gcn
        omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/gcn/t-omp-device"
        ;;