Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[mlir][vector] Remove remaining bitwidths from linearization patterns #138072

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 1, 2025

Conversation

newling
Copy link
Contributor

@newling newling commented May 1, 2025

In #136581 the bitwidth logic was supposed to be completely removed from the linearization patterns. But it was left in a few places. This PR removes the remainders (they were default valued constructor arguments that were unused).

Copy link

github-actions bot commented May 1, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@llvmbot
Copy link
Member

llvmbot commented May 1, 2025

@llvm/pr-subscribers-mlir-vector

@llvm/pr-subscribers-mlir

Author: James Newling (newling)

Changes

In #136581 the bitwidth logic was supposed to be completely removed from the linearization patterns. But it was left in a few places. This PR removes the remainders (they were default valued constructor arguments that were unused).


Full diff: https://github.com/llvm/llvm-project/pull/138072.diff

1 Files Affected:

  • (modified) mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp (+8-17)
diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp
index 67e15852dc5ea..b9fdede535112 100644
--- a/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp
@@ -21,7 +21,6 @@
 #include "mlir/Transforms/DialectConversion.h"
 #include "llvm/ADT/ArrayRef.h"
 #include <cstdint>
-#include <limits>
 #include <numeric>
 #include <optional>
 
@@ -230,10 +229,8 @@ struct LinearizeVectorExtractStridedSlice final
 struct LinearizeVectorShuffle final
     : public OpConversionPattern<vector::ShuffleOp> {
   using OpConversionPattern::OpConversionPattern;
-  LinearizeVectorShuffle(
-      const TypeConverter &typeConverter, MLIRContext *context,
-      unsigned targetVectBitWidth = std::numeric_limits<unsigned>::max(),
-      PatternBenefit benefit = 1)
+  LinearizeVectorShuffle(const TypeConverter &typeConverter,
+                         MLIRContext *context, PatternBenefit benefit = 1)
       : OpConversionPattern(typeConverter, context, benefit) {}
 
   LogicalResult
@@ -290,10 +287,8 @@ struct LinearizeVectorShuffle final
 struct LinearizeVectorExtract final
     : public OpConversionPattern<vector::ExtractOp> {
   using OpConversionPattern::OpConversionPattern;
-  LinearizeVectorExtract(
-      const TypeConverter &typeConverter, MLIRContext *context,
-      unsigned targetVectBitWidth = std::numeric_limits<unsigned>::max(),
-      PatternBenefit benefit = 1)
+  LinearizeVectorExtract(const TypeConverter &typeConverter,
+                         MLIRContext *context, PatternBenefit benefit = 1)
       : OpConversionPattern(typeConverter, context, benefit) {}
   LogicalResult
   matchAndRewrite(vector::ExtractOp extractOp, OpAdaptor adaptor,
@@ -339,10 +334,8 @@ struct LinearizeVectorExtract final
 struct LinearizeVectorInsert final
     : public OpConversionPattern<vector::InsertOp> {
   using OpConversionPattern::OpConversionPattern;
-  LinearizeVectorInsert(
-      const TypeConverter &typeConverter, MLIRContext *context,
-      unsigned targetVectBitWidth = std::numeric_limits<unsigned>::max(),
-      PatternBenefit benefit = 1)
+  LinearizeVectorInsert(const TypeConverter &typeConverter,
+                        MLIRContext *context, PatternBenefit benefit = 1)
       : OpConversionPattern(typeConverter, context, benefit) {}
   LogicalResult
   matchAndRewrite(vector::InsertOp insertOp, OpAdaptor adaptor,
@@ -408,10 +401,8 @@ struct LinearizeVectorInsert final
 struct LinearizeVectorBitCast final
     : public OpConversionPattern<vector::BitCastOp> {
   using OpConversionPattern::OpConversionPattern;
-  LinearizeVectorBitCast(
-      const TypeConverter &typeConverter, MLIRContext *context,
-      unsigned targetVectBitWidth = std::numeric_limits<unsigned>::max(),
-      PatternBenefit benefit = 1)
+  LinearizeVectorBitCast(const TypeConverter &typeConverter,
+                         MLIRContext *context, PatternBenefit benefit = 1)
       : OpConversionPattern(typeConverter, context, benefit) {}
   LogicalResult
   matchAndRewrite(vector::BitCastOp castOp, OpAdaptor adaptor,

@newling
Copy link
Contributor Author

newling commented May 1, 2025

FYI @nbpatel

Not sure if should just land PRs like this without waiting for a review (thoughts @banach-space ?)

Copy link
Contributor

@banach-space banach-space left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@banach-space
Copy link
Contributor

Not sure if should just land PRs like this without waiting for a review (thoughts @banach-space ?)

I’d land without review for obvious or trivial fixes - or when addressing a buildbot failure - and I think this PR falls into that category.

Adding a short justification in the summary helps too (e.g., "This is straightforward and was requested in #NNNNNN, so landing without review.")

Personally, I prefer getting an approval before merging, but reviewers are often busy, and reducing PR noise can sometimes be the more practical choice.

That said, there’s an ongoing discussion on Discourse around post-commit review, which leans toward encouraging reviews for all patches - even smaller ones:

@newling
Copy link
Contributor Author

newling commented May 1, 2025

Not sure if should just land PRs like this without waiting for a review (thoughts @banach-space ?)

I’d land without review for obvious or trivial fixes - or when addressing a buildbot failure - and I think this PR falls into that category.

Adding a short justification in the summary helps too (e.g., "This is straightforward and was requested in #NNNNNN, so landing without review.")

Personally, I prefer getting an approval before merging, but reviewers are often busy, and reducing PR noise can sometimes be the more practical choice.

That said, there’s an ongoing discussion on Discourse around post-commit review, which leans toward encouraging reviews for all patches - even smaller ones:

Good advice, thanks! As for the thread -- I can't think of a real advantage/motivation for not first creating a PR.

@nbpatel
Copy link
Contributor

nbpatel commented May 1, 2025

Can we merge this so I can rebase #137651

@newling newling merged commit 526ae7f into llvm:main May 1, 2025
16 checks passed
@newling newling deleted the remove_remaining_bit_widths branch May 1, 2025 17:10
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…llvm#138072)

In llvm#136581 the bitwidth logic
was supposed to be completely removed from the linearization patterns.
But it was left in a few places. This PR removes the remainders (they
were default valued constructor arguments that were unused).
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…llvm#138072)

In llvm#136581 the bitwidth logic
was supposed to be completely removed from the linearization patterns.
But it was left in a few places. This PR removes the remainders (they
were default valued constructor arguments that were unused).
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…llvm#138072)

In llvm#136581 the bitwidth logic
was supposed to be completely removed from the linearization patterns.
But it was left in a few places. This PR removes the remainders (they
were default valued constructor arguments that were unused).
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
…llvm#138072)

In llvm#136581 the bitwidth logic
was supposed to be completely removed from the linearization patterns.
But it was left in a few places. This PR removes the remainders (they
were default valued constructor arguments that were unused).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants