Repository navigation
[compiler] remove uses of memref::ExpandOps pass - #21113
Merged
Merged
Conversation
This pass currently performs two rewrites: 1. *incorrectly* rewrite `atomic_rmw` for floating-point min/max, see #21101; 2. rewrite `reshape` into `reinterpret_cast`. The rewrite 1 was added years ago, prior to LLVM IR supporting floating-point atomics sufficiently and is no longer necessary. I will remove it upstream anyway. The rewrite 2 looks like a canonicalizaiton and it is unclear why it was put into a separate pass, it will likely not remain there. It may have some minor effect on performance if this rewrite is important to simplify address computation, at which point it belongs to the set of canonicalization patterns. In general, I highly suspect that the usage of this pass was either cargo-culted from existing sub-pipelines or confused with `--expand-strided-metadata`, which is both necessary for lowering and beneficial for address computation performance. Signed-off-by: Alex Zinenko <[email protected]>
ftynse
requested review from
Groverkss,
MaheshRavishankar,
antiagainst,
benvanik,
hanhanW,
kuhar,
pashu123 and
qedawkins
as code owners
June 17, 2025 11:03
Contributor
Author
|
If somebody knows whether the |
qedawkins
approved these changes
Jun 17, 2025
qedawkins
left a comment
Contributor
There was a problem hiding this comment.
I believe all cases where we need reshape/subview -> reinterpret_cast happen in memref-expand-strided-metadata. And if that's not the case, we should change that to be true, so this makes sense to me.
Contributor
Author
|
AFAICS, IREE is not using |
Contributor
|
Oh, by reshape I thought you meant expand/collapse. Yes, we don't use reshape anywhere so should be good to drop. |
hanhanW
approved these changes
Jun 17, 2025
krzysz00
approved these changes
Jun 17, 2025
AWoloszyn
pushed a commit
that referenced
this pull request
Dec 1, 2025
This pass currently performs two rewrites: 1. *incorrectly* rewrite `atomic_rmw` for floating-point min/max, see #21101; 2. rewrite `reshape` into `reinterpret_cast`. The rewrite 1 was added years ago, prior to LLVM IR supporting floating-point atomics sufficiently and is no longer necessary. I will remove it upstream anyway. The rewrite 2 looks like a canonicalizaiton and it is unclear why it was put into a separate pass, it will likely not remain there. It may have some minor effect on performance if this rewrite is important to simplify address computation, at which point it belongs to the set of canonicalization patterns. In general, I highly suspect that the usage of this pass was either cargo-culted from existing sub-pipelines or confused with `--expand-strided-metadata`, which is both necessary for lowering and beneficial for address computation performance. Signed-off-by: Alex Zinenko <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pass currently performs two rewrites:
atomic_rmwfor floating-point min/max, see ROCDL lowering generates invalid IR for memref.atomic_rmw maximumf #21101;reshapeintoreinterpret_cast.The rewrite 1 was added years ago, prior to LLVM IR supporting floating-point atomics sufficiently and is no longer necessary. I will remove it upstream anyway.
The rewrite 2 looks like a canonicalizaiton and it is unclear why it was put into a separate pass, it will likely not remain there. It may have some minor effect on performance if this rewrite is important to simplify address computation, at which point it belongs to the set of canonicalization patterns.
In general, I highly suspect that the usage of this pass was either cargo-culted from existing sub-pipelines or confused with
--expand-strided-metadata, which is both necessary for lowering and beneficial for address computation performance.