<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Patches 1-5, 8-11, and 13-18 are</div><div class="gmail_quote"><br></div><div class="gmail_quote">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">On Mon, Oct 16, 2017 at 8:23 AM, Pohjolainen, Topi <span dir="ltr"><<a href="mailto:topi.pohjolainen@gmail.com" target="_blank">topi.pohjolainen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Mon, Oct 16, 2017 at 08:03:41AM -0700, Jason Ekstrand wrote:<br>
> FYI: I'm planning to review this some time this week.  Probably not today<br>
> though.<br>
<br>
</span>Great, I was hoping you would. I'm just reading out of curiosity and asking<br>
random questions. Mostly trying to remind myself how compiler works :) It has<br>
been a while since I had anything to do with it.<br>
<div class="m_2609201209543599080m_-8195904180398590224m_-6918157190168337084m_-5568321652175834147HOEnZb"><div class="m_2609201209543599080m_-8195904180398590224m_-6918157190168337084m_-5568321652175834147h5"><br>
><br>
> On Thu, Oct 12, 2017 at 11:37 AM, Jose Maria Casanova Crespo <<br>
> <a href="mailto:jmcasanova@igalia.com" target="_blank">jmcasanova@igalia.com</a>> wrote:<br>
><br>
> > Hello,<br>
> ><br>
> > this is the V3 series for the implementation of the<br>
> > SPV_KHR_16bit_storage and VK_KHR_16bit_storage extensions on the anv<br>
> > vulkan driver, in addition to the GLSL and NIR support needed.<br>
> ><br>
> > The original series can be found here [1], and the V2 is available<br>
> > here [2].<br>
> ><br>
> > In short V3 includes the following:<br>
> ><br>
> >  * Updates on several patches after the review of the V2 series.<br>
> >    This includes some squashes, and specially changes so 16-bit<br>
> >    types are always packed, not using stride 2 by default.<br>
> >    This implied a re-implementation of all load_input/store_output<br>
> >    intrinsics for 16-bit. New solution shuffles and unshuffles<br>
> >    16-bit components in 32-bit URB write and read operations. This<br>
> >    saves space in the URB writes and reduces the register pressure<br>
> >    just using half of the space.<br>
> ><br>
> > * 5 patches have been removed from v2 series because now we not<br>
> >    assume the stride 2 for 16-bit registers. We also removed the<br>
> >    patch of reuse_16bit_conversion_registe<wbr>r. The problems related<br>
> >    to spilling that motivate that patch were better addressed by<br>
> >    Curro's liveness patch.<br>
> ><br>
> >    i965/fs: Set stride 2 when dealing with 16-bit floats/ints<br>
> >    i965/fs: Retype 16-bit/stride2 movs to UD on nir_op_vecX<br>
> >    i965/fs: Need to allocate as minimum 32-bit register<br>
> >    i965/fs: Update assertion on copy propagation<br>
> >    i965/fs: Add reuse_16bit_conversions_regist<wbr>er optimization<br>
> ><br>
> > Finally an updated overview of the patches:<br>
> ><br>
> > Patches 1-2 add 16-bit float, int and uint types to GLSL. This is<br>
> > needed because NIR uses GLSL types internally. We use the enums<br>
> > already defined at AMD_gpu_shader_half_float and NV_gpu_shader<br>
> > extensions. Patch 4 updates mesa/st, in order to avoid warnings for<br>
> > types not handled on a switch.<br>
> ><br>
> > Patches 3-6 add NIR support for those new GLSL 16-bit types,<br>
> > conversion opcodes, and rounding modes for float to half-float<br>
> > conversions.<br>
> ><br>
> > Patches 7-9 add the SPIR-V (SPV_KHR_16bit_storage) to NIR support.<br>
> ><br>
> > Patches 10-13 add general 16-bit support for i965. This includes<br>
> > handling of new types on several general purpose methods,<br>
> > update/remove some asserts.<br>
> ><br>
> > Patches 14-18 add support for 32 to 16-bit conversions for i965,<br>
> > including rounding mode opcodes (needed for float to half-float<br>
> > conversions), and an optimization that removes superfluous rounding<br>
> > mode sets.<br>
> ><br>
> > Patch 19 adds 16-bit support for constant location.<br>
> ><br>
> > Patches 20-24 add and use two new messages: byte scattered read and<br>
> > write. Those were needed because untyped surface message has a fixed<br>
> > 32-bit write size. Those messages are used on the 16-bit support of<br>
> > store SSBO, load SSBO, load UBO and load shared.<br>
> ><br>
> > Patches 25-29 implement 16-bit vertex attribute inputs support on<br>
> > i965. These include changes on anv. This was needed because 16-bit<br>
> > surface formats do implicit conversion to 32-bit. To workaround this,<br>
> > we override the 16-bit surface format, and use 32-bit ones.<br>
> ><br>
> > Patch 30 implements load input and load store for all intra stage.<br>
> > This patch substitutes the previous simple patch i965/fs: Set stride 2<br>
> > when dealing with 16-bit floats/ints.<br>
> ><br>
> > Patch 31-37 implements 16-bit store output support for fragment<br>
> > shaders on i965.<br>
> ><br>
> > Patches 38-41 are the new patches included in V2. Three of them are<br>
> > improvements over V1 that doesn't fix any execution problem, but they<br>
> > improve performance reducing the use of multiple scattered messages<br>
> > for untyped read/write opreations. 16bit CTS tests passes without them.<br>
> > The other one would fix a real problem (patch 41), but unfourtunately<br>
> > no CTS test yet catching it.<br>
> ><br>
> > Patches 42-43 enable both extensions on anv vulkan driver.<br>
> ><br>
> > [1] <a href="https://lists.freedesktop.org/archives/mesa-dev/2017-July/162791.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>archives/mesa-dev/2017-July/16<wbr>2791.html</a><br>
> > [2] <a href="https://lists.freedesktop.org/archives/mesa-dev/2017-August/" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>archives/mesa-dev/2017-August/</a><br>
> > 167455.html<br>
> ><br>
> > Alejandro Piñeiro (14):<br>
> >   i965/vec4: Handle 16-bit types at type_size_xvec4<br>
> >   i965/fs: Add brw_reg_type_from_bit_size utility method<br>
> >   i965/fs: Remove BRW_REGISTER_TYPE_HF assert at get_exec_type<br>
> >   i965/fs: Handle 32-bit to 16-bit conversions<br>
> >   i965/fs: Define new shader opcode to set rounding modes<br>
> >   i965/fs: Enable rounding mode on f2f16 ops<br>
> >   i965/fs: Add remove_extra_rounding_modes optimization<br>
> >   i965/fs: Adjust type_size/type_slots on store_ssbo<br>
> >   i965/fs: Use byte_scattered_write on 16-bit store_ssbo<br>
> >   anv/pipeline: Use 32-bit surface formats for 16-bit formats<br>
> >   anv/cmd_buffer: Add a padding to the vertex buffer<br>
> >   i965/fs: Use half_precision data_format on 16-bit fb writes<br>
> >   i965/fs: Predicate byte scattered writes if needed<br>
> >   anv: Enable VK_KHR_16bit_storage<br>
> ><br>
> > Eduardo Lima Mitev (8):<br>
> >   glsl: Add 16-bit types<br>
> >   mesa/st: Handle 16-bit types at st_glsl_storage_type_size()<br>
> >   nir: Add support for 16-bit types (half float, int16 and uint16)<br>
> >   nir: Populate conversion opcodes to/from 16-bit types<br>
> >   spirv/nir: Handle 16-bit types<br>
> >   spirv/nir: Add support for SPV_KHR_16bit_storage<br>
> >   i965/fs: Optimize 16-bit SSBO stores by packing two into a 32-bit reg<br>
> >   anv: Enable SPV_KHR_16bit_storage on gen 8+<br>
> ><br>
> > Jose Maria Casanova Crespo (21):<br>
> >   nir: Add rounding modes enum<br>
> >   nir: Handle fp16 rounding modes at nir_type_conversion_op<br>
> >   spirv: Enable FPRoundingMode decorator to nir operations<br>
> >   i965: Support for 16-bit base types in helper functions<br>
> >   i965: Add support for control register<br>
> >   i965/fs: Support push constants of 16-bit types<br>
> >   i965/fs: Add byte scattered write message and fs support<br>
> >   i965/fs: Add byte scattered read message and fs support<br>
> >   i965/fs: Use byte scattered read<br>
> >   compiler: Mark when input/ouput attribute at VS uses 16-bit<br>
> >   i965/compiler: includes 16-bit vertex input<br>
> >   i965/fs: Unpack 16-bit from 32-bit components in VS load_input<br>
> >   i965/fs: Support 16-bit types at load_input and store_output<br>
> >   i965/fs: Enable Render Target Write for 16-bit outputs<br>
> >   i965/fs: Include support for SEND data_format bit for Render Targets<br>
> >   i965/disasm: Show half-precision data_format on rt_writes<br>
> >   i965/fs: Mark 16-bit outputs on FS store_output<br>
> >   i965/fs: 16-bit source payloads always use 1 register<br>
> >   i965/fs: Enable 16-bit render target write on SKL and CHV<br>
> >   i965/fs: Enables 16-bit load_ubo with sampler<br>
> >   i965/fs: Use untyped_surface_read for 16-bit load_ssbo<br>
> ><br>
> >  src/compiler/builtin_type_macr<wbr>os.h              |  26 ++<br>
> >  src/compiler/glsl/ast_to_hir.c<wbr>pp                |   3 +<br>
> >  src/compiler/glsl/glsl_to_nir.<wbr>cpp               |   9 +-<br>
> >  src/compiler/glsl/ir_clone.cpp<wbr>                  |   3 +<br>
> >  src/compiler/glsl/link_uniform<wbr>_initializers.cpp |   3 +<br>
> >  src/compiler/glsl/lower_buffer<wbr>_access.cpp       |   3 +-<br>
> >  src/compiler/glsl_types.cpp                     |  93 ++++-<br>
> >  src/compiler/glsl_types.h                       |  34 +-<br>
> >  src/compiler/nir/nir.c                          |   6 +<br>
> >  src/compiler/nir/nir.h                          |  22 +-<br>
> >  src/compiler/nir/nir_gather_in<wbr>fo.c              |  23 +-<br>
> >  src/compiler/nir/nir_opcodes.p<wbr>y                 |  10 +-<br>
> >  src/compiler/nir/nir_opcodes_c<wbr>.py               |  17 +-<br>
> >  src/compiler/nir/nir_split_var<wbr>_copies.c         |   6 +<br>
> >  src/compiler/nir_types.cpp                      |  24 ++<br>
> >  src/compiler/nir_types.h                        |   9 +<br>
> >  src/compiler/shader_info.h                      |   2 +<br>
> >  src/compiler/spirv/nir_spirv.h<wbr>                  |   1 +<br>
> >  src/compiler/spirv/spirv_to_ni<wbr>r.c               |  53 ++-<br>
> >  src/compiler/spirv/vtn_alu.c                    |  34 +-<br>
> >  src/compiler/spirv/vtn_variabl<wbr>es.c              |  21 ++<br>
> >  src/intel/compiler/brw_compile<wbr>r.h               |   1 +<br>
> >  src/intel/compiler/brw_disasm.<wbr>c                 |   4 +<br>
> >  src/intel/compiler/brw_eu.h                     |  23 +-<br>
> >  src/intel/compiler/brw_eu_defi<wbr>nes.h             |  36 ++<br>
> >  src/intel/compiler/brw_eu_emit<wbr>.c                | 188 +++++++++-<br>
> >  src/intel/compiler/brw_fs.cpp                   | 128 ++++++-<br>
> >  src/intel/compiler/brw_fs.h                     |  12 +<br>
> >  src/intel/compiler/brw_fs_copy<wbr>_propagation.cpp  |   8 +-<br>
> >  src/intel/compiler/brw_fs_gene<wbr>rator.cpp         |  28 +-<br>
> >  src/intel/compiler/brw_fs_nir.<wbr>cpp               | 458<br>
> > ++++++++++++++++++++++--<br>
> >  src/intel/compiler/brw_fs_surf<wbr>ace_builder.cpp   |  32 +-<br>
> >  src/intel/compiler/brw_fs_surf<wbr>ace_builder.h     |  14 +<br>
> >  src/intel/compiler/brw_fs_visi<wbr>tor.cpp           |   6 +<br>
> >  src/intel/compiler/brw_inst.h                   |   1 +<br>
> >  src/intel/compiler/brw_ir_fs.h<wbr>                  |   3 -<br>
> >  src/intel/compiler/brw_nir.c                    |  16 +<br>
> >  src/intel/compiler/brw_reg.h                    |   6 +<br>
> >  src/intel/compiler/brw_shader.<wbr>cpp               |  23 ++<br>
> >  src/intel/compiler/brw_shader.<wbr>h                 |   7 +<br>
> >  src/intel/compiler/brw_vec4.cp<wbr>p                 |   1 +<br>
> >  src/intel/compiler/brw_vec4_ge<wbr>nerator.cpp       |   3 +-<br>
> >  src/intel/compiler/brw_vec4_vi<wbr>sitor.cpp         |   3 +<br>
> >  src/intel/vulkan/anv_device.c                   |  13 +<br>
> >  src/intel/vulkan/anv_extension<wbr>s.py              |   1 +<br>
> >  src/intel/vulkan/anv_pipeline.<wbr>c                 |   1 +<br>
> >  src/intel/vulkan/genX_cmd_buff<wbr>er.c              |  20 +-<br>
> >  src/intel/vulkan/genX_pipeline<wbr>.c                |  47 +++<br>
> >  src/mesa/program/ir_to_mesa.cp<wbr>p                 |   6 +<br>
> >  src/mesa/state_tracker/st_glsl<wbr>_types.cpp        |   3 +<br>
> >  50 files changed, 1403 insertions(+), 91 deletions(-)<br>
> ><br>
> > --<br>
> > 2.13.6<br>
> ><br>
> > ______________________________<wbr>_________________<br>
> > mesa-dev mailing list<br>
> > <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">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>
<br>
> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">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>