GCN: Make "gang-private data-share memory exhausted" error more verbose (was: [PATCH] [og10] OpenACC: Shared memory layout optimisation)
Commit Message
Hi!
On 2020-06-29T13:16:52-0700, Julian Brown <julian@codesourcery.com> 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=<number> (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=<number>)");
> }
> }
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
Comments
On Tue, 26 Apr 2022 13:12:23 +0200
Thomas Schwinge <thomas@codesourcery.com> wrote:
> > @@ -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=<number>)");
> > }
> > }
>
> 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'?
LGTM, thanks.
Julian
From 3f57f1d975dcb859a8203bebadb2b2bfbfba24b9 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
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(-)
@@ -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=<number>%>)");
+ 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