[all-commits] [llvm/llvm-project] 27f3ff: [mlir][ODS] Verify type constraints in Types and A...
Matthias Springer via All-commits
all-commits at lists.llvm.org
Fri Aug 9 11:52:21 PDT 2024
Branch: refs/heads/users/matthias-springer/ods_type_verifier
Home: https://github.com/llvm/llvm-project
Commit: 27f3ffae411d6b0f5227850ab11a0ad69090daca
https://github.com/llvm/llvm-project/commit/27f3ffae411d6b0f5227850ab11a0ad69090daca
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