-
Notifications
You must be signed in to change notification settings - Fork 11k
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
[MLIR][linalg] Parser crashes on transpose #97857
Comments
@llvm/issue-subscribers-mlir-linalg Author: Ian Wood (IanWood1)
My mlir lsp crashed when working with linalg.transpose. The issue I was can be reproduced with `mlir-opt`, which crashes when parsing this mlir:
This crash occurs for both
llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp Lines 1737 to 1744 in c2fbc70
Trace:
|
The Destination Style Op parsing treating both module {
func.func private @transpose(%arg0 : tensor<10x10xi32>){
//%0 = linalg.transpose permutation = [0, 1]
%add = linalg.map { arith.addf }
}
} |
All Linalg dialect ops that I am aware of require at least one output operand. We should check that in the verifier. I wouldn't add it to the |
In this specific case, we won't even get to that point in the verifier, because (after fixing the invalid array access during region creation) it will error out like this:
And when we take away the result, it will still error out because the number of operands is incorrect:
But we could add an additional check guaranteeing that at least one operand has to be an |
Oh, this is crashing already in the builder... |
`parseDstStyleOp` parses both `ins()` and `outs()` optionally. The parsers for `linalg.transpose`, `linalg.broadcast` and `linalg.map` however assume that at least one operand is present in the state, leading to crashes otherwise. This patch adds checks to the parsers which stop them from crashing if no operands were parsed. After the Ops are parsed successfuly, the verifier takes it from there. Fix llvm#97857
My mlir lsp crashed when working with linalg.transpose. The issue I was can be reproduced with
mlir-opt
, which crashes when parsing this mlir:This crash occurs for both
linalg.transpose
andlinalg.broadcast
ops. It looks like the reason is that this occurs is that the call tobuildIdentityRegion
implicitly requires that the op has at least 1 bb arg.llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
Line 1780 in c2fbc70
llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
Lines 1737 to 1744 in c2fbc70
Trace:
The text was updated successfully, but these errors were encountered: