Harden and adjust 'gcc/configure' parsing of '--enable-offload-targets' (was: [committed] Simplify omp-device-properties.h creation (PR bootstrap/92314))

Thomas Schwinge thomas@codesourcery.com
Wed Apr 29 09:07:04 GMT 2020


Hi Jakub!

On 2019-11-02T00:38:02+0100, Jakub Jelinek <jakub@redhat.com> wrote:
> Apparently my recent change broke quite a lot of setups where people were
> configuring --enable-offload-targets= without having the corresponding
> offloading compiler already installed.
> The following patch simplifies it by removing the need to have it installed
> again for compiler building (it is still needed for testing as before),
> by adding new tmake_files with the needed rules and building everything
> while building the host compiler.

ACK, thanks for that re-work.


> --- gcc/configure.ac.jj       2019-10-31 11:05:50.461137028 +0100
> +++ gcc/configure.ac  2019-11-01 21:22:58.417920544 +0100
> @@ -1026,18 +1026,22 @@ AC_SUBST(real_target_noncanonical)
>  AC_SUBST(accel_dir_suffix)
>
>  for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do
> -  tgt_dir=`echo $tgt | sed -n 's/.*=//p'`
>    tgt=`echo $tgt | sed 's/=.*//'`
>
>    if echo "$tgt" | grep "^hsa" > /dev/null ; then
>      enable_hsa=1
>    else
>      enable_offloading=1
> -    if test -n "$tgt_dir"; then
> -      omp_device_property="${tgt_dir}/lib/gcc/\$(real_target_noncanonical)/\$(version)/accel/${tgt}/omp-device-properties"
> -    else
> -      omp_device_property="\$(libsubdir)/accel/${tgt}/omp-device-properties"
> -    fi
> +    case "$tgt" in
> +      *-intelmicemul-*)
> +     omp_device_property=omp-device-properties-i386
> +     omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/i386/t-omp-device"
> +     ;;
> +      nvptx*-*)
> +     omp_device_property=omp-device-properties-nvptx
> +     omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/nvptx/t-omp-device"
> +     ;;
> +    esac
>      omp_device_properties="${omp_device_properties} ${tgt}=${omp_device_property}"
>      omp_device_property_deps="${omp_device_property_deps} ${omp_device_property}"
>    fi

Discovered/developed in context of my commit
b6a0ae1d22c9675f4374c2cb2b5c0833bb1461f1 "[gcn] Fix
'omp-device-properties-gcn' handling",
<http://mid.mail-archive.com/87ees6brhe.fsf@euler.schwinge.homeip.net>,
I've now as obvious pushed to master branch commit
d20219b5ab26cd003ae78ac9f82be337fe4df261 "Harden and adjust
'gcc/configure' parsing of '--enable-offload-targets'".

Not sure why you'd diverged here, and in particular omitted the error
case, which right away would've caught this 'amdgcn' vs. 'gcn' problem
introduced by Tobias' commit 955cd057454b323419e06affa7df7d59dc3cd1fb
(r277797) "Add gcc/config/gcn/t-omp-device for OpenMP declare variant
kind/arch/isa".


Grüße
 Thomas


-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Harden-and-adjust-gcc-configure-parsing-of-enable-of.patch
Type: text/x-diff
Size: 3805 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200429/291bc471/attachment.bin>


More information about the Gcc-patches mailing list