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>
This commit is contained in:

committed by
Jason Ekstrand

parent
ebb3695376
commit
9314084237
@@ -564,7 +564,7 @@ is_loop_small_enough_to_unroll(nir_shader *shader, nir_loop_info *li)
|
||||
return true;
|
||||
|
||||
bool loop_not_too_large =
|
||||
li->num_instructions * li->max_trip_count <= max_iter * LOOP_UNROLL_LIMIT;
|
||||
li->instr_cost * li->max_trip_count <= max_iter * LOOP_UNROLL_LIMIT;
|
||||
|
||||
return loop_not_too_large;
|
||||
}
|
||||
|
Reference in New Issue
Block a user