[all-commits] [llvm/llvm-project] 7359a6: [mlir][ODS] Verify type constraints in Types and A...
Matthias Springer via All-commits
all-commits at lists.llvm.org
Fri Aug 9 13:05:01 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 7359a6b7996f92e6659418d3d2e5b57c44d65e37
https://github.com/llvm/llvm-project/commit/7359a6b7996f92e6659418d3d2e5b57c44d65e37
Author: Matthias Springer <me at m-sp.org>
Date: 2024-08-09 (Fri, 09 Aug 2024)
Changed paths:
M mlir/include/mlir/Dialect/GPU/IR/GPUDialect.h
M mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h
M mlir/include/mlir/Dialect/Quant/QuantTypes.h
M mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.h
M mlir/include/mlir/Dialect/SPIRV/IR/SPIRVTypes.h
M mlir/include/mlir/IR/StorageUniquerSupport.h
M mlir/include/mlir/IR/Types.h
M mlir/include/mlir/TableGen/AttrOrTypeDef.h
M mlir/include/mlir/TableGen/Class.h
M mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
M mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
M mlir/lib/Dialect/Quant/IR/QuantTypes.cpp
M mlir/lib/Dialect/SPIRV/IR/SPIRVAttributes.cpp
M mlir/lib/Dialect/SPIRV/IR/SPIRVTypes.cpp
M mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
M mlir/lib/TableGen/AttrOrTypeDef.cpp
A mlir/test/IR/test-verifiers-type.mlir
M mlir/test/lib/Dialect/Test/TestAttrDefs.td
M mlir/test/lib/Dialect/Test/TestTypeDefs.td
M mlir/test/mlir-tblgen/attr-or-type-format.td
M mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
M mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
Log Message:
-----------
[mlir][ODS] Verify type constraints in Types and Attributes (#102326)
When a type/attribute is defined in TableGen, a type constraint can be
used for parameters, but the type constraint verification was missing.
Example:
```
def TestTypeVerification : Test_Type<"TestTypeVerification"> {
let parameters = (ins AnyTypeOf<[I16, I32]>:$param);
// ...
}
```
No verification code was generated to ensure that `$param` is I16 or
I32.
When type constraints a present, a new method will generated for types
and attributes: `verifyInvariantsImpl`. (The naming is similar to op
verifiers.) The user-provided verifier is called `verify` (no change).
There is now a new entry point to type/attribute verification:
`verifyInvariants`. This function calls both `verifyInvariantsImpl` and
`verify`. If neither of those two verifications are present, the
`verifyInvariants` function is not generated.
When a type/attribute is not defined in TableGen, but a verifier is
needed, users can implement the `verifyInvariants` function. (This
function was previously called `verify`.)
Note for LLVM integration: If you have an attribute/type that is not
defined in TableGen (i.e., just C++), you have to rename the
verification function from `verify` to `verifyInvariants`. (Most
attributes/types have no verification, in which case there is nothing to
do.)
Depends on #102657.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list