Repository navigation
[LinalgExt] support converting argcompare to loops. - #21138
Conversation
4b3105a to
1a3f162
Compare
Signed-off-by: Bangtian Liu <[email protected]>
1a3f162 to
2af8044
Compare
Signed-off-by: Bangtian Liu <[email protected]>
Signed-off-by: Bangtian Liu <[email protected]>
Signed-off-by: Bangtian Liu <[email protected]>
bd597b7 to
60a00a6
Compare
There was a problem hiding this comment.
LGTM but I don't have enough context on codegen to know if the scf.if is going to be problematic.
It looks possible to move it out of the loop but the memref.load might make that difficult (could be solved by duplicating/cloning into both the "then" and "else" regions when building the op).
Thanks for your suggestion. but how about the case in which the reduction dim is not innermost? |
I don't think it works because |
|
We need to add an end-to-end test for this. Even if it runs just on CPU. Its not a requirement for this PR, but really that is the only way to know this is all correct? |
MaheshRavishankar
left a comment
There was a problem hiding this comment.
Think there is a mistake here.
MaheshRavishankar
left a comment
There was a problem hiding this comment.
(damn github, let me say request changes please!)
Sure, I'll look into adding end-to-end tests in this PR. |
Signed-off-by: Bangtian Liu <[email protected]>
|
@MaheshRavishankar It looks like the e2e test requires the tiling interface to be in place. Perhaps we can land this PR first, and if any issues arise, I’ll follow up with a separate fix. |
On top of #21106. This PR Adds `generateScalarImplementation` for ArgCompareOp, defining the scalar behavior within the innermost loop during loop lowering. The lowering performs the following: - Loads the current best value and corresponding index (accumulator) from the output tensor. - Loads the candidate value at the current loop indices. - Invokes the provided comparator region (T a, T b) -> i1 to compare values. - Selects the new best value and index based on the comparison result. - Supports an optional index_base operand, which is added to the computed index before storing. Next, will add tiling support. --------- Signed-off-by: Bangtian Liu <[email protected]>
…de (#23193) This PR extends the tiling interface implementation for `ArgCompareOp` to support explicit-index mode (2 inputs: value + pre-computed indices), which was introduced in PR #23153. **Key changes:** - Extended `getTiledImplementation` (introduced in PR #21077) to slice both value and index inputs in explicit-index mode - Extended `generateScalarImplementation` (convert_to_loops) (introduced in PR #21138) to load indices from input instead of computing from iteration variables in explicit-index mode Signed-off-by: Bangtian Liu <[email protected]>
…de (#23193) This PR extends the tiling interface implementation for `ArgCompareOp` to support explicit-index mode (2 inputs: value + pre-computed indices), which was introduced in PR #23153. **Key changes:** - Extended `getTiledImplementation` (introduced in PR #21077) to slice both value and index inputs in explicit-index mode - Extended `generateScalarImplementation` (convert_to_loops) (introduced in PR #21138) to load indices from input instead of computing from iteration variables in explicit-index mode Signed-off-by: Bangtian Liu <[email protected]> Signed-off-by: Keshav Vinayak Jha <[email protected]>
…de (iree-org#23193) This PR extends the tiling interface implementation for `ArgCompareOp` to support explicit-index mode (2 inputs: value + pre-computed indices), which was introduced in PR iree-org#23153. **Key changes:** - Extended `getTiledImplementation` (introduced in PR iree-org#21077) to slice both value and index inputs in explicit-index mode - Extended `generateScalarImplementation` (convert_to_loops) (introduced in PR iree-org#21138) to load indices from input instead of computing from iteration variables in explicit-index mode Signed-off-by: Bangtian Liu <[email protected]>
On top of #21106.
This PR Adds
generateScalarImplementationfor ArgCompareOp, defining the scalar behavior within the innermost loop during loop lowering.The lowering performs the following:
Next, will add tiling support.