[Mesa-dev] [PATCH] r600g: Add a Cayman specific version of UMAD

Martin Andersson g02maran at gmail.com
Fri Mar 29 18:35:23 PDT 2013


I found an issue with the shader compiler for Cayman when I looked
into why the ext_transform_feedback/order test case caused a GPU stall.
It turned out the stall was an infinite loop that was the result of broken
calculation in the shader function. The issue is that Cayman uses the
tgsi_umad function for UMAD, but that does not work since it does not
populate the y, z and w slots for UMUL that cayman requires.

This patch implements a cayman_umad. There are some things I'm unsure of though. 

The UMUL for Cayman is compiled to, as far as I can tell, ALU_OP2_MULLO_INT and
not ALU_OP2_MULLO_UINT. So I do not know if I should use the int or the uint
version in cayman_umad. In the patch I used the uint one, because that seemed
the most logical.

The add part of UMAD I copied from tgsi_umad and that had a loop around the
variable lasti, but the variable lasti is usally not used in cayman specific code.

This is used in tgsi functions.
int lasti = tgsi_last_instruction(inst->Dst[0].Register.WriteMask);

But in cayman specific code this is used instead.
int last_slot = (inst->Dst[0].Register.WriteMask & 0x8) ? 4 : 3;

It does not work to switch lasti with last_slot, since that makes the loop run too
many times (in my test case lasti is 0 and last_slot is 3). So I just removed the
loop, was that correct or should i resolve that in some other way?

Martin Andersson (1):
  r600g: Add a Cayman specific version of UMAD

 src/gallium/drivers/r600/r600_shader.c | 47 +++++++++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)

-- 
1.8.2



More information about the mesa-dev mailing list