<div dir="ltr">Ugh... This should not be 29 patches.  I used the wrong base.  The real series starts at "nir/algebraic: Optimize x2b(xneg(a)) -> a"</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Dec 6, 2018 at 1:45 PM Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is a v2 of my series to switch NIR over to 1-bit Booleans.  The first<br>
version of the series can be found here:<br>
<br>
<a href="https://patchwork.freedesktop.org/series/51351/" rel="noreferrer" target="_blank">https://patchwork.freedesktop.org/series/51351/</a><br>
<br>
Since then, a bit of work has been done on NIR to make the transition a bit<br>
smoother.  Connor rewrote the entire bit-size inference infrastructure in<br>
nir_algebraic.py to be more dynamic and accurate.  On top of that, I<br>
reworked x2b conversions to work like other conversions and have a sized<br>
destination instead of having a fixed size on the source and unsized<br>
destination.  This means that switching to 1-bit booleans doesn't involve<br>
those weird b322x opcodes that were in the first version.  A few of the<br>
patches from the first version have also landed in the intervening time.<br>
<br>
Shader-db results on Kaby Lake for the entire series:<br>
<br>
    total instructions in shared programs: 15072525 -> 14977978 (-0.63%)<br>
    instructions in affected programs: 1178699 -> 1084152 (-8.02%)<br>
    helped: 2126<br>
    HURT: 14<br>
<br>
    total cycles in shared programs: 369737290 -> 359790175 (-2.69%)<br>
    cycles in affected programs: 127174789 -> 117227674 (-7.82%)<br>
    helped: 2020<br>
    HURT: 325<br>
<br>
    total loops in shared programs: 4401 -> 4401 (0.00%)<br>
    loops in affected programs: 0 -> 0<br>
    helped: 0<br>
    HURT: 0<br>
<br>
    total spills in shared programs: 10158 -> 10051 (-1.05%)<br>
    spills in affected programs: 1429 -> 1322 (-7.49%)<br>
    helped: 8<br>
    HURT: 15<br>
<br>
    total fills in shared programs: 22105 -> 21732 (-1.69%)<br>
    fills in affected programs: 2532 -> 2159 (-14.73%)<br>
    helped: 9<br>
    HURT: 15<br>
<br>
I've tried, by adding a lowering pass and enabling it, to ensure that this<br>
series doesn't break anyone's drivers.  However, as with any other core NIR<br>
rework, please test.  I don't have the capability to really test anything<br>
other than Intel.<br>
<br>
Cc: Connor Abbott <<a href="mailto:cwabbott0@gmail.com" target="_blank">cwabbott0@gmail.com</a>><br>
Cc: Timothy Arceri <<a href="mailto:tarceri@itsqueeze.com" target="_blank">tarceri@itsqueeze.com</a>><br>
Cc: Eric Anholt <<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>><br>
Cc: Rob Clark <<a href="mailto:robdclark@gmail.com" target="_blank">robdclark@gmail.com</a>><br>
Cc: Karol Herbst <<a href="mailto:karolherbst@gmail.com" target="_blank">karolherbst@gmail.com</a>><br>
Cc: Bas Nieuwenhuizen <<a href="mailto:bas@basnieuwenhuizen.nl" target="_blank">bas@basnieuwenhuizen.nl</a>><br>
<br>
Jason Ekstrand (28):<br>
  nir/opcodes: Pull in the type helpers from constant_expressions<br>
  nir/opcodes: Rename tbool to tbool32<br>
  nir/algebraic: Clean up some __str__ cruft<br>
  nir/algebraic: Refactor codegen a bit<br>
  nir/algebraic: Add support for unsized conversion opcodes<br>
  nir/opt_algebraic: Simplify an optimization using the new search ops<br>
  nir/opt_algebraic: Drop bit-size suffixes from conversions<br>
  nir/opt_algebraic: Add 32-bit specifiers to a bunch of booleans<br>
  nir: Make boolean conversions sized just like the others<br>
  nir/algebraic: Optimize x2b(xneg(a)) -> a<br>
  nir: Drop support for lower_b2f<br>
  nir/algebraic: Make an optimization more specific<br>
  nir: Rename Boolean-related opcodes to include 32 in the name<br>
  FIXUP: nir/builder: Generate 32-bit bool opcodes transparently<br>
  FIXUP: nir/algebraic: Remap Boolean opcodes to the 32-bit variant<br>
  FIXUP: Use 32-bit opcodes in the NIR producers and optimizations<br>
  FIXUP: Use 32-bit opcodes in the NIR back-ends<br>
  nir/constant_expressions: Rework Boolean handling<br>
  nir: Add support for 1-bit data types<br>
  nir/large_constants: Properly handle 1-bit bools<br>
  nir/algebraic: Generalize an optimization<br>
  nir: Add 1-bit Boolean opcodes<br>
  nir: Add a bool to int32 lowering pass<br>
  glsl,spirv: Generate 1-bit Booleans<br>
  FIXUP: Revert "Use 32-bit opcodes in the NIR producers and<br>
    optimizations"<br>
  FIXUP: Revert "nir/builder: Generate 32-bit bool opcodes<br>
    transparently"<br>
  FIXUP: nir/builder: Generate 1-bit Booleans in nir_build_imm_bool<br>
  nir/algebraic: Optimize 1-bit Booleans<br>
  nir/algebraic: Add some optimizations for D3D-style Booleans<br>
<br>
 src/amd/common/ac_nir_to_llvm.c               |  34 +--<br>
 src/amd/vulkan/radv_shader.c                  |   2 +<br>
 src/broadcom/compiler/nir_to_vir.c            |  52 ++---<br>
 src/broadcom/compiler/vir.c                   |   2 +<br>
 src/compiler/Makefile.sources                 |   1 +<br>
 src/compiler/glsl/glsl_to_nir.cpp             |  17 +-<br>
 src/compiler/nir/meson.build                  |   1 +<br>
 src/compiler/nir/nir.c                        |  15 +-<br>
 src/compiler/nir/nir.h                        |  31 +--<br>
 src/compiler/nir/nir_algebraic.py             |  84 ++++++--<br>
 src/compiler/nir/nir_builder.h                |  28 ++-<br>
 src/compiler/nir/nir_constant_expressions.py  |  74 +++----<br>
 src/compiler/nir/nir_instr_set.c              |  23 +-<br>
 src/compiler/nir/nir_lower_alu_to_scalar.c    |   4 +<br>
 src/compiler/nir/nir_lower_bool_to_int32.c    | 160 ++++++++++++++<br>
 src/compiler/nir/nir_lower_idiv.c             |   2 +-<br>
 src/compiler/nir/nir_lower_int64.c            |   2 +-<br>
 .../nir/nir_lower_load_const_to_scalar.c      |   3 +<br>
 src/compiler/nir/nir_opcodes.py               |  98 ++++++---<br>
 src/compiler/nir/nir_opcodes_c.py             |  41 ++--<br>
 src/compiler/nir/nir_opt_algebraic.py         | 215 +++++++++---------<br>
 src/compiler/nir/nir_opt_constant_folding.c   |   3 +<br>
 src/compiler/nir/nir_opt_if.c                 |   2 +-<br>
 src/compiler/nir/nir_opt_large_constants.c    |  14 +-<br>
 src/compiler/nir/nir_print.c                  |   3 +<br>
 src/compiler/nir/nir_search.c                 | 114 +++++++++-<br>
 src/compiler/nir/nir_search.h                 |  17 +-<br>
 src/compiler/nir/nir_validate.c               |   2 +-<br>
 src/compiler/nir_types.cpp                    |   2 +-<br>
 src/compiler/nir_types.h                      |   4 +-<br>
 src/compiler/spirv/spirv_to_nir.c             |  11 +-<br>
 src/compiler/spirv/vtn_glsl450.c              |   4 +-<br>
 src/freedreno/ir3/ir3_compiler_nir.c          |  34 +--<br>
 src/gallium/auxiliary/nir/tgsi_to_nir.c       |  20 +-<br>
 src/gallium/drivers/radeonsi/si_shader_nir.c  |   2 +<br>
 src/gallium/drivers/vc4/vc4_program.c         |  50 ++---<br>
 src/intel/compiler/brw_fs_nir.cpp             |  85 ++++----<br>
 src/intel/compiler/brw_nir.c                  |   2 +<br>
 .../brw_nir_analyze_boolean_resolves.c        |  24 +--<br>
 src/intel/compiler/brw_vec4_nir.cpp           | 123 +++++------<br>
 src/mesa/program/prog_to_nir.c                |   4 +-<br>
 41 files changed, 927 insertions(+), 465 deletions(-)<br>
 create mode 100644 src/compiler/nir/nir_lower_bool_to_int32.c<br>
<br>
-- <br>
2.19.2<br>
<br>
</blockquote></div>