From patchwork Mon Jan 8 10:03:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 185887 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp924916dyq; Mon, 8 Jan 2024 02:04:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJs82cB0pXtASGJl9LN+9agPQ1Rb0azDuBLycmqV7/j2xpLtjKWPbQZ68190C9PrMrVoYf X-Received: by 2002:a0d:da42:0:b0:5ec:9872:ee86 with SMTP id c63-20020a0dda42000000b005ec9872ee86mr1760033ywe.78.1704708294151; Mon, 08 Jan 2024 02:04:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704708294; cv=pass; d=google.com; s=arc-20160816; b=EbCoHesqRKIMOTciytHwtW9c0WsBYH/C4zOYbC+Vdyflo6n2wx7hw6aIfG8AFQ6SgC cWDvkFDodLYm4eUwXzCBCIUxWCo/9PfYYDAK46FvPcv20YXLYz7MCePOsm4JrqJRQABK uZnsJSTAf3N5v7FnvV5tZACH5xoExWVWINaGPGRtuk9HRdWTh2l8lwzKJyX7ejlAcqe/ evMW+cnkFQCYr3Kfl7L9tnfbRnGUMx1nx/l41UVVsW6oLAYEhAuepINo4misvjxmwu8A +V+MobMoofRV0Ne0oDLUEqwSGZmqM1npR1QEClmjjdzXwVOrcxXkfVKAxFApg240ej/P ly8Q== 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:subject:from:to :content-language:user-agent:mime-version:date:message-id :ironport-sdr:arc-filter:dmarc-filter:delivered-to; bh=BdukzaxA94J7P3A/jHvlPbiiaWzHMKVZsDKAhGtmFes=; fh=XNn3asQvIblazGK92GBt13dVv+YmGV3pBS0JC29ZQco=; b=YZgtdVqlsX9QGQ9/n5RDbfoQQkfqSLoEE/rlpuRNl9iUrRsBy3YDNHxe99JQ2AXkH1 kb6keFBQu3Y5vU386wLjYId5n6eqPtMq6iSsPV26wJxmAydDsRPSDAo4y2ZbcUqHEyGK swDkSPRcUxIUatUu2ClQXfNMYzIgvp6+hsiBLduOoIp8WKb0eUMj4Npmh+Giwu+9/NLw gsmIwLKim0a6y1OvIuSWzdhgv9/t3PubjNq33rAHfTJM/25Iur7o6QMfzDo3vA5o5nn+ zrOQropLbjQU/wW7K7nXD128SUOqRU/0kXDuadMZCbeUSMUzIbWNZdH7P29Tc9Sos+Mp Sv3A== 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 pa30-20020a05620a831e00b007817145fa08si1999799qkn.406.2024.01.08.02.04.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 02:04:54 -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 D3D253858283 for ; Mon, 8 Jan 2024 10:04:53 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 10D463858CD1 for ; Mon, 8 Jan 2024 10:03:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 10D463858CD1 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 10D463858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.137.180 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704708242; cv=none; b=OWkAaRS1UQrf6rZ8mmKclaAEIUPvpwCYMVH6moEQemf3JVM0AktWCRbrgXsS/yTHc9wIMxO1T1Kci2fF5j82Nv5s03RN9wti2d2cZWf4cvgSgWiElg+Ukxbq5h2gEoqPUhRidzhRNb6GZ30ip4AxANgVQd/OaLQ4FelDxKbjS7E= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704708242; c=relaxed/simple; bh=Gv43oR4VypplO3R7MIMyWo24kqDxV7OwGmNm7V0bg4o=; h=Message-ID:Date:MIME-Version:To:From:Subject; b=joZOExFeJTNB5OkGBfd0x6peDX53MWeufk9nfqj2JnewhkxJEVufnmXWQpfIBx2TrsMPx6iFzcEK4UnyOGmOX8YGo6NEERr0d8vNIUumldnvJUTt0p8EBjGinSQ4P1uTN2BIZ8RIvtt8NGlbP3govFwxNNSiIbik+c97uKDSmDs= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: y/8O5+EHTU2Kj4bgkmyb+Q== X-CSE-MsgGUID: Reytzo3aR1O2cZPx2PFiqA== X-IronPort-AV: E=Sophos;i="6.04,340,1695715200"; d="scan'208";a="27423696" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 08 Jan 2024 02:03:53 -0800 IronPort-SDR: HpAss2YY6GBmvPO8gUEITn3gUCLtIB+cxKzO3t1RPkhCDGvpfG1vTiChw8Dh+iKA7ikwMDqDXV CbvzhV5Z+NTBLDIFboDNghg6XsFzHfHd25vj9jJhA4iI96BF2nXuqq/x5gvVPIXhJ4ppYXycl5 6sriA1EF/Ghy5acg/wT+kW1hyk7ez7ASLCSGA0HHFJtQznM1bisbB2tyFkQPJFbV1RX2ZcZd2P k6jeYtW4SS1sAXK8EBcOyMHy/s1l/FiGkKIFmcjFEjI13ZRtLhmrYZrCQr1nc8QfSdpr253S1P XQw= Message-ID: Date: Mon, 8 Jan 2024 10:03:48 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "gcc-patches@gcc.gnu.org" From: Andrew Stubbs Subject: [committed] amdgcn: Match new XNACK defaults in mkoffload X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) To svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) X-Spam-Status: No, score=-11.9 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.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: 1787516204147489135 X-GMAIL-MSGID: 1787516204147489135 This patch fixes build failures with the offload toolchain since my recent XNACK patch. The problem was simply that mkoffload made out-of-date assumptions about the -mxnack defaults. This patch fixes the mismatch. Committed to mainline. Andrew amdgcn: Don't double-count AVGPRs CDNA2 devices have VGPRs and AVGPRs combined into a single hardware register file (they're seperate in CDNA1). I originally thought they were counted separately in the vgpr_count and agpr_count metadata fields, and therefore mkoffload had to account for this when passing the values to libgomp. However, that wasn't the case, and this code should have been removed when I corrected the calculations in gcn.cc. Fixing the error now. gcc/ChangeLog: * config/gcn/mkoffload.cc (isa_has_combined_avgprs): Delete. (process_asm): Don't count avgprs. diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc index 3341c0d34eb..03cd040dbd2 100644 --- a/gcc/config/gcn/mkoffload.cc +++ b/gcc/config/gcn/mkoffload.cc @@ -471,26 +471,6 @@ copy_early_debug_info (const char *infile, const char *outfile) return true; } -/* CDNA2 devices have twice as many VGPRs compared to older devices, - but the AVGPRS are allocated from the same pool. */ - -static int -isa_has_combined_avgprs (int isa) -{ - switch (isa) - { - case EF_AMDGPU_MACH_AMDGCN_GFX803: - case EF_AMDGPU_MACH_AMDGCN_GFX900: - case EF_AMDGPU_MACH_AMDGCN_GFX906: - case EF_AMDGPU_MACH_AMDGCN_GFX908: - case EF_AMDGPU_MACH_AMDGCN_GFX1030: - return false; - case EF_AMDGPU_MACH_AMDGCN_GFX90a: - return true; - } - fatal_error (input_location, "unhandled ISA in isa_has_combined_avgprs"); -} - /* Parse an input assembler file, extract the offload tables etc., and output (1) the assembler code, minus the tables (which can contain problematic relocations), and (2) a C file with the offload tables @@ -516,7 +496,6 @@ process_asm (FILE *in, FILE *out, FILE *cfile) { int sgpr_count; int vgpr_count; - int avgpr_count; char *kernel_name; } regcount = { -1, -1, NULL }; @@ -564,12 +543,6 @@ process_asm (FILE *in, FILE *out, FILE *cfile) gcc_assert (regcount.kernel_name); break; } - else if (sscanf (buf, " .agpr_count: %d\n", - ®count.avgpr_count) == 1) - { - gcc_assert (regcount.kernel_name); - break; - } break; } @@ -712,8 +685,6 @@ process_asm (FILE *in, FILE *out, FILE *cfile) { sgpr_count = regcounts[j].sgpr_count; vgpr_count = regcounts[j].vgpr_count; - if (isa_has_combined_avgprs (elf_arch)) - vgpr_count += regcounts[j].avgpr_count; break; }