Fix logic error in D79508. The old logic would make the first check in
GPUFuncOp::verifyBody always pass.
Details
- Reviewers
herhut
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/GPU/IR/GPUDialect.cpp | ||
---|---|---|
693 | I don't think this should be in a verifier. getWorkgroupAttributions() is implemented by means of getNumWorkgroupAttributions, so this is not an invariant we need to check for each operation. If we want to prevent this from regressing, we would need to write a unit test that shows the wrong behavior. You could specify the illegal case by using the generic syntax, which does not go through the parser but has to explicitly specify attributes. That should allow you to construct also illegal cases. You can use mlir-opt -mlir-print-op-generic to look at the generic syntax. |
mlir/lib/Dialect/GPU/IR/GPUDialect.cpp | ||
---|---|---|
693 | Thanks for the hint. Will revise the patch. |
mlir/lib/Dialect/GPU/IR/GPUDialect.cpp | ||
---|---|---|
680–681 | This produces error messages that are not overly helpful. I would verify this is follows. We need at least getNumArguments() + getNumWorkgroupAttributions() many operands, as otherwise there are not enough. The getNumPrivateAttributions() does not need to be verified, as it is computed as the remaining operands that are left over. So the only error case is when we do not have enough operands to satisfy function arguments and workgroup attributions. |
This produces error messages that are not overly helpful. I would verify this is follows. We need at least getNumArguments() + getNumWorkgroupAttributions() many operands, as otherwise there are not enough. The getNumPrivateAttributions() does not need to be verified, as it is computed as the remaining operands that are left over.
So the only error case is when we do not have enough operands to satisfy function arguments and workgroup attributions.