From patchwork Wed Nov 22 17:16:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 168486 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp1493692vqb; Wed, 22 Nov 2023 09:38:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9fWNvBrHgNVFPtbu7WIyYx5PrNMvWuNwOUqi+Nm2ueg6mh/GLvKoWAuSPTzou8Nmn/Uqb X-Received: by 2002:a05:620a:8281:b0:779:efb4:73ad with SMTP id ox1-20020a05620a828100b00779efb473admr2234761qkn.53.1700674730559; Wed, 22 Nov 2023 09:38:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700674730; cv=pass; d=google.com; s=arc-20160816; b=0arRbW5i9mo93DyiFWb+8xPzhFE88Vi+fsCfQhmepLSxSpfJMs21UP6yrVU5k/UUd5 8qU8mDiOBOATPDIvV2ds7vVr59Yu5kchjdTDrnanE7gZMESzFyIgvmtY3EHVZFz/6s56 yIEXlbH6EFufMz0PSHeVnYnlKZcyam8gQJ5ZN4YbHo/gTM28Ve45Q21nuJBJq8smotpo /0bt7JvoxYnsrjBi/2TuueuIG4E/fh7fTPvn9UFACHDKc4lOc4CJMGrX9fZ5Mbc4JaEM XvBZDjtwQl8UulrvBQnXbf00Eq+aSUOImrcn5nj9uMSl0prChSV/1cuiNc7XL5I3ibLA eIYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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:to:from:ironport-sdr :arc-filter:dmarc-filter:delivered-to; bh=MIcw6+kimBbdR7JeuuVj0uPFO3PoGQFzVGVlt2qFVgk=; fh=fXc8b6nlinlBpXPNydhzdLPpIjk+iaOOuAiGPG6Lsvs=; b=Yp7pMGYl4KqglbnJdNX5KQmmU4YsV7T3k0Y6v27KbvbFN8S1islShZN/vUm078q3cS NwWJdhvm9hsYG6tqk1L5VGNPBQ+rdXrB7+pXqCrLp4gldcN7JRm5pO+ahQOXn/3QHJW+ ENkFI5kJ2BxQnwKHVZHaxI+7BfzkgUMwXck/FSsIvLsC5B/ghjw6WSknAQc2VmE5Tf3A NhoP4AudAO5YF8jawZ+VkG8Jso8ujD3X3XN2K1NkEGE8PCQ36ozpNsuNkKzadAb41RuB wy7RJUw9WrLjksS/wcWK6Qe5lquQJFydnnd6rrxwyk5nkHWO4S62VA83kZFJbrcvU+C9 u7lw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ou41-20020a05620a622900b00775907603f0si60365qkn.470.2023.11.22.09.38.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 09:38:50 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 EE09138313A9 for ; Wed, 22 Nov 2023 17:17:58 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 046423858D39 for ; Wed, 22 Nov 2023 17:17:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 046423858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 046423858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700673453; cv=none; b=BAD1bQPBxdBA8hRzUYxUPZ+D4NNLwc2s+HWHSHOttnjtm3HLcjcTFesfHVJ4/gXi5YYjcciRYLa6+1tzkEt4L9AQpTe/ZUbnG6uGPTMQ9zEqXSclxcos4sy6BZS6jC0y97zFjEfTHl8N4abAcnjJJuoX73Wh6yCZKzEFBf+KXok= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700673453; c=relaxed/simple; bh=1qbfq9mRZjk8Px1gEygTTX9ZpMPshO7M5FJm8nYoh0M=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=aPt+BHktujgSp08hK0xA4SKwXK+bJ6xvbm08KkJq/L/OWBKba40SNXN6rxQ05yW3g+tQA+XZyt9AJhV1RgludDri786nRStuoiTT7Lba4MoWvg6VQAfSOctVPTOMy8+y+D1tturTzNSw3svat/HTEZWbiHneWoH5pEcoGHNUigg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from esa3.mentor.iphmx.com ([68.232.137.180]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r5qqm-000750-Vv for gcc-patches@gcc.gnu.org; Wed, 22 Nov 2023 12:17:22 -0500 X-CSE-ConnectionGUID: /o6Xx53KSiWIz1JTFFSnRQ== X-CSE-MsgGUID: cTEwd0pLRSWBwgoNri4dZQ== X-IronPort-AV: E=Sophos;i="6.04,219,1695715200"; d="scan'208,223";a="23465862" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 22 Nov 2023 09:16:10 -0800 IronPort-SDR: abvBmZY4XYrk0qE9vmMd7b2FeBhbbnK+HvpOrNhnPSfD8csWgHSyiYCCdo0gzKGfSawFxoNTm1 BKV0QmGt9PY0GY0Sdp2yoYboHoBmWGJh8AF9KOIIKBszv9RxyTGS2sfvjgZJoC9ic5j38+evno Li28zgXtXS5yTb0sgmIv9EgKucbEqQhefcYd1zo+w8pqVAGrjDSJrARJYI+HAVHPxWvlw4cC3Z de9KicNiYjuQJQprZF5l5TsAsaS8G3YhtmoNMrVuRlSW4NI9G2nZu/NMz753xgY2lXz4yxa/lF 8pY= From: Thomas Schwinge To: Jan Hubicka , , Tobias Burnus , Jakub Jelinek Subject: Adjust 'libgomp.c/declare-variant-{3,4}-[...]' for inter-procedural value range propagation (was: Propagate value ranges of return values) In-Reply-To: References: <871qcmkmgd.fsf@gentoo.org> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Wed, 22 Nov 2023 18:16:05 +0100 Message-ID: <87leapu2sq.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-14.mgc.mentorg.com (139.181.222.14) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) Received-SPF: pass client-ip=68.232.137.180; envelope-from=Thomas_Schwinge@mentor.com; helo=esa3.mentor.iphmx.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-47.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, TXREP, T_SCC_BODY_TEXT_LINE, T_SPF_PERMERROR 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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783286706618408728 X-GMAIL-MSGID: 1783286706618408728 Hi! On 2023-11-19T16:05:42+0100, Jan Hubicka wrote: > this is updated version which also adds testuiste compensation > I lost earlier while maintaining the patch in my testing tree. > There are quite few testcases that use constant return values to hide > something from optimizer. One more: commit a53da3a213ee00866d132c228a0e89bd2f61d65c "Adjust 'libgomp.c/declare-variant-{3,4}-[...]' for inter-procedural value range propagation" pushed to master branch, see attached. (Those regressions are only visible in GCC offloading configurations.) (And actually, all those test cases have other issues; will install further patches later on.) Jakub, Tobias, please let me know if it's not expected that *all* the "variant" functions have to be tagged '__attribute__ ((noipa))' (as I've done); just tagging the "dispatcher" function 'f' isn't sufficient. 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 a53da3a213ee00866d132c228a0e89bd2f61d65c Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Tue, 21 Nov 2023 22:42:49 +0100 Subject: [PATCH] Adjust 'libgomp.c/declare-variant-{3,4}-[...]' for inter-procedural value range propagation ..., that is, commit 53ba8d669550d3a1f809048428b97ca607f95cf5 "inter-procedural value range propagation", after which we see: [-PASS:-]{+FAIL:+} libgomp.c/declare-variant-3-sm30.c scan-nvptx-none-offload-tree-dump optimized "= f30 \\(\\);" Etc. That's due to: @@ -144,13 +144,11 @@ __attribute__((omp target entrypoint, noclone)) void main._omp_fn.0 (const struct .omp_data_t.3 & restrict .omp_data_i) { - int _3; int * _5; [local count: 1073741824]: - _3 = f30 (); _5 = *.omp_data_i_4(D).v; - *_5 = _3; + *_5 = 30; return; It's nice to see this optimization work here, too, but it does interfere with how we're currently testing OpenMP 'declare variant'. libgomp/ * testsuite/libgomp.c/declare-variant-3.h (f30, f35, f53, f70) (f75, f80, f): Add '__attribute__ ((noipa))'. * testsuite/libgomp.c/declare-variant-4.h (gfx803, gfx900, gfx906) (gfx908, gfx90a, f): Likewise. --- libgomp/testsuite/libgomp.c/declare-variant-3.h | 8 ++++++++ libgomp/testsuite/libgomp.c/declare-variant-4.h | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/libgomp/testsuite/libgomp.c/declare-variant-3.h b/libgomp/testsuite/libgomp.c/declare-variant-3.h index 772fc20a519..646e15e5311 100644 --- a/libgomp/testsuite/libgomp.c/declare-variant-3.h +++ b/libgomp/testsuite/libgomp.c/declare-variant-3.h @@ -1,34 +1,41 @@ #pragma omp declare target + +__attribute__ ((noipa)) int f30 (void) { return 30; } +__attribute__ ((noipa)) int f35 (void) { return 35; } +__attribute__ ((noipa)) int f53 (void) { return 53; } +__attribute__ ((noipa)) int f70 (void) { return 70; } +__attribute__ ((noipa)) int f75 (void) { return 75; } +__attribute__ ((noipa)) int f80 (void) { @@ -41,6 +48,7 @@ f80 (void) #pragma omp declare variant (f70) match (device={isa("sm_70")}) #pragma omp declare variant (f75) match (device={isa("sm_75")}) #pragma omp declare variant (f80) match (device={isa("sm_80")}) +__attribute__ ((noipa)) int f (void) { diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4.h b/libgomp/testsuite/libgomp.c/declare-variant-4.h index 2d7c1ef1a5a..47517b75ee7 100644 --- a/libgomp/testsuite/libgomp.c/declare-variant-4.h +++ b/libgomp/testsuite/libgomp.c/declare-variant-4.h @@ -1,28 +1,34 @@ #pragma omp declare target + +__attribute__ ((noipa)) int gfx803 (void) { return 0x803; } +__attribute__ ((noipa)) int gfx900 (void) { return 0x900; } +__attribute__ ((noipa)) int gfx906 (void) { return 0x906; } +__attribute__ ((noipa)) int gfx908 (void) { return 0x908; } +__attribute__ ((noipa)) int gfx90a (void) { @@ -38,6 +44,7 @@ gfx90a (void) #pragma omp declare variant(gfx906) match(device = {isa("gfx906")}) #pragma omp declare variant(gfx908) match(device = {isa("gfx908")}) #pragma omp declare variant(gfx90a) match(device = {isa("gfx90a")}) +__attribute__ ((noipa)) int f (void) { -- 2.34.1