[Mesa-dev] [PATCH] radeonsi/compute: Fix LDS size calculation

Michel Dänzer michel at daenzer.net
Thu Aug 22 08:48:09 PDT 2013


On Don, 2013-08-22 at 08:45 -0700, Tom Stellard wrote:
> On Thu, Aug 22, 2013 at 05:42:34PM +0200, Michel Dänzer wrote:
> > On Don, 2013-08-22 at 11:25 -0400, Tom Stellard wrote:
> > > From: Tom Stellard <thomas.stellard at amd.com>
> > > 
> > > We need to include the number of LDS bytes allocated by the state tracker.
> > > ---
> > >  src/gallium/drivers/radeonsi/radeonsi_compute.c | 8 +++++++-
> > >  1 file changed, 7 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/src/gallium/drivers/radeonsi/radeonsi_compute.c b/src/gallium/drivers/radeonsi/radeonsi_compute.c
> > > index 10309ba..1adb32f 100644
> > > --- a/src/gallium/drivers/radeonsi/radeonsi_compute.c
> > > +++ b/src/gallium/drivers/radeonsi/radeonsi_compute.c
> > > @@ -191,7 +191,13 @@ static void radeonsi_launch_grid(
> > >  		| S_00B84C_TGID_Z_EN(1)
> > >  		| S_00B84C_TG_SIZE_EN(1)
> > >  		| S_00B84C_TIDIG_COMP_CNT(2)
> > > -		| S_00B84C_LDS_SIZE(shader->lds_size)
> > > +		/* XXX: We are over allocating LDS.  The shader reports LDS in
> > > +		 * blocks of 256 bytes, so if there are 4 bytes lds allocated in
> > > +		 * the shader and 4 bytes allocated by the state tracker, then
> > > +		 * we will set LDS_SIZE to 512 bytes rather than 256.
> > > +		 */
> > > +		| S_00B84C_LDS_SIZE(shader->lds_size +
> > > +				(align(program->local_size, 256) >> 8) + 1)
> > 
> > What's the + 1 at the end for?
> > 
> 
> I added that for safety while debugging, but forgot to remove it.  It
> shouldn't be there.

Okay. Looks good to me other than that, though it might also be nice to
assert that the final value isn't larger than what the hardware
supports.


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer



More information about the mesa-dev mailing list