nir: Teach loop unrolling about 64-bit instruction lowering
authorJason Ekstrand <jason.ekstrand@intel.com>
Sun, 3 Mar 2019 15:24:12 +0000 (09:24 -0600)
committerJason Ekstrand <jason@jlekstrand.net>
Wed, 6 Mar 2019 17:24:57 +0000 (17:24 +0000)
commit9314084237d50e109ab575fca8696da28cf76798
tree4ffb0eba1ec842190acdcb03a38bc73a95c8ffe6
parentebb3695376499c276d4e1508836ce6b38faf1390
nir: Teach loop unrolling about 64-bit instruction lowering

The lowering we do for 64-bit instructions can cause a single NIR ALU
instruction to blow up into hundreds or thousands of instructions
potentially with control flow.  If loop unrolling isn't aware of this,
it can unroll a loop 20 times which contains a nir_op_fsqrt which we
then lower to a full software implementation based on integer math.
Those 20 invocations suddenly get a lot more expensive than NIR loop
unrolling currently expects.  By giving it an approximate estimate
function, we can prevent loop unrolling from going to town when it
shouldn't.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/compiler/nir/nir.h
src/compiler/nir/nir_loop_analyze.c
src/compiler/nir/nir_opt_loop_unroll.c