Question about reduceOp #55
-
Hello, I don't understand why we have such constraint. I thought the conversion from triton.reduce to linalg.reduce is direct and we just need to copy the body to another.
We have seen cases like Issue #11, and from my understanding the ways to solve this problem are :
I appreciate your help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You're absolutely right that we can clone the body of tt.reduce to linalg.reduce directly, however this means we won't know what kind of reduce we're dealing with and therefore won't be able to generate the initial reduction values. Without pattern matching and choosing the correct initial values based on the ops' semantics, we have to use the first elements along the reduction axis and perform the reduction on the remaining elements. However, this results in creatings sub-tensors that aren't always multiple of 2s, which are sub-optimal for certain hardware. We're planning to propose a change to triton IR so that each reduce op has an enum or tag indicating what kind of reduction the op is (only for the common cases). This way we can support all the common cases without having to do error-pattern pattern matching. I hope this helps! |
Beta Was this translation helpful? Give feedback.
You're absolutely right that we can clone the body of tt.reduce to linalg.reduce directly, however this means we won't know what kind of reduce we're dealing with and therefore won't be able to generate the initial reduction values.
Without pattern matching and choosing the correct initial values based on the ops' semantics, we have to use the first elements along the reduction axis and perform the reduction on the remaining elements. However, this results in creatings sub-tensors that aren't always multiple of 2s, which are sub-optimal for certain hardware.
We're planning to propose a change to triton IR so that each reduce op has an enum or tag indicating what kind of reduction the op i…