<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 14, 2018 at 2:39 PM, Chema Casanova <span dir="ltr"><<a href="mailto:jmcasanova@igalia.com" target="_blank">jmcasanova@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 14/06/18 03:02, Jason Ekstrand wrote:<br>
> On Sat, Jun 9, 2018 at 4:13 AM, Jose Maria Casanova Crespo<br>
</span><span class="">> <<a href="mailto:jmcasanova@igalia.com">jmcasanova@igalia.com</a> <mailto:<a href="mailto:jmcasanova@igalia.com">jmcasanova@igalia.com</a>><wbr>> wrote:<br>
> <br>
>     These new shuffle functions deal with the shuffle/unshuffle operations<br>
>     needed for read/write operations using 32-bit components when the<br>
>     read/written components have a different bit-size (8, 16, 64-bits).<br>
>     Shuffle from 32-bit to 32-bit becomes a simple MOV.<br>
> <br>
>     As the new function shuffle_src_to_dst takes of doing a shuffle or an<br>
>     unshuffle based on the different type_sz of source an destination this<br>
>     generic functions work with any source/destination assuming that writes<br>
>     use a 32-bit destination or reads use a 32-bit source.<br>
> <br>
> <br>
> I'm having a lot of trouble understanding this paragraph.  Would you<br>
> mind rephrasing it?<br>
>  <br>
<br>
</span>Sure, that English didn't compile:<br>
<br>
"shuffle_src_to_dst takes care of doing a shuffle when source type is<br>
smaller than destination type and an unshuffle when source type is<br>
bigger than destination. So this new read/write functions just need<br>
to call shuffle_src_to_dst assuming that writes use a 32-bit<br>
destination and reads use a 32-bit source."<br>
<br>
I included also this comment in the commit log:<br>
<br>
"As shuffle_for_32bit_write/from_<wbr>32bit_read components take components<br>
in unit of source/destination types and shuffle_src_to_dst takes units<br>
of the smallest type component we adjust the components and<br>
first_component parameters."<br><div><div class="h5"></div></div></blockquote><div><br></div><div>Those both look good.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
> <br>
>     To enable this new functions it is needed than there is no<br>
>     source/destination overlap in the case of shuffle_from_32bit_read.<br>
>     That never happens on shuffle_for_32bit_write as it allocates a new<br>
>     destination register as it was at shuffle_64bit_data_for_32bit_<wbr>write.<br>
>     ---<br>
>      src/intel/compiler/brw_fs.h       | 11 +++++++++<br>
>      src/intel/compiler/brw_fs_<wbr>nir.cpp | 38 ++++++++++++++++++++++++++++++<wbr>+<br>
>      2 files changed, 49 insertions(+)<br>
> <br>
>     diff --git a/src/intel/compiler/brw_fs.h b/src/intel/compiler/brw_fs.h<br>
>     index faf51568637..779170ecc95 100644<br>
>     --- a/src/intel/compiler/brw_fs.h<br>
>     +++ b/src/intel/compiler/brw_fs.h<br>
>     @@ -519,6 +519,17 @@ void shuffle_16bit_data_for_32bit_<wbr>write(const<br>
>     brw::fs_builder &bld,<br>
>                                              const fs_reg &src,<br>
>                                              uint32_t components);<br>
> <br>
>     +void shuffle_from_32bit_read(const brw::fs_builder &bld,<br>
>     +                             const fs_reg &dst,<br>
>     +                             const fs_reg &src,<br>
>     +                             uint32_t first_component,<br>
>     +                             uint32_t components);<br>
>     +<br>
>     +fs_reg shuffle_for_32bit_write(const brw::fs_builder &bld,<br>
>     +                               const fs_reg &src,<br>
>     +                               uint32_t first_component,<br>
>     +                               uint32_t components);<br>
>     +<br>
>      fs_reg setup_imm_df(const brw::fs_builder &bld,<br>
>                          double v);<br>
> <br>
>     diff --git a/src/intel/compiler/brw_fs_<wbr>nir.cpp<br>
>     b/src/intel/compiler/brw_fs_<wbr>nir.cpp<br>
>     index 1a9d3c41d1d..1f684149fd5 100644<br>
>     --- a/src/intel/compiler/brw_fs_<wbr>nir.cpp<br>
>     +++ b/src/intel/compiler/brw_fs_<wbr>nir.cpp<br>
>     @@ -5454,6 +5454,44 @@ shuffle_src_to_dst(const fs_builder &bld,<br>
>         }<br>
>      }<br>
> <br>
>     +void<br>
>     +shuffle_from_32bit_read(const fs_builder &bld,<br>
>     +                        const fs_reg &dst,<br>
>     +                        const fs_reg &src,<br>
>     +                        uint32_t first_component,<br>
>     +                        uint32_t components)<br>
>     +{<br>
>     +   assert(type_sz(src.type) == 4);<br>
>     +<br>
> <br>
> <br>
> /* This function takes components in units of the destination type while<br>
> shuffle_src_to_dst takes components in units of the smallest type */<br>
<br>
</div></div>Done.<br>
<span class=""><br>
>     +   if (type_sz(dst.type) > 4) {<br>
>     +      assert(type_sz(dst.type) == 8);<br>
>     +      first_component *= 2;<br>
>     +      components *= 2;<br>
>     +   }<br>
>     +<br>
>     +   shuffle_src_to_dst(bld, dst, src, first_component, components);<br>
>     +}<br>
>     +<br>
>     +fs_reg<br>
>     +shuffle_for_32bit_write(const fs_builder &bld,<br>
>     +                        const fs_reg &src,<br>
>     +                        uint32_t first_component,<br>
>     +                        uint32_t components)<br>
>     +{<br>
>     +   fs_reg dst = bld.vgrf(BRW_REGISTER_TYPE_D,<br>
>     +                         DIV_ROUND_UP (components *<br>
>     type_sz(src.type), 4));<br>
>     +<br>
> <br>
> <br>
> /* This function takes components in units of the source type while<br>
> shuffle_src_to_dst takes components in units of the smallest type */<br>
<br>
</span>Done.<br>
<span class=""><br>
> With those added and the commit message re-worded a bit,<br>
> <br>
> Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a><br>
</span>> <mailto:<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>>><br>
<br>
Thanks for the review.<br>
<br>
Chema<br>
<span class=""><br>
>     +   if (type_sz(src.type) > 4) {<br>
>     +      assert(type_sz(src.type) == 8);<br>
>     +      first_component *= 2;<br>
>     +      components *= 2;<br>
>     +   }<br>
>     +<br>
>     +   shuffle_src_to_dst(bld, dst, src, first_component, components);<br>
>     +<br>
>     +   return dst;<br>
>     +}<br>
>     +<br>
>      fs_reg<br>
>      setup_imm_df(const fs_builder &bld, double v)<br>
>      {<br>
>     -- <br>
>     2.17.1<br>
> <br>
>     ______________________________<wbr>_________________<br>
>     mesa-dev mailing list<br>
</span>>     <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a> <mailto:<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.<wbr>freedesktop.org</a>><br>
>     <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
>     <<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.<wbr>org/mailman/listinfo/mesa-dev</a>><br>
<div class="HOEnZb"><div class="h5">> <br>
> <br>
> <br>
> <br>
> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
> <br>
</div></div></blockquote></div><br></div></div>