<div dir="ltr">Hello,<br><br>Thanks for a fast feedback.<br>I have created new patch:<br>"i965/gen6/gs: Handle case where a GS doesn't allocate VUE"<br>which contains all fixes.<br><br>Regards,<br>Andrii.<div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 19, 2018 at 3:16 PM, Iago Toral <span dir="ltr"><<a href="mailto:itoral@igalia.com" target="_blank">itoral@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Andrii,<br>
<br>
thanks for the fix!<br>
<br>
Kenneth, this patch makes it so that we end the GS program with and<br>
ENDIF. I remember that back in the day when I wrote this code you had<br>
concerns about that (that's why I added that comment), but that was a<br>
long time ago so maybe things have changed, do you know if this is<br>
still something that we should avoid?<br>
<br>
Andrii: limit the subject line (the one that shows up in the subject of<br>
the e-mail starting after "[PATCH]" small enough to fit in 80<br>
characters. I do a quick review of the patch inline below and will do a<br>
more thorough review tomorrow.<br>
<br>
On Tue, 2018-06-19 at 11:31 +0300, Andrii Simiklit wrote:<br>
> We can not use the VUE Dereference flags combination for EOT<br>
> message under ILK and SNB because the threads are not initialized<br>
> there with initial VUE handle unlike Pre-IL.<br>
> So to avoid GPU hangs on SNB and ILK we need<br>
> to avoid usage of the VUE Dereference flags combination.<br>
> (Was tested only on SNB but according to specification<br>
> <a href="https://01.org/sites/default/files/documentation/snb_ihd_os_vol2_part" rel="noreferrer" target="_blank">https://01.org/sites/default/<wbr>files/documentation/snb_ihd_<wbr>os_vol2_part</a><br>
> 1_0.pdf<br>
> sections: 1.6.5.3, 1.6.5.6<br>
> the ILK must behave itself in the similar way)<br>
> <br>
> Signed-off-by: Andrii Simiklit <<a href="mailto:andrii.simiklit@globallogic.com">andrii.simiklit@globallogic.<wbr>com</a>><br>
<br>
Add:<br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=105399" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=105399</a><br>
<br>
> ---<br>
>  src/intel/compiler/gen6_gs_<wbr>visitor.cpp | 53<br>
> ++++++++++++++++++++++++++++++<wbr>----<br>
>  1 file changed, 47 insertions(+), 6 deletions(-)<br>
> <br>
> diff --git a/src/intel/compiler/gen6_gs_<wbr>visitor.cpp<br>
> b/src/intel/compiler/gen6_gs_<wbr>visitor.cpp<br>
> index 66c69fb..2143fd2 100644<br>
> --- a/src/intel/compiler/gen6_gs_<wbr>visitor.cpp<br>
> +++ b/src/intel/compiler/gen6_gs_<wbr>visitor.cpp<br>
> @@ -300,10 +300,11 @@ gen6_gs_visitor::emit_urb_<wbr>write_opcode(bool<br>
> complete, int base_mrf,<br>
>        /* Otherwise we always request to allocate a new VUE handle.<br>
> If this is<br>
>         * the last write before the EOT message and the new handle<br>
> never gets<br>
>         * used it will be dereferenced when we send the EOT message.<br>
> This is<br>
> -       * necessary to avoid different setups for the EOT message<br>
> (one for the<br>
> +       * necessary to avoid different setups (under Pre-IL only) for<br>
> the EOT message (one for the<br>
>         * case when there is no output and another for the case when<br>
> there is)<br>
>         * which would require to end the program with an<br>
> IF/ELSE/ENDIF block,<br>
> -       * something we do not want.<br>
> +       * something we do not want. <br>
> +       * But for ILK and SNB we can not avoid the end the program<br>
> with an IF/ELSE/ENDIF block.<br>
>         */<br>
<br>
Limit lines to 80 characters long.<br>
<br>
>        inst = emit(GS_OPCODE_URB_WRITE_<wbr>ALLOCATE);<br>
>        inst->urb_write_flags = BRW_URB_WRITE_COMPLETE;<br>
> @@ -449,8 +450,12 @@ gen6_gs_visitor::emit_thread_<wbr>end()<br>
>        if (prog->info.has_transform_<wbr>feedback_varyings)<br>
>           xfb_write();<br>
>     }<br>
> -   emit(BRW_OPCODE_ENDIF);<br>
> -<br>
> +   enum { GEN5_ILK = 5 };<br>
> +   const bool common_eot_approach_can_be_<wbr>used = (devinfo->gen <<br>
> GEN5_ILK);<br>
<br>
devinfo->gen < 5 is fine, we do that everywhere in the driver.<br>
<br>
> +   if(common_eot_approach_can_be_<wbr>used)<br>
> +   {<br>
> +      emit(BRW_OPCODE_ENDIF);  <br>
> +   }<br>
>     /* Finally, emit EOT message.<br>
>      *<br>
>      * In gen6 we need to end the thread differently depending on<br>
> whether we have<br>
> @@ -463,8 +468,30 @@ gen6_gs_visitor::emit_thread_<wbr>end()<br>
>      * VUE handle every time we do a URB WRITE, even for the last<br>
> vertex we emit.<br>
>      * With this we make sure that whether we have emitted at least<br>
> one vertex<br>
>      * or none at all, we have to finish the thread without writing<br>
> to the URB,<br>
> -    * which works for both cases by setting the COMPLETE and UNUSED<br>
> flags in<br>
> +    * which works for both cases (but only under Pre-IL) by setting<br>
> the COMPLETE and UNUSED flags in<br>
>      * the EOT message.<br>
> +    * <br>
> +    * But under ILK or SNB we must not use combination COMPLETE and<br>
> UNUSED <br>
> +    * because this combination could be used only for already<br>
> allocated VUE. <br>
> +    * But unlike Pre-IL in the ILK and SNB the initial VUE is not<br>
> passed to threads. <br>
> +    * This behaver mentioned in specification: <br>
> +    * SNB (gen6) Spec:<br>
> <a href="https://01.org/sites/default/files/documentation/snb_ihd_os_vol2_part" rel="noreferrer" target="_blank">https://01.org/sites/default/<wbr>files/documentation/snb_ihd_<wbr>os_vol2_part</a><br>
> 1_0.pdf<br>
<br>
I think you can drop the URL, mentioning the specific section of the<br>
PRM with the relevant text is sufficient.<br>
<br>
> +    *    1.6.5.3 VUE Allocation (GS, CLIP) [DevIL]<br>
> +    *    1.6.5.4 VUE Allocation (GS) [DevSNB+]<br>
<br>
We usually write PRM citations with quotes.<br>
<br>
> +    *       The threads are not passed an initial handle.  <br>
> +    *       Instead, they request a first handle (if any) <br>
> +    *       via the URB shared function’s FF_SYNC message (see<br>
> Shared Functions). <br>
> +    *       If additional handles are required, <br>
> +    *       the URB_WRITE allocate mechanism (mentioned above) is<br>
> used. <br>
> +    * <br>
> +    * So for ILK and for SNB we must use only UNUSED flag.<br>
> +    * This is accepteble combination according to:<br>
> +    *    SNB (gen6) Spec: <a href="https://01.org/sites/default/files/documen" rel="noreferrer" target="_blank">https://01.org/sites/default/<wbr>files/documen</a><br>
> tation/snb_ihd_os_vol4_part2_<wbr>0.pdf<br>
> +    *       2.4.2 Message Descriptor<br>
> +    *          "Table lists the valid and invalid combinations of<br>
> the Complete, Used, Allocate and EOT bits"<br>
> +    *          "Thread terminate non-write of URB"<br>
> +    *    SNB (gen6) Spec: <a href="https://01.org/sites/default/files/documen" rel="noreferrer" target="_blank">https://01.org/sites/default/<wbr>files/documen</a><br>
> tation/snb_ihd_os_vol2_part1_<wbr>0.pdf<br>
> +    *       1.6.5.6 Thread Termination<br>
>      */<br>
<br>
Limit lines to 80 columns.<br>
<br>
>     this->current_annotation = "gen6 thread end: EOT";<br>
>  <br>
> @@ -480,8 +507,22 @@ gen6_gs_visitor::emit_thread_<wbr>end()<br>
>     inst->urb_write_flags = BRW_URB_WRITE_COMPLETE |<br>
> BRW_URB_WRITE_UNUSED;<br>
>     inst->base_mrf = base_mrf;<br>
>     inst->mlen = 1;<br>
> -}<br>
> +   <br>
> +   if(!common_eot_approach_can_<wbr>be_used)<br>
> +   {<br>
> +      emit(BRW_OPCODE_ELSE);<br>
> +      <br>
> +      this->current_annotation = "gen6 thread end: EOT";<br>
> +<br>
> +      vec4_instruction *unused_urb_inst =<br>
> emit(GS_OPCODE_THREAD_END);<br>
> +      unused_urb_inst->urb_write_<wbr>flags = BRW_URB_WRITE_UNUSED;<br>
> +      unused_urb_inst->base_mrf = base_mrf;<br>
> +      unused_urb_inst->mlen = 1;<br>
>  <br>
> +      emit(BRW_OPCODE_ENDIF);  <br>
> +   }<br>
> +}<br>
> +   <br>
>  void<br>
>  gen6_gs_visitor::setup_<wbr>payload()<br>
>  {<br>
</blockquote></div><br></div></div></div>