<div dir="ltr">On 29 October 2013 21:28, Paul Berry <span dir="ltr"><<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="im">On 29 October 2013 17:16, Anuj Phogat <span dir="ltr"><<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>></span> wrote:<br>
</div><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="im"><div><div>
On Tue, Oct 29, 2013 at 4:31 PM, Paul Berry <span dir="ltr"><<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.com</a>></span> wrote:</div>
</div></div><div class="im"><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I think the right thing to do is to add:<br><br></div><div>if (dispatch_width == 16)<br></div><div>    fail("...");<br><br></div><div>to whatever parts of the visitor you aren't confident will work properly in SIMD16.</div>




</div></div></div></blockquote></div><div>Yes. But that only covers the per sample shading enabled due to gl_SampleID and gl_SamplePosition. </div><div><br></div><div>It still doesn't cover the case when there's no  gl_SampleID or  gl_SamplePosition in fragment shader but GL_SAMPLE_SHADING is enabled.</div>




<div>To disable simd16 for this case I either need to keep the relevant changes I made in gen7_wm_state.c </div><div>or</div><div>may be set  simd16_instructions = null in brw_wm_fs_emit() when GL_SAMPLE_SHADING is enabled. It should also be safe to call _mesa_get_min_invocations_per_fragment() in brw_wm_fs_emit(). So, we can take care of all the cases of sample shading enabled at the same place?</div>

</div></div></div></div></blockquote><div><br></div><div>Oh, I didn't realize that you were getting hangs with SIMD16 mode even when neither gl_SampleID nor gl_SamplePosition is used.<br><br></div><div>A large part of the reason I had suggested putting calls to fail() in brw_fs_visitor was because I thought the hangs were due to improper code generation.  Since you're getting hangs just by using GL_SAMPLE_SHADING, the cause mustn't be improper code generation, so my idea of failing out of SIMD16 compilation doesn't make sense anymore.  Based on this information I guess I'm ok with the patch as originally written.</div>

</div></div></div>
</blockquote></div><br><div><br>BTW, on the off chance that it helps you get 
unstuck with your SIMD16 hangs, have you noticed that you have to change
 KSP[0] (kernel start pointer 0) in order to get "SIMD16 only" mode to 
work?  Currently we always emit 3DSTATE_PS like this:<br><br>   BEGIN_BATCH(8);<br>   OUT_BATCH(_3DSTATE_PS << 16 | (8 - 2));<br>   OUT_BATCH(brw->wm.base.prog_offset); /* KSP[0] */<br>   OUT_BATCH(dw2);<br></div>
<div>   OUT_BATCH(dw3);<br></div><div>   OUT_BATCH(dw4);<br>   OUT_BATCH(dw5);<br>   OUT_BATCH(0); /* KSP[1] */<br>   OUT_BATCH(brw->wm.base.prog_offset + brw->wm.prog_data->prog_offset_16); /* KSP[2] */<br>   ADVANCE_BATCH();<br>
<br></div><div>That's
 always worked in the past because (see Graphics BSpec: 3D-Media-GPGPU 
Engine > 3D Pipeline Stages > Pixel > Pixel Shader Thread 
Generation > Pixel Grouping (Dispatch Size) Control):<br>- In "SIMD8 only" mode, KSP[0] is the SIMD8 program, and KSP[1] and KSP[2] are ignored.<br></div><div>- In "SIMD8+SIMD16" mode, KSP[0] is the SIMD8 program, KSP[1] is ignored, and KSP[2] is the SIMD16 program.<br>
</div><div><br></div><div>However, in "SIMD16 only" mode, KSP[0] needs to be the SIMD16 program.<br><br></div><div>(my apologies if you've already accounted for this--it just seems like a likely explanation for "SIMD16 only" GPU hangs)<br>
</div></div></div>