From patchwork Tue Sep 12 09:02:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 138040 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp270901vqx; Tue, 12 Sep 2023 02:03:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEyjuW6LolFWppfHBNPtQACxLjqMqVj7btA55P/bAF55eB7l0LsiV/zJ3WtBTwhIR7vgXBK X-Received: by 2002:a05:6512:ace:b0:501:c406:c296 with SMTP id n14-20020a0565120ace00b00501c406c296mr10850885lfu.31.1694509427014; Tue, 12 Sep 2023 02:03:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694509426; cv=none; d=google.com; s=arc-20160816; b=ATbPn6Bkyx1dZYGuIL3c8IziZB3aCq686REzTDjyQjHKgccfKjr05gwtkCjimmOR0t Dh6kbY9MsxiTc9isUQ2LuRy49inEGRe8diigKW4cHEgQuNmhHdzwD5ciLOwPAiCSREhg HxiaVU0jU7WBFiLn7hfR9DszQZ++pZ5+r2Oy0HpupJgHjXUP5lkq9Yz+JAIRtl1OPfcd P/zAR+VmMXwiMQvtY7pBeqjkfayi4ptfRFoLjOoPp3tnubdNwmSD8CKJw3+JMbnf8WQ4 vIQsjQu9qvNztVQTu8aKYmQNhGUl5Omh0H9g3VW4y9kKK2zINiOZUKygIfKWfVJRJWoG uoow== 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:to:from:ironport-sdr :dmarc-filter:delivered-to; bh=thFuOKnB4GwfaRwiD7+10hYAeW9i4Y0QJ4mxnt9jM2g=; fh=w8hD9Q1FHAsmZzXsyToCwL3J3Z74rfZAglwW42v9Hoc=; b=eUPxpfuz9SnRwaQq4GQ7tvSqqtPKXSZlxd7N9buPHrG9fspYNqT01HulZ1a7FaAnS8 +9iSK4vgtxdkJj3IEYP/B13Wxtl4Q5zA7dN0wCMa8RVAqfzMWvOwi/ZdXmZ4K1bkQPdW vgWeConzqZP1fevBzVw+qnA9IjhwpfnAKSDrLP1IT3K8YpZ/3NbiRvvUdq0DjzH0EGhL g3uIdI2h/ogqtEbpBzb/MdXfTQdBbQVAvZV9pOdJkBF0HdLc8WuVt8SB2fJNHDkZ17A/ Thpq+ArCgd/KC2eQAYxwsYw0tAiI8QcK+Dkt62OstXR1P/bDIjZnINP/80TJ3Jas3K/H 5gMQ== 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 server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g10-20020a50ee0a000000b0052a6792fa4asi7989278eds.225.2023.09.12.02.03.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 02:03:46 -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 26B6E385773C for ; Tue, 12 Sep 2023 09:03:42 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 8BEDB3858C62 for ; Tue, 12 Sep 2023 09:02:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8BEDB3858C62 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-CSE-ConnectionGUID: KoWKsojrTzelDo68/uOdag== X-CSE-MsgGUID: IEr4WfKDTBu/rP/wDI6Fgw== X-IronPort-AV: E=Sophos;i="6.02,245,1688457600"; d="scan'208,223";a="18667986" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 12 Sep 2023 01:02:15 -0800 IronPort-SDR: WKh7c7o9XA1U9Yg0TDADR0egsrYUTXIdm5ifHwEzk/YF9uZiNj2xJJwXn1jiLSawLkGidTYZ9f 0PgFQLDAVSXiWdVLrYEEwejP0NQjDykvsLt11atZ8LNVQcPdN0MQCOClVu/2znJmPyGrjB4m+I Dm05B8EcOl1gyZa3mrUP+Iw/5ewtPmUiLeQOKjs5UO8g2UygVmzup3VmT3bbjJA4AlOhoign/j kEi8GO/5ZiBAb+ImYAsKkzcaT2s4b9HN8Y6DFQ1daQzDXsqvJ/eKgiTCK64mo9OXsNca3oOiiS V9k= From: Thomas Schwinge To: , Tom de Vries Subject: nvptx 'TARGET_USE_LOCAL_THUNK_ALIAS_P', 'TARGET_SUPPORTS_ALIASES' (was: [committed][nvptx] Use .alias directive for mptx >= 6.3) In-Reply-To: <87iliurqt1.fsf@euler.schwinge.homeip.net> References: <20220322134144.GA32400@delia.home> <87iliurqt1.fsf@euler.schwinge.homeip.net> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Tue, 12 Sep 2023 11:02:02 +0200 Message-ID: <87bke7zrw5.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) 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, WEIRD_PORT 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 Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776821917074983207 X-GMAIL-MSGID: 1776821917074983207 Hi! On 2022-12-02T12:24:58+0100, I wrote: > On 2022-03-22T14:41:46+0100, Tom de Vries via Gcc-patches wrote: >> Starting with ptx isa version 6.3, a ptx directive .alias is available. >> Use this directive to support symbol aliases, as far as possible. >> >> The alias support is off by default. It can be turned on using a switch >> -malias. >> This patch causes a regression: >> ... >> -PASS: gcc.dg/pr60797.c (test for errors, line 4) >> +FAIL: gcc.dg/pr60797.c (test for errors, line 4) >> ... >> The test-case is skipped for effective target alias, and both without and with >> this patch the nvptx target is considered to not support it, so the test-case is >> executed. The test-case expects an error message along the lines of "alias >> definitions not supported in this configuration", but instead we run into: >> ... >> gcc.dg/pr60797.c:4:12: error: foo aliased to undefined symbol >> ... >> This is probably due to the fact that the nvptx backend now defines macros >> ASM_OUTPUT_DEF and ASM_OUTPUT_DEF_FROM_DECLS, so from the point of view of the >> common part of the compiler, aliases are supported. > > Testing this with the new '-malias' flag not active (default), I'm seeing > a number of more regressions: > > [...]: error: alias definitions not supported in this configuration > > [-PASS:-]{+FAIL:+} gcc.dg/pr56727-1.c (test for excess errors) > > PASS: gcc.dg/pr84739.c (test for warnings, line 6) > PASS: gcc.dg/pr84739.c (test for warnings, line 21) > [-PASS:-]{+FAIL:+} gcc.dg/pr84739.c (test for excess errors) > > [-PASS:-]{+FAIL:+} gcc.dg/ipa/pr81520.c (test for excess errors) > > ..., and then, in particular, a ton of regressions in GCC/C++ testing > ('check-gcc-c++') due to approximately 40000 new > "error: alias definitions not supported in this configuration" > diagnostics. Whoops... (I suppose you've not tested that at all?) > > If the new '-malias' flag is not active, we have to maintain (restore) > the previous state of other macros, as I'm demonstrating in the attached > "[WIP] nvptx 'TARGET_USE_LOCAL_THUNK_ALIAS_P', 'TARGET_SUPPORTS_ALIASES'". > This completely addresses in particular the 'check-gcc-c++' regressions, > and does not cause any changes if the new '-malias' flag in fact is > active (as when testing with '-mptx=6.3 -malias', for example). > > However, this further regresses the 'gcc.dg/pr56727-1.c' and > 'gcc.dg/ipa/pr81520.c' test cases mentioned above: > > during IPA pass: whole-program > [...]: internal compiler error: in function_and_variable_visibility, at ipa-visibility.cc:647 > > {+FAIL: gcc.dg/pr56727-1.c (internal compiler error: in function_and_variable_visibility, at ipa-visibility.cc:647)+} > FAIL: gcc.dg/pr56727-1.c (test for excess errors) > > {+FAIL: gcc.dg/ipa/pr81520.c (internal compiler error: in function_and_variable_visibility, at ipa-visibility.cc:647)+} > FAIL: gcc.dg/ipa/pr81520.c (test for excess errors) > > Such ICEs we're not yet currently seeing elsewhere; this remains to be > analyzed -- after all, these test cases PASSed originally. That'll be addressed by "More '#ifdef ASM_OUTPUT_DEF' -> 'if (TARGET_SUPPORTS_ALIASES)' etc.": [-FAIL: gcc.dg/pr56727-1.c (internal compiler error: in function_and_variable_visibility, at ipa-visibility.cc:647)-] [-FAIL:-]{+PASS:+} gcc.dg/pr56727-1.c (test for excess errors) [-FAIL:-]{+PASS:+} gcc.dg/pr60797.c (test for errors, line 4) [-FAIL:-]{+PASS:+} gcc.dg/pr60797.c (test for excess errors) [-FAIL: gcc.dg/ipa/pr81520.c (internal compiler error: in function_and_variable_visibility, at ipa-visibility.cc:647)-] [-FAIL:-]{+PASS:+} gcc.dg/ipa/pr81520.c (test for excess errors) > And, obviously, the patch needs some "copy editing". > --- a/gcc/config/nvptx/nvptx.h > +++ b/gcc/config/nvptx/nvptx.h > @@ -338,6 +338,12 @@ struct GTY(()) machine_function > #define ASM_OUTPUT_DEF_FROM_DECLS(STREAM, NAME, VALUE) \ > nvptx_asm_output_def_from_decls (STREAM, NAME, VALUE) > > +//TODO > +/* ..., but don't let that dummy ASM_OUTPUT_DEF definition influence other > + macros. */ > +#define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) (!((nvptx_alias == 0 || !TARGET_PTX_6_3))) > +#define TARGET_SUPPORTS_ALIASES (!((nvptx_alias == 0 || !TARGET_PTX_6_3))) Pushed to master branch commit 537e2cc30d0f8ba6433af52f2fef038d75d93174 "nvptx 'TARGET_USE_LOCAL_THUNK_ALIAS_P', 'TARGET_SUPPORTS_ALIASES'", see attached. 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 537e2cc30d0f8ba6433af52f2fef038d75d93174 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 14 Jul 2022 22:05:17 +0200 Subject: [PATCH] nvptx 'TARGET_USE_LOCAL_THUNK_ALIAS_P', 'TARGET_SUPPORTS_ALIASES' This fixes up commit f8b15e177155960017ac0c5daef8780d1127f91c "[nvptx] Use .alias directive for mptx >= 6.3", which regressed in particular C++ test cases if the new '-malias' flag was not active. In that case, we have to maintain (that is now, restore) the previous state of 'TARGET_USE_LOCAL_THUNK_ALIAS_P', 'TARGET_SUPPORTS_ALIASES'. The remaining three regressions are to be resolved via "More '#ifdef ASM_OUTPUT_DEF' -> 'if (TARGET_SUPPORTS_ALIASES)' etc.". gcc/ * config/nvptx/nvptx.h (TARGET_USE_LOCAL_THUNK_ALIAS_P) (TARGET_SUPPORTS_ALIASES): Define. --- gcc/config/nvptx/nvptx.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/config/nvptx/nvptx.h b/gcc/config/nvptx/nvptx.h index 15a52344d4a..129427e5654 100644 --- a/gcc/config/nvptx/nvptx.h +++ b/gcc/config/nvptx/nvptx.h @@ -338,6 +338,11 @@ struct GTY(()) machine_function #define ASM_OUTPUT_DEF_FROM_DECLS(STREAM, NAME, VALUE) \ nvptx_asm_output_def_from_decls (STREAM, NAME, VALUE) +/* ..., but also override other macros to avoid 'gcc/defaults.h'-initialization + due to that dummy 'ASM_OUTPUT_DEF'. */ +#define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) TARGET_SUPPORTS_ALIASES +#define TARGET_SUPPORTS_ALIASES (nvptx_alias != 0) + #define NO_DOT_IN_LABEL #define ASM_COMMENT_START "//" -- 2.34.1