This is an archive of the discontinued LLVM Phabricator instance.

Add linalg.fill canonicalization pattern for tensor.extract
ClosedPublic

Authored by suryajasper on Jul 21 2023, 6:03 PM.

Diff Detail

Event Timeline

suryajasper created this revision.Jul 21 2023, 6:03 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 21 2023, 6:03 PM
suryajasper requested review of this revision.Jul 21 2023, 6:03 PM
suryajasper retitled this revision from WIP: Added test mlir to Added linalg.fill canonicalization pattern for tensor.extract.
suryajasper edited the summary of this revision. (Show Details)

Added the initial canonicalization pattern (mozphab issues with first submission)

antiagainst requested changes to this revision.Jul 26 2023, 5:13 PM
antiagainst added inline comments.
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
639

Can we add some tests in test/Dialect/Linalg/canonicalize.mlir for this pattern?

647

No wrapping { } per LLVM coding style.

655

We don't need to perform extension here as fill then extract shouldn't change the element type anyway. Also, it's not guaranteed that the element types would be floating point.

This revision now requires changes to proceed.Jul 26 2023, 5:13 PM
suryajasper planned changes to this revision.Jul 26 2023, 6:13 PM
suryajasper updated this revision to Diff 544570.
suryajasper retitled this revision from Added linalg.fill canonicalization pattern for tensor.extract to WIP: Added test mlir.
suryajasper edited the summary of this revision. (Show Details)
suryajasper retitled this revision from WIP: Added test mlir to Add linalg.fill canonicalization pattern for tensor.extract .Jul 26 2023, 6:13 PM
antiagainst requested changes to this revision.Jul 26 2023, 6:42 PM
antiagainst added inline comments.
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
637–638

We need to register this pattern to getCanonicalizationPatterns.

637–638

Could you capitalize each sentence and close with a .? Also for other comments.

mlir/test/Dialect/Linalg/canonicalize.mlir
341

Can we make this as an input to the function?

353

We need to check that we are returning the scalar value.

suryajasper planned changes to this revision.Jul 27 2023, 3:51 PM
suryajasper updated this revision to Diff 544971.
suryajasper retitled this revision from Add linalg.fill canonicalization pattern for tensor.extract to WIP: Format changes + test fixes based on PR review.
suryajasper edited the summary of this revision. (Show Details)
suryajasper retitled this revision from WIP: Format changes + test fixes based on PR review to Add linalg.fill canonicalization pattern for tensor.extract .Jul 27 2023, 3:51 PM
antiagainst added inline comments.Aug 1 2023, 9:54 AM
mlir/test/Dialect/Linalg/canonicalize.mlir
354–355

Have you tried to run the tests? I don't think we will see this in the transformed IR and so this won't pass?

354–355

For this line too.

suryajasper requested review of this revision.Aug 1 2023, 9:55 AM
suryajasper marked 7 inline comments as done.

Requesting review after addressing revision comments

mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
637–638

It has been registered already. That change was in the previous diff, so it's included in the full expanded source here

suryajasper marked an inline comment as done.
suryajasper retitled this revision from Add linalg.fill canonicalization pattern for tensor.extract to Add linalg.fill canonicalization pattern for tensor.extract.

Fixed FileCheck prompts for test mlir

Ah, I think you only uploaded the last commit?? Can we squash all your local commits into one and reupload it so I can see the full patch? Just make sure the commit message contains "Differential Revision: https://reviews.llvm.org/D156008" when you upload

antiagainst requested changes to this revision.Aug 1 2023, 8:48 PM
This revision now requires changes to proceed.Aug 1 2023, 8:48 PM
suryajasper marked 2 inline comments as done.

Squashed prior commits for review

Squashed prior commits for review (fixed commit message)

antiagainst accepted this revision.Aug 4 2023, 9:22 AM
This revision is now accepted and ready to land.Aug 4 2023, 9:22 AM
This revision was landed with ongoing or failed builds.Aug 4 2023, 9:34 AM
This revision was automatically updated to reflect the committed changes.