From patchwork Thu Aug 8 08:54:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1970462 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=wv71LsV2; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wfgpc5tT0z1yfC for ; Thu, 8 Aug 2024 18:54:48 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7E7973858C41 for ; Thu, 8 Aug 2024 08:54:44 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id 3802B3858C33 for ; Thu, 8 Aug 2024 08:54:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3802B3858C33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=baylibre.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3802B3858C33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::332 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723107252; cv=none; b=kDGett+neR1ny6/aE+cJb4ktR28pv2rwVQgtE5eycNfUIaf4ozscaBWbJgPgau/NUeKJnAdvwbmVnm2C4DyvrTYQNutPUX5T9DMv+rGZLRO9miQlz6lAXEkqM8SadpNjObJns8txWr78AKkDHtreTOkp5g8/lSyFkN7WgPEhvXQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723107252; c=relaxed/simple; bh=OoXpHLB8WfDTkqdkR1d984dQ/hezWlfe0n1ZPHWeOX4=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=lZxRY7fknZiE1lodm9OKBXkcpKkwvUXmUobeVMcFmdj6Veqjw1XoHsg1/R5U8ArioI0YCG6sw4mLJTaiuRnRpt9PpP71k7N6S+otoUKkS+WU2iXyTFkmyQ/IvIgm0J4IwZVUvS1hfdQiSXH6vG5+XQ/j1EL2VLjNTJ+w9ywpC4s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-42817f1eb1fso4677635e9.1 for ; Thu, 08 Aug 2024 01:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1723107248; x=1723712048; darn=gcc.gnu.org; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=URrkj3dPyF07mGjCfsyo3T3lKGSRyTjxlo7nIc26Bvo=; b=wv71LsV27I7XM1Ae9t5F++xQQ8zbdIcFi+0THmTI+8qOhCA2E0sT+n/ZQ1F4+c6uM/ SGlWxQu6boGq7bL5JtLbUldfotJBcbJ8QtJeDi6PlgNb8UzYa78HesykfbZ/WD8N6Aj3 pR+FgkQ+WPhHnBsXhHAFOjgCnkjM6MTwxHTwFidSE5FvQaplpsKedIszg4UuNppPqSu/ OKQtDhe7RmQTgNocWjlY8UgFvWoB8frDjQjNdVD899DK6Sy/YpQaAyfPwEq+9eTjgUOT D1Omhlr0URTbkRDPco1aeTbLQuKMtphJLazoez0MJ8wsRMEwq0gXIoqlJi9zG80Y3Prj 1P/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723107248; x=1723712048; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=URrkj3dPyF07mGjCfsyo3T3lKGSRyTjxlo7nIc26Bvo=; b=bFeRC7tz1QGlXN6ywqGcqGlTIgCtaNTL3O6flz+cwwGaHfdM6Nyu5Ux1F8uB+EYZ58 tIPEDKXqgf2KDkjQHxawEOPxiKKmKyZrmN8kTlv8QZjv9lyGTKLpS60Y1xPuPyCrQcyw 7rQinAP/wIoagyELqoiglv4+ZnhXBZ/VIaSuibkHiJsgow/lrnyg7hF1tzhc5xidfDCp 9UTG2f92bRk8wSNX/H9okW3q5axWjvMajP8YKopg2idlYpbc3saf1RL7rtAZkeCS96dP QMggdiYth2kkFsbiXlOpyQgeyisK22UaP0LuBC2+N/VF6+mww8FPKMu0q/vaaNhKCAiB hkPA== X-Forwarded-Encrypted: i=1; AJvYcCXLdS8Qpgzs5+qhq+wuXWL5elBwBmEaFVLRfY6joFO5sGG+Z74iev1XIpoi2Gd8+vH2n+53NySoKDhReGTWauarffRlRlOoQA== X-Gm-Message-State: AOJu0YyWHwAITYRIIND95FvzFB7YfJqf+aOIVtamyj0kTPid5Dtfk3rR 96sREsAoOA/DBZULdaB8xQspISAVpRdEH0cb+NdFiz8FNwhYwUN80t23W54ALMk= X-Google-Smtp-Source: AGHT+IFlmvcY6VkFhVKaNyEMamGGSyP4cUKpzJ9zv5cnFSh7AU/YY3sGHZieSUbi3ic67F/0CPmsbA== X-Received: by 2002:a05:6000:e02:b0:368:3b21:6643 with SMTP id ffacd0b85a97d-36d27560ademr901890f8f.48.1723107248435; Thu, 08 Aug 2024 01:54:08 -0700 (PDT) Received: from ?IPV6:2001:16b8:2676:1a00:fae7:f002:1ada:2d8b? (200116b826761a00fae7f0021ada2d8b.dip.versatel-1u1.de. [2001:16b8:2676:1a00:fae7:f002:1ada:2d8b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36d27207ad2sm1172562f8f.71.2024.08.08.01.54.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Aug 2024 01:54:08 -0700 (PDT) Message-ID: <51369b83-1fc9-4549-8633-9c3c4b476075@baylibre.com> Date: Thu, 8 Aug 2024 10:54:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [committed] libgomp.c++/static-aggr-constructor-destructor-{1,2}.C: Fix scan-tree-dump (was: [r15-2799 Regression] FAIL: libgomp.c++/static-aggr-constructor-destructor-2.C scan-tree-dump-times optimized "void _GLOBAL__off_I_" 1 on Linux/x86_64) To: "haochen.jiang" , gcc-regression@gcc.gnu.org, gcc-patches@gcc.gnu.org, haochen.jiang@intel.com References: <202408072307.477N7xGC2197835@shliclel4214.sh.intel.com> Content-Language: en-US From: Tobias Burnus In-Reply-To: <202408072307.477N7xGC2197835@shliclel4214.sh.intel.com> X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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.30 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 haochen.jiang wrote: > FAIL: libgomp.c++/static-aggr-constructor-destructor-1.C scan-tree-dump-times optimized "__attribute__\\(\\([^\n\r]*omp declare target nohost" 1 > FAIL: libgomp.c++/static-aggr-constructor-destructor-1.C scan-tree-dump-times optimized "void _GLOBAL__off_I_v1" 1 Those symbols are generated even with ENABLE_OFFLOADING == false, but in that case they are optimized way (as they should). With offloading, the pass removing them comes too late, but we should handle 'nohost' explicitly. Once done, the dump will be the same (no symbol). Until this implemented, we now do: To make this test pass, we now use 'target (!) offload_target_any' to separate the cases, even though offload_target_any does not completely match ENABLE_OFFLOADING.* Committed as r15-2814-ge3a6dec326a127 Tobias (* If you configured with --enable-offload-defaulted and have no offload binaries available or when you smuggle '-foffload=disable' to the commandline, ENABLE_OFFLOADING is true while offload_target_any is false.) commit e3a6dec326a127ad549246435b9d3835e9a32407 Author: Tobias Burnus Date: Thu Aug 8 10:42:25 2024 +0200 libgomp.c++/static-aggr-constructor-destructor-{1,2}.C: Fix scan-tree-dump In principle, the optimized dump should be the same on the host, but as 'nohost' is not handled, is is present. However when ENABLE_OFFLOADING is false, it is handled early enough to remove the function. libgomp/ChangeLog: * testsuite/libgomp.c++/static-aggr-constructor-destructor-1.C: Split scan-tree-dump into with and without target offload_target_any. * testsuite/libgomp.c++/static-aggr-constructor-destructor-2.C: Likewise. --- .../libgomp.c++/static-aggr-constructor-destructor-1.C | 15 ++++++++++++--- .../libgomp.c++/static-aggr-constructor-destructor-2.C | 16 +++++++++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/libgomp/testsuite/libgomp.c++/static-aggr-constructor-destructor-1.C b/libgomp/testsuite/libgomp.c++/static-aggr-constructor-destructor-1.C index 403a071c0c0..b5aafc8cabc 100644 --- a/libgomp/testsuite/libgomp.c++/static-aggr-constructor-destructor-1.C +++ b/libgomp/testsuite/libgomp.c++/static-aggr-constructor-destructor-1.C @@ -9,9 +9,18 @@ // { dg-final { scan-tree-dump-not "omp_is_initial_device" "optimized" } } // { dg-final { scan-tree-dump-not "__omp_target_static_init_and_destruction" "optimized" } } -// FIXME: should be '-not' not '-times' 1: -// { dg-final { scan-tree-dump-times "void _GLOBAL__off_I_v1" 1 "optimized" } } -// { dg-final { scan-tree-dump-times "__attribute__\\(\\(\[^\n\r]*omp declare target nohost" 1 "optimized" } } + +// (A) No offloading configured: The symbols aren't present +// Caveat: They are present with -foffload=disable - or offloading +// configured but none of the optional offload packages/binaries installed. +// But the 'offload_target_any' check cannot distinguish those +// { dg-final { scan-tree-dump-not "void _GLOBAL__off_I_v1" "optimized" { target { ! offload_target_any } } } } +// { dg-final { scan-tree-dump-not "__attribute__\\(\\(\[^\n\r]*omp declare target nohost" "optimized" { target { ! offload_target_any } } } } + +// (B) With offload configured (and compiling for an offload target) +// the symbols are present (missed optimization). Hence: FIXME. +// { dg-final { scan-tree-dump-times "void _GLOBAL__off_I_v1" 1 "optimized" { target offload_target_any } } } +// { dg-final { scan-tree-dump-times "__attribute__\\(\\(\[^\n\r]*omp declare target nohost" 1 "optimized" { target offload_target_any } } } // { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump-not "omp_initial_device;" "optimized" { target offload_target_amdgcn } } } // { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "v1\\._x = 5;" "optimized" { target offload_target_amdgcn } } } diff --git a/libgomp/testsuite/libgomp.c++/static-aggr-constructor-destructor-2.C b/libgomp/testsuite/libgomp.c++/static-aggr-constructor-destructor-2.C index 6dd4260a522..9652a721bbe 100644 --- a/libgomp/testsuite/libgomp.c++/static-aggr-constructor-destructor-2.C +++ b/libgomp/testsuite/libgomp.c++/static-aggr-constructor-destructor-2.C @@ -9,9 +9,19 @@ // { dg-final { scan-tree-dump-not "omp_is_initial_device" "optimized" } } // { dg-final { scan-tree-dump-not "__omp_target_static_init_and_destruction" "optimized" } } -// FIXME: should be '-not' not '-times' 1: -// { dg-final { scan-tree-dump-times "void _GLOBAL__off_I_" 1 "optimized" } } -// { dg-final { scan-tree-dump-times "__attribute__\\(\\(\[^\n\r]*omp declare target nohost" 1 "optimized" } } + +// (A) No offloading configured: The symbols aren't present +// Caveat: They are present with -foffload=disable - or offloading +// configured but none of the optional offload packages/binaries installed. +// But the 'offload_target_any' check cannot distinguish those +// { dg-final { scan-tree-dump-not "void _GLOBAL__off_I_v1" "optimized" { target { ! offload_target_any } } } } +// { dg-final { scan-tree-dump-not "__attribute__\\(\\(\[^\n\r]*omp declare target nohost" "optimized" { target { ! offload_target_any } } } } + +// (B) With offload configured (and compiling for an offload target) +// the symbols are present (missed optimization). Hence: FIXME. +// { dg-final { scan-tree-dump-times "void _GLOBAL__off_I_v1" 1 "optimized" { target offload_target_any } } } +// { dg-final { scan-tree-dump-times "__attribute__\\(\\(\[^\n\r]*omp declare target nohost" 1 "optimized" { target offload_target_any } } } + // { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump-not "omp_initial_device;" "optimized" { target offload_target_amdgcn } } } // { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "v1\\._x = 5;" "optimized" { target offload_target_amdgcn } } }