From patchwork Thu May 4 07:54:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 89951 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp128630vqo; Thu, 4 May 2023 00:54:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5cg0NDzmh5peTU8QPAjMCyihLtkkKuU2z6HAxV++dDCa9RKKSeLZj/DpV0LKVzf0sbYhYh X-Received: by 2002:a17:907:3e22:b0:94e:c40a:cca9 with SMTP id hp34-20020a1709073e2200b0094ec40acca9mr6336573ejc.35.1683186881686; Thu, 04 May 2023 00:54:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683186881; cv=none; d=google.com; s=arc-20160816; b=v4Hh8V2DoJO2TuSEy59nt4V1NYeIGOkgqOhdHuQECqZ+ulhqCGrfo6RJTCa7Jmnw0o 8CcOtD30dSAWPkPGDf0HCNXG02LuGQV2xr+LzG6GEbdr7tEaR5tWZ68hRVQnM33ba1Gk JkYYbfoLCn4P75Q+BtRlZpu2+uOSpzaWlJxAM8sk09udx8o/K4Fx1Vb27AUU7lSDKXYP 3d1FxTTblBRzlOQHsaTm1KNPFle78iRtP3/IreVgjdDcWrhZyzGAIQnzrUQ+9+dx5IK5 85Ata1ELhuMQplHRUA96/NAOOm+Kd9Uv9eoozav1YyDAw95dJ5ffi92qFY1KIV867Nn6 2trw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:message-id:date :user-agent:references:in-reply-to:subject:cc:to:from:ironport-sdr :dmarc-filter:delivered-to; bh=8UtP2QjqRsJT9E2+Q44IHDPbbm1Y0HODCoBSw9ZAO/E=; b=VMoNgh2+lRJg8jhLbOkkhuVKbbmp2nWyJxmirDAvWE+RtoPdMQ5oxDGJTaqdLmWIVj j9KGUadDEQpt/t1Lqz/w3NtILeN57yn7d7GugMTkC3cvgneUGBlbB4ZT0nIYwm7BCWWn QzT5LcdcSqsXi4OzbPR1/mmV/8Et6wW+sWt+lIHGX0FxaFYs6fUJTcCqF70fEx4qo01d seA3gLfdz8PrXKCq0BgpXGBvC4vaj5eJoEsKHZdQQFrt/TMKu7EM59hktyT1D1XzutMh NkeDW3CCSxGnEYaTdrvNFFMwvFDM+ALl1nxjLkJpY+dpNwGH7hIh+mhWWy3PYh73R7rA YRkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id pv3-20020a170907208300b0096598b786c0si1448862ejb.470.2023.05.04.00.54.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 May 2023 00:54:41 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 67EE13856DF2 for ; Thu, 4 May 2023 07:54:35 +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 A30433858D28 for ; Thu, 4 May 2023 07:54:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A30433858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.99,249,1677571200"; d="scan'208,223";a="4833382" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 03 May 2023 23:54:10 -0800 IronPort-SDR: EmXVBxgbMPcUx6Oj6kRpChkKePMZdnKc2xxxtI1y7gOrFKZ57spFyI0muSSM/CpusYTg8qSo3M X+cNS1n21dUKdIJeCdiUdOvFudWzN+e3/wpGl9IRdg3uFtEDtAX9o3BzDuQr0b+oxwuL/JHjdn UzGPs2YBXVb/zYpGAIIGe/m09IaYKHueJxW1Ioefy0qBenVEtEt/NrsWZ6Z34TpHtLnJ7M51kG 7U/S0MafPihaulkzOn1P7QgdmXikeoXRk0EQFSJWSHP7i1QHXfd2mlL7qxeX6BhrxvO0k8DrMF 9qs= From: Thomas Schwinge To: Jakub Jelinek , CC: Tobias Burnus Subject: libgomp C++ testsuite: Use 'lang_include_flags' instead of 'libstdcxx_includes' (was: [PATCH] libgomp: Add openacc_{cuda,cublas,cudart} effective targets and use them in openacc testsuite) In-Reply-To: <20210526120653.GA113911@tucnak> References: <20210526120653.GA113911@tucnak> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Thu, 4 May 2023 09:54:03 +0200 Message-ID: <87r0rwbkh0.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-13.mgc.mentorg.com (139.181.222.13) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764949367651086002?= X-GMAIL-MSGID: =?utf-8?q?1764949367651086002?= Hi! On 2021-05-26T14:06:53+0200, Jakub Jelinek via Gcc-patches wrote: > When gcc is configured for nvptx offloading [...] > and full CUDA isn't installed, many libgomp.oacc-*/* tests fail, > some of them because cuda.h header can't be found, others because > the tests can't be linked against -lcuda, -lcudart or -lcublas. > I usually only have akmod-nvidia and xorg-x11-drv-nvidia-cuda rpms > installed, so libcuda.so.1 can be dlopened and the offloading works, > but linking against those libraries isn't possible nor are the > headers around [...] > The following patch adds 3 new effective targets and uses them in tests that > needs those. > --- libgomp/testsuite/lib/libgomp.exp.jj 2021-05-25 13:43:02.800121273 +0200 > +++ libgomp/testsuite/lib/libgomp.exp 2021-05-26 12:18:56.562556244 +0200 > +# Return 1 if cuda.h and -lcuda are available. > + > +proc check_effective_target_openacc_cuda { } { > + return [check_no_compiler_messages openacc_cuda executable { > +#include > +[...] > +} } "-lcuda" ] > +} > + > +# Return 1 if cublas_v2.h and -lcublas are available. > + > +proc check_effective_target_openacc_cublas { } { > + return [check_no_compiler_messages openacc_cublas executable { > +#include > +#include > +[...] > +} } "-lcuda -lcublas" ] > +} > + > +# Return 1 if cuda_runtime_api.h and -lcudart are available. > + > +proc check_effective_target_openacc_cudart { } { > + return [check_no_compiler_messages openacc_cudart executable { > +#include > +#include > +[...] > +} } "-lcuda -lcudart" ] > +} OK to push the attached "libgomp C++ testsuite: Use 'lang_include_flags' instead of 'libstdcxx_includes'"? This does not adjust the 'libstdcxx_includes' usage in libitm and libvtv testsuites -- maybe those should also get 'lang_include_flags' ported (separately)? 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 9bb4ffee6932ee5f917344535026f75c3eadc093 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 4 May 2023 09:07:35 +0200 Subject: [PATCH] libgomp C++ testsuite: Use 'lang_include_flags' instead of 'libstdcxx_includes' With nvptx offloading configured, and supported, and CUDA available: $ make check-target-libgomp RUNTESTFLAGS="--all c.exp=context-1.c c++.exp=context-1.c" [...] Running [...]/libgomp.oacc-c/c.exp ... PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/context-1.c -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O0 (test for excess errors) PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/context-1.c -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O0 execution test PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/context-1.c -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O2 (test for excess errors) PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/context-1.c -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O2 execution test UNSUPPORTED: libgomp.oacc-c/../libgomp.oacc-c-c++-common/context-1.c -DACC_DEVICE_TYPE_host=1 -DACC_MEM_SHARED=1 -foffload=disable -O2 Running [...]/libgomp.oacc-c++/c++.exp ... PASS: libgomp.oacc-c++/../libgomp.oacc-c-c++-common/context-1.c -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O0 (test for excess errors) PASS: libgomp.oacc-c++/../libgomp.oacc-c-c++-common/context-1.c -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O0 execution test PASS: libgomp.oacc-c++/../libgomp.oacc-c-c++-common/context-1.c -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O2 (test for excess errors) PASS: libgomp.oacc-c++/../libgomp.oacc-c-c++-common/context-1.c -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O2 execution test UNSUPPORTED: libgomp.oacc-c++/../libgomp.oacc-c-c++-common/context-1.c -DACC_DEVICE_TYPE_host=1 -DACC_MEM_SHARED=1 -foffload=disable -O2 [...] ..., but for 'c++.exp=context-1.c' alone, we currently get all-UNSUPPORTED: $ make check-target-libgomp RUNTESTFLAGS_="--all c++.exp=context-1.c" [...] Running [...]/libgomp.oacc-c++/c++.exp ... UNSUPPORTED: libgomp.oacc-c++/../libgomp.oacc-c-c++-common/context-1.c -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O0 UNSUPPORTED: libgomp.oacc-c++/../libgomp.oacc-c-c++-common/context-1.c -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O2 UNSUPPORTED: libgomp.oacc-c++/../libgomp.oacc-c-c++-common/context-1.c -DACC_DEVICE_TYPE_host=1 -DACC_MEM_SHARED=1 -foffload=disable -O2 [...] That is, if 'c.exp' executes first, it does successfully evaluate 'dg-require-effective-target openacc_cublas' -- and does cache this result (so it isn't reevaluated for 'c++.exp'). However, for 'c++.exp' alone (that is, without the 'c.exp' result cached), we run into: spawn -ignore SIGHUP [xgcc] [...] -x c++ openacc_cublas2311907.c [...] In file included from /usr/include/cuda_fp16.h:3673, from /usr/include/cublas_api.h:75, from /usr/include/cublas_v2.h:65, from openacc_cublas2311907.c:3: /usr/include/cuda_fp16.hpp:67:10: fatal error: utility: No such file or directory We're missing include paths to C++/libstdc++ build-tree headers. Fix this by using the mechanism introduced for Fortran in r212268 (commit f707da16f714f7fe5a42391748212c84dfec639b) re "libgomp.fortran/fortran.exp - add -fintrinsic-modules-path ${blddir}". libgomp/ * testsuite/libgomp.c++/c++.exp: Use 'lang_include_flags' instead of 'libstdcxx_includes'. * testsuite/libgomp.oacc-c++/c++.exp: Likewise. --- libgomp/testsuite/libgomp.c++/c++.exp | 7 +++---- libgomp/testsuite/libgomp.oacc-c++/c++.exp | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/libgomp/testsuite/libgomp.c++/c++.exp b/libgomp/testsuite/libgomp.c++/c++.exp index f4884e2ffa7..5b9a5924ff3 100644 --- a/libgomp/testsuite/libgomp.c++/c++.exp +++ b/libgomp/testsuite/libgomp.c++/c++.exp @@ -66,13 +66,12 @@ if { $lang_test_file_found } { set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags" if { [file exists $flags_file] } { - set libstdcxx_includes [exec sh $flags_file --build-includes] - } else { - set libstdcxx_includes "" + set lang_source_re {^.*\.[cC]$} + set lang_include_flags [exec sh $flags_file --build-includes] } # Main loop. - dg-runtest $tests "" "$libstdcxx_includes $DEFAULT_CFLAGS" + dg-runtest $tests "" $DEFAULT_CFLAGS } # See above. diff --git a/libgomp/testsuite/libgomp.oacc-c++/c++.exp b/libgomp/testsuite/libgomp.oacc-c++/c++.exp index 42e0395f9a5..0b235ba47f3 100644 --- a/libgomp/testsuite/libgomp.oacc-c++/c++.exp +++ b/libgomp/testsuite/libgomp.oacc-c++/c++.exp @@ -72,9 +72,8 @@ if { $lang_test_file_found } { set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags" if { [file exists $flags_file] } { - set libstdcxx_includes [exec sh $flags_file --build-includes] - } else { - set libstdcxx_includes "" + set lang_source_re {^.*\.[cC]$} + set lang_include_flags [exec sh $flags_file --build-includes] } # Test with all available offload targets, and with offloading disabled. @@ -147,7 +146,7 @@ if { $lang_test_file_found } { } } - gcc-dg-runtest $tests "$tagopt" "$libstdcxx_includes" + gcc-dg-runtest $tests "$tagopt" "" } unset offload_target } else { -- 2.34.1