From patchwork Fri Nov 22 14:47:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 1199506 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-514405-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ZrQi0HuK"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47KK791bVsz9sPv for ; Sat, 23 Nov 2019 01:48:35 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=ydZI3jt11xBKSnI1aF1y/Ik2jZKZRcMcNFBf8zBR++1weCxdOh fQbazHGrH1T0QHpbJo96Ej3sb/Lr4Qpa28Jzw/MfZ4ntE5ZQKBPPVk9eSOE1mFPd +wUwVdplnOzrWUP4TM2pas1+7VoNNmC8KTgSeDGEy5ZJYZrMBT4JCaS9E= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=hLRGOmt16M76A8W5tyJx2Vkhe4s=; b=ZrQi0HuKGKNsBjwBiR0k AwwJo9kCGoIhPDlaggs/XDL+68xPWIeWi7FDBljP6Pv+skLwmL1e5bxRA2eplM3M Fs4OLCeZGimQpk10mFjkp21uUoirHOpI9EoEcw+9tNQz9eI8gi+hRqkmQibv2W3/ AM2ChBGT4X4B35XAk2F201o= Received: (qmail 91535 invoked by alias); 22 Nov 2019 14:48:28 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 91280 invoked by uid 89); 22 Nov 2019 14:48:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=cfun, sk:gcn_hsa, sk:max_nor, gcn.c X-HELO: esa4.mentor.iphmx.com Received: from esa4.mentor.iphmx.com (HELO esa4.mentor.iphmx.com) (68.232.137.252) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 22 Nov 2019 14:48:15 +0000 IronPort-SDR: HjrPoIjz+BX5ttMSomGRiTeTFnYr2ipX2M+yIXLtu95SX87VQP1ADralU66X9V9gM+02Lyp5aX 1MNb0hfBHAZnGUcAzfbniGaZULI/9MZmJOGGiZPIt/odFqwjz8kU8OMhAgE+Y7lUDAVJjgQJxX 3okCtYLd7m5b1EdASZMBsALpyMWRlHkajMqVj6vH1qH6FCKwm2/ldUrNIhV8mN8tNh1RwwMWme WYGu0QMoLbqJ+U2xFf86Ir0JXRNvohUl6CiFNmo8MuYRNeZA/F14C0MEyvvi8MKnGA9d7n2Wxk mV8= Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 22 Nov 2019 06:47:46 -0800 IronPort-SDR: r6MEIZoqdo5T/kNuqO2L2P9YKpr3J81a4TYvdDu10qtgzBJjdyy8jNf8LZz8LVffX72JuT1OLw SQEiF4rToO5w1ydmnQNKgB5gLF/pl9AC2DXGffp5HYts5031sbNtlPgOMuRquLK42CTBTR49wB YJ4+wppaGhXL8p385Fn0MVoR5RjZjAGwLRwqp5N/rtNSta3YmptnZUHSpxK4Nntcoheyx1Gn7R mCs5CAEfGwJHJtRbm2qpR1OqwSS1yyuD/RDbP5fFw7JMfi3FixUOucEO0wGJn/QvIxtAOy/uhe KS4= To: "gcc-patches@gcc.gnu.org" From: Andrew Stubbs Subject: [committed, amdgcn] Use GFX9 granulated sgprs count correctly Message-ID: Date: Fri, 22 Nov 2019 14:47:41 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 I've committed the attached. The patch adjusts the GCN kernel metadata so that it is correct for GFX9 devices. The existing implementation was correct for GFX8, and seems to work on GFX9, but wasn't technically correct. Use GFX9 granulated sgprs count correctly. 2019-11-22 Andrew Stubbs gcc/ * config/gcn/gcn.c (gcn_hsa_declare_function_name): Calculate granulated_sgprs according to architecture. diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c index 4401896d441..b34e8e7f5e2 100644 --- a/gcc/config/gcn/gcn.c +++ b/gcc/config/gcn/gcn.c @@ -4922,6 +4922,14 @@ gcn_hsa_declare_function_name (FILE *file, const char *name, tree) sgpr = MAX_NORMAL_SGPR_COUNT - extra_regs; } + /* GFX8 allocates SGPRs in blocks of 8. + GFX9 uses blocks of 16. */ + int granulated_sgprs; + if (TARGET_GCN3) + granulated_sgprs = (sgpr + extra_regs + 7) / 8 - 1; + else if (TARGET_GCN5) + granulated_sgprs = 2 * ((sgpr + extra_regs + 15) / 16 - 1); + fputs ("\t.align\t256\n", file); fputs ("\t.type\t", file); assemble_name (file, name); @@ -4960,7 +4968,7 @@ gcn_hsa_declare_function_name (FILE *file, const char *name, tree) "\t\tcompute_pgm_rsrc2_excp_en = 0\n", (vgpr - 1) / 4, /* Must match wavefront_sgpr_count */ - (sgpr + extra_regs + 7) / 8 - 1, + granulated_sgprs, /* The total number of SGPR user data registers requested. This number must match the number of user data registers enabled. */ cfun->machine->args.nsgprs);