[Mesa-dev] [PATCH] i965: Implement get_nir_src_imm() helpers.
Kenneth Graunke
kenneth at whitecape.org
Wed Dec 2 15:29:03 PST 2015
On Wednesday, December 02, 2015 10:54:39 AM Connor Abbott wrote:
> On Wed, Dec 2, 2015 at 3:26 AM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> > Normally, get_nir_src() won't return an immediate value - it moves it to
> > a temporary VGRF. There are consumers of get_nir_src() that rely on
> > this, and are unprepared to handle immediate values.
> >
> > This patch introduces new helpers which return immediates for single
> > component constant values, and VGRFs for other values.
>
> Just curious, what are you going to use this for? Constant propagation
> should always be smart enough to fold constants into the instruction,
> since the constants are SSA values that turn into registers which are
> only written once.
I'm using it for URB read/write messages for reading inputs/outputs.
For TCS inputs, we separate out the vertex ID (using the per_vertex
intrinsic variants). If the vertex ID is constant, I can directly
access the register with the URB handle I want. Otherwise, I have
do a register-indirect MOV using the address register to select the
handle I want.
Beyond that, URB messages have a a global constant offset baked into the
instruction itself, and a per-channel non-constant offset in the message
header. If I have an entirely constant offset, I don't have to emit any
code to set up the per-slot offsets.
In general, I agree, relying on constant propagation is a reasonable
plan. But for inputs and outputs, it's really handy.
--Ken
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151202/7e848c95/attachment.sig>
More information about the mesa-dev
mailing list