Skip to content

[Quick-fix] Fix GCC build of previous patch. #111869

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

Closed
wants to merge 1 commit into from

Conversation

shahidact
Copy link
Contributor

Fixes the GCC build for SmallVector type declaration in previous patch related to '[mlir][linalg] Introduce transpose semantic to 'linalg.matmul' ops.

Fixes the GCC build of previous patch related to '[mlir][linalg] Introduce transpose semantic to 'linalg.matmul' ops.
@llvmbot
Copy link
Member

llvmbot commented Oct 10, 2024

@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-linalg

Author: Md Asghar Ahmad Shahid (shahidact)

Changes

Fixes the GCC build for SmallVector type declaration in previous patch related to '[mlir][linalg] Introduce transpose semantic to 'linalg.matmul' ops.


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

1 Files Affected:

  • (modified) mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp (+1-1)
diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
index 4f350ea236da84..8d01ea5ca21482 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
@@ -160,7 +160,7 @@ static void fillStructuredOpRegion(OpBuilder &opBuilder, Region &region,
 static SmallVector<AffineMap>
 getDefaultIndexingMapsForMatmul(MLIRContext *context) {
   AffineExpr d0, d1, d2;
-  SmallVector<AffineMap, 3> indexingMaps;
+  SmallVector<AffineMap, 6> indexingMaps;
   bindDims(context, d0, d1, d2);
   indexingMaps.push_back(AffineMap::get(3, 0, {d0, d2}, context));
   indexingMaps.push_back(AffineMap::get(3, 0, {d2, d1}, context));

@rengolin
Copy link
Member

https://lab.llvm.org/buildbot/#/builders/117/builds/2697

Compiler: GCC 11.4

/home/uweigand/sandbox/buildbot/mlir-s390x-linux/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp: In function 'llvm::SmallVector<mlir::AffineMap> getDefaultIndexingMapsForMatmul(mlir::MLIRContext*)':
/home/uweigand/sandbox/buildbot/mlir-s390x-linux/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:168:10: error: could not convert 'indexingMaps' from 'SmallVector<[...],3>' to 'SmallVector<[...],6>'
  168 |   return indexingMaps;
      |          ^~~~~~~~~~~~
      |          |
      |          SmallVector<[...],3>

https://llvm.org/docs/ProgrammersManual.html#llvm-adt-smallvector-h

I'm not sure where the 6 is coming from, to be honest.

Perhaps a better fix is to change the return type to SmallVector<AffineMap, 3> or change the declaration to SmallVector<AffineMap>. But I'm not sure GCC will like either of them, since Clang is perfectly fine with it.

I'll try to build with GCC localy.

@rengolin
Copy link
Member

Just built with GCC 11.4 and the right answer is...

-static SmallVector<AffineMap>
+static SmallVector<AffineMap, 3>

@rengolin
Copy link
Member

rengolin commented Oct 10, 2024

Fixed in 99c8557. Will keep an eye on the bots.

@rengolin rengolin closed this Oct 10, 2024
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.

3 participants