From patchwork Tue Sep 10 11:38:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 1160273 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-508758-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="V7dCLsBU"; 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 46SNMc68ZTz9sP3 for ; Tue, 10 Sep 2019 21:38:35 +1000 (AEST) 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=dhBd5PQxnafNl74uRZ/EZTrVO/TrBpxbVHueuvufv5FW+SOvA8 GYPvwS64yjStwtYGbBfQty7ix54qiAULG2yKO/F24vq9LxkYLna+YAWyo5oumR7H aJSIc0zP4dyWfMr8VAPzUVhqb4fuCm2c2i0xvMIGWTFx69kboL4K7ZPZc= 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=PSymgoJQQJo2yEwBj8MMCF05SNo=; b=V7dCLsBUpxh19BQYy3DP i5sU3vJDcECNdEqs9jMQWuGburApTfDxCGrxmfscoKj4gmtiClH/coViv7tc247d 7WT3u2DNLLbTBllyZA7rhbaYmZEqYjqOmYWfxLpyDv6G9V8RiVCGul/dvUlx4M0j G3ySgEAVr6S9w3K4wsRPUpo= Received: (qmail 110445 invoked by alias); 10 Sep 2019 11:38:27 -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 110436 invoked by uid 89); 10 Sep 2019 11:38:27 -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, KAM_SHORT, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=danger, hurt X-HELO: esa2.mentor.iphmx.com Received: from esa2.mentor.iphmx.com (HELO esa2.mentor.iphmx.com) (68.232.141.98) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Sep 2019 11:38:26 +0000 IronPort-SDR: QhUKRUMq3DuidIyiXA1cpwYPa79CyXLeLSupztOiFWHAYtq9e3wP5COluHFyZcYWPP6eCJXEf4 98VeCsF1SMA44LP/fx9q3sgOznWpg34T6FJMqQnqjlTcn1JRUO7vc3FF8MEhgf8Fh2Otjtj/+X Qx+At2g7Z749nBBAxbC6S47q+p9YZc8TkI4emlBCN6maypFWPoT9j/lH6kIkknHtWoduUTsFam hHiV1c59jsRMoJ2vXjzPVJxEUDYYv/du/4RNUfUkCJKcAoSWIjVlfUf3AkraspQWFfnlWUpTjA c/c= Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 10 Sep 2019 03:38:24 -0800 IronPort-SDR: iTR/9ZAarK8DCPSuHbqxF6+GCVCr9iDStRd9umivCPkOA1r1N2ONiF/ul9rJfc33Y/gpb11F21 p7IYtR3a7GP15vWTDe1moTZ05fMzPdH/eFJ67cbgd/vaf7LnF2l7GMOXHHrsndS66HbNPUQECc /aIBc13/QvYGoob13ul3UIYLJQPxsKCYNYzrakqa/wB8EB9A5hhl8DdsSswKS4SsEFvygVerll A7YxMC4M4Op0an1oIa9CKDuIoRjUC8okopuEmcx9H8om7JDJ7nSuBSS482/7D9XlpNhMFkXRH3 gvw= To: "gcc-patches@gcc.gnu.org" From: Andrew Stubbs Subject: [OG9, amdgcn, committed] Use GFX9 granulated sgprs count correctly Message-ID: Date: Tue, 10 Sep 2019 12:38:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 This patches adjusts the "granulated sgpr count" kernel settings for GFX9 devices. I followed the description I found here: http://llvm.org/docs/AMDGPUUsage.html Basically, GFX9 allocates in blocks of 16, not 8, so there was some danger of requesting too many registers, which would hurt performance. Andrew Use GFX9 granulated sgprs count correctly. 2019-09-10 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 66854b6f9c5..f8434e4a4f1 100644 --- a/gcc/config/gcn/gcn.c +++ b/gcc/config/gcn/gcn.c @@ -4884,6 +4884,14 @@ gcn_hsa_declare_function_name (FILE *file, const char *name, tree) sgpr = 102 - 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); @@ -4922,7 +4930,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);