From patchwork Mon Aug 23 14:58:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1519753 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gtb4V4hSkz9sXN for ; Tue, 24 Aug 2021 00:59:37 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9EC5F3853C16 for ; Mon, 23 Aug 2021 14:59:33 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id AE72E3858003 for ; Mon, 23 Aug 2021 14:59:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AE72E3858003 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: bvIbHoHOglv3KSm50Ks0EOMn9dTh/kHDyIUhfCIrXaQ035orzFswgKCIc3tcvyjt/0xe2KtGXB KWye1gfrrmwELnQsTFHVUaZvkp5M+k/KwwY0G+69SwOpgkLeYrC+nAL21SN07KdXwbfS1h4Ear 4k26/HlVEmwFSSSmp5ohi4RRIKw9F63saqKCEfrcfYyVI49SZzezgjjo2RCWW/efE361G3R+cF M7ih/2M4fAnfuZlaMAH85YS38DYtEAVbOcyhxUoqukFcANGH0T0igKyYLaQq1uPFIcx21DZzyH 88uK7cnusaN6oBRH+Id/xwRA X-IronPort-AV: E=Sophos;i="5.84,344,1620720000"; d="scan'208,223";a="67507066" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 23 Aug 2021 06:59:07 -0800 IronPort-SDR: bCrOaf2rnDwMJ0aF+CsECyVAH6K/yjyLGqF+xan783NsJL4yqoOGFUtsWneKEt+A6QRBTQ9U/M Dj05AYU5i3MsO3/56NnfqFbBDWfo3pUZzy9ISxWQtyTkt4l3uS2GHK0a2rJFqGCNRYGTI2zH6f /TtSUbYYJIbBR6JD72bZDqYNn3FmPAgTiOIJEQcUTfGxsvvRjFlO0QpAvh9uYXIJWIt63SPcBf qs1Z3REc62ZwZNa8xiBvF/O4MANvrQ42oWP8yYjK0X68vMOwzHWLoZbFa6NJ691QqKibpOX6dm W5Y= From: Thomas Schwinge To: Jakub Jelinek , Subject: Allow matching Intel MIC in OpenMP 'declare variant' User-Agent: Notmuch/0.29.1+93~g67ed7df (https://notmuchmail.org) Emacs/26.3 (x86_64-pc-linux-gnu) Date: Mon, 23 Aug 2021 16:58:43 +0200 Message-ID: <877dgcqkbg.fsf@dem-tschwing-1.ger.mentorg.com> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-07.mgc.mentorg.com (139.181.222.7) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi! See the attached "Allow matching Intel MIC in OpenMP 'declare variant'". OK to push, or how should this be done better? Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 From 33e5efd0b9c4b1a0712b3dbe103e3a295c765ab4 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Mon, 2 Aug 2021 17:38:05 +0200 Subject: [PATCH] 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 | 4 ++++ gcc/config/i386/t-omp-device | 2 +- libgomp/testsuite/lib/libgomp.exp | 17 ++++++++++++----- .../libgomp.c-c++-common/on_device_arch.h | 13 +++++++++++++ .../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 -- 2.25.1