intel/mlir-extensions

Add more arith operation optimization in SPIRV dialect

Closed this issue · 6 comments

We need the more arith operation optimization in SPIRV dialect.
This is a comprehensive requirements to the canonicalize the arith operation in SPIRV dialect. Like "x % 0 -> 0", "x / 1 -> x"

This is not blocking Triton funcion. But it would very helpful for us to understand the simplified generated IR and then to debug.

This is a Triton requirements memo.

@chengjunlu , could you elaborate on detailed tasks here? Just like add more todos as follows.

  • A
  • B
  • C

fold pattern:

  1. rem:
B = A % 32
C = B % 8
->
C = A % 8

B = A % 1
->
B = 0

B = A % 32
C = B % 8
->
C = A % 8

this can only work if the numbers are multiples of each other (eg: 32 and 8)...this is not a generic pattern.
@chengjunlu

B = A % 32 C = B % 8 -> C = A % 8

this can only work if the numbers are multiples of each other (eg: 32 and 8)...this is not a generic pattern. @chengjunlu

This can help a lot in Index To Offset calculation in Triton

ok, the patch for this got merged upstream
https://reviews.llvm.org/D152341

Merged upstream