[Mesa-dev] [PATCH 2/2] radeonsi: Use pointers rather than resource descriptors for shader constants v3
Tom Stellard
tom at stellard.net
Tue Aug 6 07:32:04 PDT 2013
On Tue, Aug 06, 2013 at 12:26:51PM +0200, Michel Dänzer wrote:
> On Mon, 2013-08-05 at 14:58 -0400, Tom Stellard wrote:
> > From: Tom Stellard <thomas.stellard at amd.com>
> >
> > The TGSI->LLVM pass for radeonsi preloads constants and relies on LLVM's
> > sinking pass to reduce SGPR usage by lowering constant reads to an
> > optimal place in the code. However, LLVM's machine sink pass will not
> > lower instructions that have been selected from llvm.SI.load.const
> > intrinsics, because these instructions do not have a MachineMemOperand,
> > which LLVM needs in order to determine whether or not it is safe to sink
> > a load. Replacing this intrinsic with a real load instruction will
> > enable the sinking optimization and probably a few others.
> >
> > The other advantages of using pointers are:
> > + Reduced register usage (pointers take 2 registers, descriptors take 4)
> > + More code sharing with compute
>
> OTOH, one advantage of using descriptors is more graceful behaviour if
> the shader tries to access beyond the constant buffer's extents. Would
> it be possible to get the benefits of the machine sink pass with a
> descriptor based solution as well?
>
I think this is possible, I will give it a try.
-Tom
>
> > diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
> > index 4d8a479..d251252 100644
> > --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
> > +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
> > @@ -115,20 +115,31 @@ static LLVMValueRef build_indexed_load(
> > return result;
> > }
> >
> > -static LLVMValueRef build_constant_load(
> > +static LLVMValueRef build_load_constant(
>
> Any particular reason for changing the helper function name in this
> patch? The patch could be smaller and cleaner otherwise.
>
>
> --
> Earthling Michel Dänzer | http://www.amd.com
> Libre software enthusiast | Debian, X and DRI developer
More information about the mesa-dev
mailing list