On 14 December 2011 02:33, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 12/13/2011 03:35 PM, Paul Berry wrote:<br>
> The Sandy Bridge PRM, volume 4, part 2, section 5.3.10 ("5.3.10<br>
> Register Region Restrictions") contains the following restriction on<br>
> the execution size and operand width of instructions:<br>
><br>
> "3. ExecSize must be equal to or greater than Width."<br>
><br>
> When emitting an IF instruction in single program flow mode on Gen6+,<br>
> we use an ExecSize of 1, therefore the Width of each operand must also<br>
> be 1.<br>
><br>
> The operands of an IF instruction are not actually used for their<br>
> normal purpose on Gen6+ (which is probably the reason this wasn't<br>
> causing a GPU hang), but nonetheless it seems prudent to follow this<br>
> rule.<br>
<br>
</div>I'm not actually sure what you're trying to say here. The IF statement<br>
is different on Gen4-5, Gen6, and Gen7, so I'm unclear what "normal" is.<br></blockquote><div><br>Tell you what, I'll just delete that last paragraph out of the commit message. It wasn't really adding much content anyway.<br>
</div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I think the point is that the ARF null register doesn't have a value, so<br>
null<0,1,0> is just as good as null<4,4,1> or null<8,8,1>. Either way<br>
you get nothing and write nothing. So width is irrelevant other than<br>
dodging this assertion.<br>
<br>
If we weren't guessing execution size based on the register widths, I'd<br>
prefer to just change the null reg to have width 1. But since we do,<br>
that would be a royal pain, and this is nice and simple. I'm definitely<br>
in favor of this patch.<br></blockquote><div><br>Agreed. The whole "guessing execution size" thing has always troubled me, but I haven't thought of a good alternative.<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Reviewed-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
<div class="HOEnZb"><div class="h5"><br>
> This patch unconditionally uses 1-wide null operands for Gen6+<br>
> IF instructions, rather than the standard null operand, which is 8<br>
> components wide.<br>
> ---<br>
> src/mesa/drivers/dri/i965/brw_eu_emit.c | 8 ++++----<br>
> 1 files changed, 4 insertions(+), 4 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c<br>
> index a46a81b..d48753c 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c<br>
> +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c<br>
> @@ -941,11 +941,11 @@ brw_IF(struct brw_compile *p, GLuint execute_size)<br>
> } else if (intel->gen == 6) {<br>
> brw_set_dest(p, insn, brw_imm_w(0));<br>
> insn->bits1.branch_gen6.jump_count = 0;<br>
> - brw_set_src0(p, insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));<br>
> - brw_set_src1(p, insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));<br>
> + brw_set_src0(p, insn, vec1(retype(brw_null_reg(), BRW_REGISTER_TYPE_D)));<br>
> + brw_set_src1(p, insn, vec1(retype(brw_null_reg(), BRW_REGISTER_TYPE_D)));<br>
> } else {<br>
> - brw_set_dest(p, insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));<br>
> - brw_set_src0(p, insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));<br>
> + brw_set_dest(p, insn, vec1(retype(brw_null_reg(), BRW_REGISTER_TYPE_D)));<br>
> + brw_set_src0(p, insn, vec1(retype(brw_null_reg(), BRW_REGISTER_TYPE_D)));<br>
> brw_set_src1(p, insn, brw_imm_ud(0));<br>
> insn->bits3.break_cont.jip = 0;<br>
> insn->bits3.break_cont.uip = 0;<br>
<br>
</div></div></blockquote></div><br>