From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id EE18D3857C7C; Thu, 13 Jan 2022 12:18:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EE18D3857C7C 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-6549] Improve Intel MIC offloading XFAILing for 'omp_get_device_num' X-Act-Checkin: gcc X-Git-Author: Thomas Schwinge X-Git-Refname: refs/heads/master X-Git-Oldrev: 67fdcc8835665b5bc13652205e815e498d65c5a1 X-Git-Newrev: d97364aab1af361275b87713154c366ce2b9029a Message-Id: <20220113121856.EE18D3857C7C@sourceware.org> Date: Thu, 13 Jan 2022 12:18:56 +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: Thu, 13 Jan 2022 12:18:57 -0000 https://gcc.gnu.org/g:d97364aab1af361275b87713154c366ce2b9029a commit r12-6549-gd97364aab1af361275b87713154c366ce2b9029a Author: Thomas Schwinge Date: Wed Jan 5 19:52:25 2022 +0100 Improve Intel MIC offloading XFAILing for 'omp_get_device_num' After recent commit be661959a6b6d8f9c3c8608a746789e7b2ec3ca4 "libgomp/testsuite: Improve omp_get_device_num() tests", we're now iterating over all OpenMP target devices. Intel MIC (emulated) offloading still doesn't properly implement device-side 'omp_get_device_num', and we thus regress: PASS: libgomp.c/../libgomp.c-c++-common/target-45.c (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/target-45.c execution test PASS: libgomp.c++/../libgomp.c-c++-common/target-45.c (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.c++/../libgomp.c-c++-common/target-45.c execution test PASS: libgomp.fortran/target10.f90 -O0 (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.fortran/target10.f90 -O0 execution test PASS: libgomp.fortran/target10.f90 -O1 (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.fortran/target10.f90 -O1 execution test PASS: libgomp.fortran/target10.f90 -O2 (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.fortran/target10.f90 -O2 execution test PASS: libgomp.fortran/target10.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.fortran/target10.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test PASS: libgomp.fortran/target10.f90 -O3 -g (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.fortran/target10.f90 -O3 -g execution test PASS: libgomp.fortran/target10.f90 -Os (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.fortran/target10.f90 -Os execution test Improve the XFAILing added in commit bb75b22aba254e8ff144db27b1c8b4804bad73bb "Allow matching Intel MIC in OpenMP 'declare variant'" for the case that *any* Intel MIC offload device is available. libgomp/ * testsuite/libgomp.c-c++-common/on_device_arch.h (any_device_arch, any_device_arch_intel_mic): New. * testsuite/lib/libgomp.exp (check_effective_target_offload_device_any_intel_mic): New. * testsuite/libgomp.c-c++-common/target-45.c: Use it. * testsuite/libgomp.fortran/target10.f90: Likewise. Diff: --- libgomp/testsuite/lib/libgomp.exp | 12 ++++++++++- .../libgomp.c-c++-common/on_device_arch.h | 23 ++++++++++++++++++++++ libgomp/testsuite/libgomp.c-c++-common/target-45.c | 2 +- libgomp/testsuite/libgomp.fortran/target10.f90 | 2 +- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp index 57fb6b068f3..8c5ecfff0ac 100644 --- a/libgomp/testsuite/lib/libgomp.exp +++ b/libgomp/testsuite/lib/libgomp.exp @@ -451,7 +451,6 @@ proc check_effective_target_openacc_nvidia_accel_selected { } { # 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 () { @@ -460,6 +459,17 @@ proc check_effective_target_offload_device_intel_mic { } { } ] } +# Return 1 if any Intel MIC offload device is available. +proc check_effective_target_offload_device_any_intel_mic { } { + return [check_runtime_nocache offload_device_any_intel_mic { + #include "testsuite/libgomp.c-c++-common/on_device_arch.h" + int main () + { + return !any_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 ee541dd2260..f92743b04d7 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/on_device_arch.h +++ b/libgomp/testsuite/libgomp.c-c++-common/on_device_arch.h @@ -1,3 +1,4 @@ +#include #include /* static */ int @@ -41,3 +42,25 @@ on_device_arch_intel_mic () { return on_device_arch (GOMP_DEVICE_INTEL_MIC); } + +static int +any_device_arch (int d) +{ + int nd = omp_get_num_devices (); + for (int i = 0; i < nd; ++i) + { + int d_cur; + #pragma omp target device(i) map(from:d_cur) + d_cur = device_arch (); + if (d_cur == d) + return 1; + } + + return 0; +} + +int +any_device_arch_intel_mic () +{ + return any_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 837503996d7..27bbeddf7fd 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-xfail-run-if TODO { offload_device_intel_mic } } */ +/* { dg-xfail-run-if TODO { offload_device_any_intel_mic } } */ #include #include diff --git a/libgomp/testsuite/libgomp.fortran/target10.f90 b/libgomp/testsuite/libgomp.fortran/target10.f90 index f6951fc9057..31452554d67 100644 --- a/libgomp/testsuite/libgomp.fortran/target10.f90 +++ b/libgomp/testsuite/libgomp.fortran/target10.f90 @@ -1,5 +1,5 @@ ! { dg-do run } -! { dg-xfail-run-if TODO { offload_device_intel_mic } } +! { dg-xfail-run-if TODO { offload_device_any_intel_mic } } program main use omp_lib