[all-commits] [llvm/llvm-project] a82692: [mlir][ODS] Verify type constraints in Types and A...
Matthias Springer via All-commits
all-commits at lists.llvm.org
Fri Aug 9 12:54:33 PDT 2024
Branch: refs/heads/users/matthias-springer/ods_type_verifier
Home: https://github.com/llvm/llvm-project
Commit: a82692f7200e4337b2b8b0e37b2005c62c3e1512
https://github.com/llvm/llvm-project/commit/a82692f7200e4337b2b8b0e37b2005c62c3e1512
Author: Matthias Springer <mspringer at nvidia.com>
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
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`.)
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