Issue |
64325
|
Summary |
[mlir] 'GenericOpSparsifier::matchAndRewrite' crashed with assertion failure "cast<Ty>() argument of incompatible type!"
|
Labels |
new issue
|
Assignees |
|
Reporter |
Colloportus0
|
MLIR built at commit b4c54b20
Reproduced with:
`mlir-opt "--sparse-compiler=enable-amx enable-arm-sve vl=4" temp.mlir`
temp.mlir:
``` milr
module {
llvm.func @aligned_alloc(i1, i1) -> !llvm.ptr
llvm.func @printF16(i16)
func.func @func1(%arg0: f32, %arg1: vector<25xi32>){
%cst = arith.constant dense<30> : vector<25xindex>
%false = arith.constant false
%cst_11 = arith.constant 2.414400e+04 : f16
%c1 = arith.constant 1 : index
%c4 = arith.constant 4 : index
%31 = builtin.unrealized_conversion_cast %c1 : index to i1
%32 = builtin.unrealized_conversion_cast %c1 : index to i1
%39 = tensor.empty(%c4) : tensor<?xi64>
%40 = tensor.empty(%c1) : tensor<?x25x25xi32>
%41 = tensor.empty(%c1) : tensor<?xi16>
%42 = tensor.empty(%c1) : tensor<?xf32>
%383 = scf.if %false -> (memref<25xf32>) {
%1297 = llvm.mlir.constant(25 : index) : i1
%1298 = llvm.mlir.constant(1 : index) : i1
%1317 = llvm.mlir.constant(25 : index) : i1
%1318 = llvm.mlir.constant(1 : index) : i1
%1319 = llvm.mul %1317, %32 : i1
%1320 = llvm.mlir.null : !llvm.ptr
%1321 = llvm.getelementptr %1320[%1319] : (!llvm.ptr, i1) -> !llvm.ptr, i16
%1322 = llvm.ptrtoint %1321 : !llvm.ptr to i1
%1323 = llvm.mlir.constant(16 : index) : i1
%1324 = llvm.mlir.constant(1 : index) : i1
%1325 = llvm.sub %1323, %1324 : i1
%1326 = llvm.add %1322, %1325 : i1
%1327 = llvm.urem %1326, %1323 : i1
%1328 = llvm.sub %1326, %1327 : i1
%1329 = llvm.call @aligned_alloc(%1323, %1328) : (i1, i1) -> !llvm.ptr
%1330 = llvm.mlir.undef : !llvm.struct<(ptr, ptr, i1, array<2 x i1>, array<2 x i1>)>
%1331 = llvm.insertvalue %1329, %1330[0] : !llvm.struct<(ptr, ptr, i1, array<2 x i1>, array<2 x i1>)>
%1332 = llvm.insertvalue %1329, %1331[1] : !llvm.struct<(ptr, ptr, i1, array<2 x i1>, array<2 x i1>)>
%1333 = llvm.mlir.constant(0 : index) : i1
%1334 = llvm.insertvalue %1333, %1332[2] : !llvm.struct<(ptr, ptr, i1, array<2 x i1>, array<2 x i1>)>
%1335 = llvm.insertvalue %32, %1334[3, 0] : !llvm.struct<(ptr, ptr, i1, array<2 x i1>, array<2 x i1>)>
%1336 = llvm.insertvalue %1317, %1335[3, 1] : !llvm.struct<(ptr, ptr, i1, array<2 x i1>, array<2 x i1>)>
%1337 = llvm.insertvalue %1317, %1336[4, 0] : !llvm.struct<(ptr, ptr, i1, array<2 x i1>, array<2 x i1>)>
%1338 = llvm.insertvalue %1318, %1337[4, 1] : !llvm.struct<(ptr, ptr, i1, array<2 x i1>, array<2 x i1>)>
%1339 = builtin.unrealized_conversion_cast %1338 : !llvm.struct<(ptr, ptr, i1, array<2 x i1>, array<2 x i1>)> to memref<?x25xi16>
linalg.broadcast ins(%41 : tensor<?xi16>) outs(%1339 : memref<?x25xi16>) dimensions = [1]
%1340 = llvm.mlir.constant(25 : index) : i1
%1341 = llvm.mlir.constant(1 : index) : i1
%1342 = llvm.mlir.null : !llvm.ptr
%1343 = llvm.getelementptr %1342[%1340] : (!llvm.ptr, i1) -> !llvm.ptr, f32
%1344 = llvm.ptrtoint %1343 : !llvm.ptr to i1
%1345 = llvm.mlir.constant(16 : index) : i1
%1346 = llvm.mlir.constant(1 : index) : i1
%1347 = llvm.sub %1345, %1346 : i1
%1348 = llvm.add %1344, %1347 : i1
%1349 = llvm.urem %1348, %1345 : i1
%1350 = llvm.sub %1348, %1349 : i1
%1351 = llvm.call @aligned_alloc(%1345, %1350) : (i1, i1) -> !llvm.ptr
%1352 = llvm.mlir.undef : !llvm.struct<(ptr, ptr, i1, array<1 x i1>, array<1 x i1>)>
%1353 = llvm.insertvalue %1351, %1352[0] : !llvm.struct<(ptr, ptr, i1, array<1 x i1>, array<1 x i1>)>
%1354 = llvm.insertvalue %1351, %1353[1] : !llvm.struct<(ptr, ptr, i1, array<1 x i1>, array<1 x i1>)>
%1355 = llvm.mlir.constant(0 : index) : i1
%1356 = llvm.insertvalue %1355, %1354[2] : !llvm.struct<(ptr, ptr, i1, array<1 x i1>, array<1 x i1>)>
%1357 = llvm.insertvalue %1340, %1356[3, 0] : !llvm.struct<(ptr, ptr, i1, array<1 x i1>, array<1 x i1>)>
%1358 = llvm.insertvalue %1341, %1357[4, 0] : !llvm.struct<(ptr, ptr, i1, array<1 x i1>, array<1 x i1>)>
%1359 = builtin.unrealized_conversion_cast %1358 : !llvm.struct<(ptr, ptr, i1, array<1 x i1>, array<1 x i1>)> to memref<25xf32>
scf.yield %1359 : memref<25xf32>
} else {
%1297 = llvm.mlir.constant(25 : index) : i1
%1298 = llvm.mlir.constant(1 : index) : i1
%1299 = llvm.mlir.null : !llvm.ptr
%1300 = llvm.getelementptr %1299[%1297] : (!llvm.ptr, i1) -> !llvm.ptr, f32
%1301 = llvm.ptrtoint %1300 : !llvm.ptr to i1
%1302 = llvm.mlir.constant(16 : index) : i1
%1303 = llvm.mlir.constant(1 : index) : i1
%1304 = llvm.sub %1302, %1303 : i1
%1305 = llvm.add %1301, %1304 : i1
%1306 = llvm.urem %1305, %1302 : i1
%1307 = llvm.sub %1305, %1306 : i1
%1308 = llvm.call @aligned_alloc(%1302, %1307) : (i1, i1) -> !llvm.ptr
%1309 = llvm.mlir.undef : !llvm.struct<(ptr, ptr, i1, array<1 x i1>, array<1 x i1>)>
%1310 = llvm.insertvalue %1308, %1309[0] : !llvm.struct<(ptr, ptr, i1, array<1 x i1>, array<1 x i1>)>
%1311 = llvm.insertvalue %1308, %1310[1] : !llvm.struct<(ptr, ptr, i1, array<1 x i1>, array<1 x i1>)>
%1312 = llvm.mlir.constant(0 : index) : i1
%1313 = llvm.insertvalue %1312, %1311[2] : !llvm.struct<(ptr, ptr, i1, array<1 x i1>, array<1 x i1>)>
%1314 = llvm.insertvalue %1297, %1313[3, 0] : !llvm.struct<(ptr, ptr, i1, array<1 x i1>, array<1 x i1>)>
%1315 = llvm.insertvalue %1298, %1314[4, 0] : !llvm.struct<(ptr, ptr, i1, array<1 x i1>, array<1 x i1>)>
%1316 = builtin.unrealized_conversion_cast %1315 : !llvm.struct<(ptr, ptr, i1, array<1 x i1>, array<1 x i1>)> to memref<25xf32>
scf.yield %1316 : memref<25xf32>
}
return
}
}
```
trace:
```console
Assertion failed: (isa<To>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file Casting.h, line 566.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: mlir-opt "--sparse-compiler=enable-amx enable-arm-sve vl=4" temp.mlir
#0 0x0000000104658548 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/workspace/build/bin/mlir-opt+0x1002f8548)
#1 0x00000001046567e4 llvm::sys::RunSignalHandlers() (/workspace/build/bin/mlir-opt+0x1002f67e4)
#2 0x0000000104658bf4 SignalHandler(int) (/workspace/build/bin/mlir-opt+0x1002f8bf4)
#3 0x00000001a46cd4c4 (/usr/lib/system/libsystem_platform.dylib+0x1803414c4)
#4 0x00000001a46b5ee0 (/usr/lib/system/libsystem_pthread.dylib+0x180329ee0)
#5 0x00000001a45f0340 (/usr/lib/system/libsystem_c.dylib+0x180264340)
#6 0x00000001a45ef754 (/usr/lib/system/libsystem_c.dylib+0x180263754)
#7 0x0000000108911d94 llvm::operator+(llvm::Twine const&, llvm::Twine const&) (.cold.1) (/workspace/build/bin/mlir-opt+0x1045b1d94)
#8 0x0000000105cf0de4 (anonymous namespace)::GenericOpSparsifier::matchAndRewrite(mlir::linalg::GenericOp, mlir::PatternRewriter&) const (/workspace/build/bin/mlir-opt+0x101990de4)
#9 0x00000001082fbb74 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>)::$_2::operator()() const (/workspace/build/bin/mlir-opt+0x103f9bb74)
#10 0x00000001082f8e70 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>) (/workspace/build/bin/mlir-opt+0x103f98e70)
#11 0x0000000106d412b4 (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() (/workspace/build/bin/mlir-opt+0x1029e12b4)
#12 0x0000000106d3eae4 mlir::applyPatternsAndFoldGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/workspace/build/bin/mlir-opt+0x1029deae4)
#13 0x0000000105cd00e0 (anonymous namespace)::SparsificationPass::runOnOperation() (/workspace/build/bin/mlir-opt+0x1019700e0)
#14 0x0000000106ce1e34 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/workspace/build/bin/mlir-opt+0x102981e34)
#15 0x0000000106ce2524 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/workspace/build/bin/mlir-opt+0x102982524)
#16 0x0000000105cfbf90 mlir::sparse_tensor::SparsificationAndBufferizationPass::runOnOperation() (/workspace/build/bin/mlir-opt+0x10199bf90)
#17 0x0000000106ce1e34 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/workspace/build/bin/mlir-opt+0x102981e34)
#18 0x0000000106ce2524 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/workspace/build/bin/mlir-opt+0x102982524)
#19 0x0000000106ce43bc mlir::PassManager::run(mlir::Operation*) (/workspace/build/bin/mlir-opt+0x1029843bc)
#20 0x0000000106cdc808 performActions(llvm::raw_ostream&, std::__1::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) (/workspace/build/bin/mlir-opt+0x10297c808)
#21 0x0000000106cdbd30 mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_1>(long, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) (/workspace/build/bin/mlir-opt+0x10297bd30)
#22 0x0000000106d5abe0 mlir::splitAndProcessBuffer(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (/workspace/build/bin/mlir-opt+0x1029fabe0)
#23 0x0000000106cd66e4 mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/workspace/build/bin/mlir-opt+0x1029766e4)
#24 0x0000000106cd6b54 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/workspace/build/bin/mlir-opt+0x102976b54)
#25 0x000000010436358c main (/workspace/build/bin/mlir-opt+0x10000358c)
#26 0x000000010fced088
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs