[Mlir-commits] [mlir] [mlir][tensor] Fix FoldTensorCastProducerOp for multiple result operations (PR #93374)

Prashant Kumar llvmlistbot at llvm.org
Thu Jun 6 08:18:46 PDT 2024


================
@@ -4531,17 +4531,17 @@ struct FoldTensorCastProducerOp
     if (!hasTensorCastOperand)
       return failure();
 
-    SmallVector<Type, 4> newResultTypes;
-    newResultTypes.reserve(op->getNumResults());
+    SmallVector<Type, 4> newResultTypes(op->getResultTypes());
     SmallVector<Value, 4> newOperands;
     newOperands.reserve(op->getNumOperands());
+    int64_t dpsInitIdx = 0;
     for (OpOperand &opOperand : op->getOpOperands()) {
----------------
pashu123 wrote:

I tried splitting the loops as mentioned, it throws an error here: 
```
******************** TEST 'MLIR :: Dialect/Tensor/tiling.mlir' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/prashant/llvm-project/build/bin/mlir-opt /home/prashant/llvm-project/mlir/test/Dialect/Tensor/tiling.mlir -transform-interpreter -canonicalize -cse -split-input-file | /h
ome/prashant/llvm-project/build/bin/FileCheck /home/prashant/llvm-project/mlir/test/Dialect/Tensor/tiling.mlir
# executed command: /home/prashant/llvm-project/build/bin/mlir-opt /home/prashant/llvm-project/mlir/test/Dialect/Tensor/tiling.mlir -transform-interpreter -canonicalize -cse -s
plit-input-file
# .---command stderr------------
# | mlir-opt: /home/prashant/llvm-project/llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(const From&) [with To = mlir::detail::TypedValue<mlir::RankedTensor
Type>; From = mlir::Value]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
# | Stack dump:
# | 0.  Program arguments: /home/prashant/llvm-project/build/bin/mlir-opt /home/prashant/llvm-project/mlir/test/Dialect/Tensor/tiling.mlir -transform-interpreter -canonicalize
-cse -split-input-file
# |  #0 0x0000582137a377d0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/prashant/llvm-project/build/bin/mlir-opt+0x2f187d0)
# |  #1 0x0000582137a34bef llvm::sys::RunSignalHandlers() (/home/prashant/llvm-project/build/bin/mlir-opt+0x2f15bef)
# |  #2 0x0000582137a34d45 SignalHandler(int) Signals.cpp:0:0
# |  #3 0x0000728d2cc42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
# |  #4 0x0000728d2cc969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
# |  #5 0x0000728d2cc969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
# |  #6 0x0000728d2cc969fc pthread_kill ./nptl/pthread_kill.c:89:10
# |  #7 0x0000728d2cc42476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
# |  #8 0x0000728d2cc287f3 abort ./stdlib/abort.c:81:7
# |  #9 0x0000728d2cc2871b _nl_load_domain ./intl/loadmsgcat.c:1177:9
# | #10 0x0000728d2cc39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
# | #11 0x00005821387e1f02 (/home/prashant/llvm-project/build/bin/mlir-opt+0x3cc2f02)
# | #12 0x0000582139a6aced mlir::tensor::PackOp::fold(mlir::tensor::PackOpGenericAdaptor<llvm::ArrayRef<mlir::Attribute>>) (/home/prashant/llvm-project/build/bin/mlir-opt+0x4f4
bced)
```  I can revisit it if you want or look into the bug.

https://github.com/llvm/llvm-project/pull/93374


More information about the Mlir-commits mailing list