From patchwork Tue Apr 26 11:12:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1622326 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=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KnfPS21dMz9s09 for ; Tue, 26 Apr 2022 21:12:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B5A133857C43 for ; Tue, 26 Apr 2022 11:12:56 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 107DC3858D1E for ; Tue, 26 Apr 2022 11:12:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 107DC3858D1E 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-IronPort-AV: E=Sophos;i="5.90,290,1643702400"; d="scan'208,223";a="77547597" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 26 Apr 2022 03:12:32 -0800 IronPort-SDR: JmxNhgR899mLeT6eLIyrM7hCtW+Am2KRSdJTPLIXhFy9fYGOg/vmsAbQxLCoLPkE2O2HhGTEGL tBbopmh+CIdqpDhL1kfclWrMSzU3cqxteQ+Oq80iMyGtYZNG/sQzXtbXi+Evf7g2hRQyNlZikU hMMrh6uP2+1BWb0xPsVbeg6238yoGt8+BswJsBJB7N2oou6u8qqceO5o3n4I2qoP8vWcQZNWFL z/U8A9PWccfNiVarsQigW3donKrS6ahFVlaaMhCwS0DQhDHJQeArvgCwA1HuxgB0648cgPAIM9 QmE= From: Thomas Schwinge To: Julian Brown , Subject: GCN: Make "gang-private data-share memory exhausted" error more verbose (was: [PATCH] [og10] OpenACC: Shared memory layout optimisation) In-Reply-To: <20200629201653.147326-4-julian@codesourcery.com> References: <20200629201653.147326-1-julian@codesourcery.com> <20200629201653.147326-4-julian@codesourcery.com> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Tue, 26 Apr 2022 13:12:23 +0200 Message-ID: <87sfq085ew.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-06.mgc.mentorg.com (139.181.222.6) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jakub Jelinek , Andrew Stubbs Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi! On 2020-06-29T13:16:52-0700, Julian Brown wrote: > This patch implements an algorithm to lay out local data-share (LDS) space. It currently works for AMD GCN. At the moment, LDS is used for three things: > > 1. Gang-private variables > 2. Reduction temporaries (accumulators) > 3. Broadcasting for worker partitioning > > After the patch is applied, (2) and (3) are placed at preallocated > locations in LDS, and (1) continues to be handled by the backend (as it > is at present prior to this patch being applied). LDS now looks like this: > > +--------------+ (gang local size + 1024, = 1536) > | free space | > | ... | > | - - - - - - -| > | worker bcast | > +--------------+ > | reductions | > +--------------+ <<< -mgang-local-size= (def. 512) > | gang private | > | vars | > +--------------+ (32) > | low LDS vars | > +--------------+ LDS base > > So, gang-private space is fixed at a constant amount at compile time > (which can be increased with a command-line switch if necessary > for some given code). [...] > --- a/gcc/config/gcn/gcn.c > +++ b/gcc/config/gcn/gcn.c > @@ -5240,14 +5286,14 @@ gcn_print_lds_decl (FILE *f, tree var) > if (size > align && size > 4 && align < 8) > align = 8; > > - machfun->lds_allocated = ((machfun->lds_allocated + align - 1) > - & ~(align - 1)); > + gangprivate_hwm = ((gangprivate_hwm + align - 1) & ~(align - 1)); > > - machfun->lds_allocs->put (var, machfun->lds_allocated); > - fprintf (f, "%u", machfun->lds_allocated); > - machfun->lds_allocated += size; > - if (machfun->lds_allocated > LDS_SIZE) > - error ("local data-share memory exhausted"); > + lds_allocs.put (var, gangprivate_hwm); > + fprintf (f, "%u", gangprivate_hwm); > + gangprivate_hwm += size; > + if (gangprivate_hwm > gang_local_size_opt) > + error ("gang-private data-share memory exhausted (increase with " > + "-mgang-local-size=)"); > } > } In a new case (to be discussed later), we're running into this error. OK to push to master branch the attached 'GCN: Make "gang-private data-share memory exhausted" error more verbose'? 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 3f57f1d975dcb859a8203bebadb2b2bfbfba24b9 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Tue, 26 Apr 2022 13:05:19 +0200 Subject: [PATCH] GCN: Make "gang-private data-share memory exhausted" error more verbose MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [...]: error: 512 bytes of gang-private data-share memory exhausted (increase with ‘-mgang-private-size=560’, for example) gcc/ * config/gcn/gcn.cc (gcn_print_lds_decl): Make "gang-private data-share memory exhausted" error more verbose. --- gcc/config/gcn/gcn.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc index 90cc8edc5b4..19e9f424efc 100644 --- a/gcc/config/gcn/gcn.cc +++ b/gcc/config/gcn/gcn.cc @@ -5588,8 +5588,9 @@ gcn_print_lds_decl (FILE *f, tree var) fprintf (f, "%u", gang_private_hwm); gang_private_hwm += size; if (gang_private_hwm > gang_private_size_opt) - error ("gang-private data-share memory exhausted (increase with " - "%<-mgang-private-size=%>)"); + error ("%d bytes of gang-private data-share memory exhausted" + " (increase with %<-mgang-private-size=%d%>, for example)", + gang_private_size_opt, gang_private_hwm); } } -- 2.25.1