From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 0AD7C385842C; Mon, 23 Aug 2021 15:46:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0AD7C385842C MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-3089] Allow matching Intel MIC in OpenMP 'declare variant' X-Act-Checkin: gcc X-Git-Author: Thomas Schwinge X-Git-Refname: refs/heads/master X-Git-Oldrev: 1a129376bbc26d3c30af3c1ae6036e2e1446db40 X-Git-Newrev: bb75b22aba254e8ff144db27b1c8b4804bad73bb Message-Id: <20210823154651.0AD7C385842C@sourceware.org> Date: Mon, 23 Aug 2021 15:46:51 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Aug 2021 15:46:51 -0000 https://gcc.gnu.org/g:bb75b22aba254e8ff144db27b1c8b4804bad73bb commit r12-3089-gbb75b22aba254e8ff144db27b1c8b4804bad73bb Author: Thomas Schwinge Date: Mon Aug 2 17:38:05 2021 +0200 Allow matching Intel MIC in OpenMP 'declare variant' ..., and use that to improve XFAILing for Intel MIC offloading execution instead of compilation in 'libgomp.c-c++-common/target-45.c', 'libgomp.fortran/target10.f90'. gcc/ * config/i386/i386-options.c (ix86_omp_device_kind_arch_isa) [ACCEL_COMPILER]: Match "intel_mic". * config/i386/t-omp-device (omp-device-properties-i386) : Add "intel_mic". libgomp/ * testsuite/lib/libgomp.exp (check_effective_target_offload_target_intelmic): Remove 'proc'. (check_effective_target_offload_device_intel_mic): New 'proc'. * testsuite/libgomp.c-c++-common/on_device_arch.h (device_arch_intel_mic, on_device_arch_intel_mic): New. * testsuite/libgomp.c-c++-common/target-45.c: Use that for 'dg-xfail-run-if'. * testsuite/libgomp.fortran/target10.f90: Likewise. Diff: --- gcc/config/i386/i386-options.c | 4 ++++ gcc/config/i386/t-omp-device | 2 +- libgomp/testsuite/lib/libgomp.exp | 17 ++++++++++++----- libgomp/testsuite/libgomp.c-c++-common/on_device_arch.h | 13 +++++++++++++ libgomp/testsuite/libgomp.c-c++-common/target-45.c | 2 +- libgomp/testsuite/libgomp.fortran/target10.f90 | 3 ++- 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c index 6b789988baa..fee5a48c9a5 100644 --- a/gcc/config/i386/i386-options.c +++ b/gcc/config/i386/i386-options.c @@ -304,6 +304,10 @@ ix86_omp_device_kind_arch_isa (enum omp_device_kind_arch_isa trait, case omp_device_kind: return strcmp (name, "cpu") == 0; case omp_device_arch: +#ifdef ACCEL_COMPILER + if (strcmp (name, "intel_mic") == 0) + return 1; +#endif if (strcmp (name, "x86") == 0) return 1; if (TARGET_64BIT) diff --git a/gcc/config/i386/t-omp-device b/gcc/config/i386/t-omp-device index 037ae5e112d..29350a1d80b 100644 --- a/gcc/config/i386/t-omp-device +++ b/gcc/config/i386/t-omp-device @@ -1,6 +1,6 @@ omp-device-properties-i386: $(srcdir)/config/i386/i386-options.c echo kind: cpu > $@ - echo arch: x86 x86_64 i386 i486 i586 i686 ia32 >> $@ + echo arch: intel_mic x86 x86_64 i386 i486 i586 i686 ia32 >> $@ echo isa: sse4 `sed -n '/^static struct ix86_target_opts isa2\?_opts\[\] =/,/^};/p' \ $(srcdir)/config/i386/i386-options.c | \ sed -n 's/",.*$$//;s/^ { "-m//p'` >> $@ diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp index ba8a73275c5..57fb6b068f3 100644 --- a/libgomp/testsuite/lib/libgomp.exp +++ b/libgomp/testsuite/lib/libgomp.exp @@ -374,11 +374,6 @@ proc check_effective_target_offload_target_amdgcn { } { return [libgomp_check_effective_target_offload_target "amdgcn"] } -# Return 1 if compiling for offload target intelmic -proc check_effective_target_offload_target_intelmic { } { - return [libgomp_check_effective_target_offload_target "*-intelmic"] -} - # Return 1 if offload device is available. proc check_effective_target_offload_device { } { return [check_runtime_nocache offload_device_available_ { @@ -453,6 +448,18 @@ proc check_effective_target_openacc_nvidia_accel_selected { } { return [string match "nvidia" $openacc_device_type] } +# Return 1 if using Intel MIC offload device. +proc check_effective_target_offload_device_intel_mic { } { + return [check_runtime_nocache offload_device_intel_mic { + #include + #include "testsuite/libgomp.c-c++-common/on_device_arch.h" + int main () + { + return !on_device_arch_intel_mic (); + } + } ] +} + # Return 1 if the OpenACC 'host' device type is selected. proc check_effective_target_openacc_host_selected { } { diff --git a/libgomp/testsuite/libgomp.c-c++-common/on_device_arch.h b/libgomp/testsuite/libgomp.c-c++-common/on_device_arch.h index 1c0753c3181..ee541dd2260 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/on_device_arch.h +++ b/libgomp/testsuite/libgomp.c-c++-common/on_device_arch.h @@ -6,7 +6,14 @@ device_arch_nvptx (void) return GOMP_DEVICE_NVIDIA_PTX; } +/* static */ int +device_arch_intel_mic (void) +{ + return GOMP_DEVICE_INTEL_MIC; +} + #pragma omp declare variant (device_arch_nvptx) match(construct={target},device={arch(nvptx)}) +#pragma omp declare variant (device_arch_intel_mic) match(construct={target},device={arch(intel_mic)}) /* static */ int device_arch (void) { @@ -28,3 +35,9 @@ on_device_arch_nvptx () { return on_device_arch (GOMP_DEVICE_NVIDIA_PTX); } + +int +on_device_arch_intel_mic () +{ + return on_device_arch (GOMP_DEVICE_INTEL_MIC); +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-45.c b/libgomp/testsuite/libgomp.c-c++-common/target-45.c index ec0d202e51c..81acee81064 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/target-45.c +++ b/libgomp/testsuite/libgomp.c-c++-common/target-45.c @@ -1,4 +1,4 @@ -/* { dg-do run { target { ! offload_target_intelmic } } } */ +/* { dg-xfail-run-if TODO { offload_device_intel_mic } } */ #include #include diff --git a/libgomp/testsuite/libgomp.fortran/target10.f90 b/libgomp/testsuite/libgomp.fortran/target10.f90 index 0b939ad7a0d..f41a726de75 100644 --- a/libgomp/testsuite/libgomp.fortran/target10.f90 +++ b/libgomp/testsuite/libgomp.fortran/target10.f90 @@ -1,4 +1,5 @@ -! { dg-do run { target { ! offload_target_intelmic } } } +! { dg-do run } +! { dg-xfail-run-if TODO { offload_device_intel_mic } } program main use omp_lib