forked from OSchip/llvm-project
[mlir][NFC] Update SPIRV operations to use `hasVerifier` instead of `verifier`
The verifier field is deprecated, and slated for removal. Differential Revision: https://reviews.llvm.org/D118817
This commit is contained in:
parent
4e190c58de
commit
f7d85f010f
|
@ -1309,7 +1309,7 @@ sometimes we need to manually write additional verification logic in
|
|||
[`SPIRVOps.cpp`][MlirSpirvOpsCpp] in a function with the following signature:
|
||||
|
||||
```c++
|
||||
static LogicalResult verify(spirv::<spirv-op-symbol>Op op);
|
||||
LogicalResult spirv::<spirv-op-symbol>Op::verify();
|
||||
```
|
||||
|
||||
See any such function in [`SPIRVOps.cpp`][MlirSpirvOpsCpp] as an example.
|
||||
|
@ -1318,7 +1318,7 @@ If no additional verification is needed, one needs to add the following to
|
|||
the op's Op Definition Spec:
|
||||
|
||||
```
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
```
|
||||
|
||||
To suppress the requirement of the above C++ verification function.
|
||||
|
|
|
@ -18,7 +18,6 @@ class SPV_AtomicUpdateOp<string mnemonic, list<Trait> traits = []> :
|
|||
SPV_Op<mnemonic, traits> {
|
||||
let parser = [{ return ::parseAtomicUpdateOp(parser, result, false); }];
|
||||
let printer = [{ return ::printAtomicUpdateOp(getOperation(), p); }];
|
||||
let verifier = [{ return ::verifyAtomicUpdateOp<IntegerType>(getOperation()); }];
|
||||
|
||||
let arguments = (ins
|
||||
SPV_AnyPtr:$pointer,
|
||||
|
@ -35,7 +34,6 @@ class SPV_AtomicUpdateWithValueOp<string mnemonic, list<Trait> traits = []> :
|
|||
SPV_Op<mnemonic, traits> {
|
||||
let parser = [{ return ::parseAtomicUpdateOp(parser, result, true); }];
|
||||
let printer = [{ return ::printAtomicUpdateOp(getOperation(), p); }];
|
||||
let verifier = [{ return ::verifyAtomicUpdateOp<IntegerType>(getOperation()); }];
|
||||
|
||||
let arguments = (ins
|
||||
SPV_AnyPtr:$pointer,
|
||||
|
@ -168,7 +166,6 @@ def SPV_AtomicCompareExchangeOp : SPV_Op<"AtomicCompareExchange", []> {
|
|||
|
||||
let parser = [{ return ::parseAtomicCompareExchangeImpl(parser, result); }];
|
||||
let printer = [{ return ::printAtomicCompareExchangeImpl(*this, p); }];
|
||||
let verifier = [{ return ::verifyAtomicCompareExchangeImpl(*this); }];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -221,7 +218,6 @@ def SPV_AtomicCompareExchangeWeakOp : SPV_Op<"AtomicCompareExchangeWeak", []> {
|
|||
|
||||
let parser = [{ return ::parseAtomicCompareExchangeImpl(parser, result); }];
|
||||
let printer = [{ return ::printAtomicCompareExchangeImpl(*this, p); }];
|
||||
let verifier = [{ return ::verifyAtomicCompareExchangeImpl(*this); }];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -338,7 +334,6 @@ def SPV_AtomicFAddEXTOp : SPV_Op<"AtomicFAddEXT", []> {
|
|||
|
||||
let parser = [{ return ::parseAtomicUpdateOp(parser, result, true); }];
|
||||
let printer = [{ return ::printAtomicUpdateOp(getOperation(), p); }];
|
||||
let verifier = [{ return ::verifyAtomicUpdateOp<FloatType>(getOperation()); }];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
|
|
@ -77,8 +77,6 @@ def SPV_ControlBarrierOp : SPV_Op<"ControlBarrier", []> {
|
|||
|
||||
let results = (outs);
|
||||
|
||||
let verifier = [{ return verifyMemorySemantics(getOperation(), memory_semantics()); }];
|
||||
|
||||
let autogenSerialization = 0;
|
||||
|
||||
let assemblyFormat = [{
|
||||
|
@ -131,8 +129,6 @@ def SPV_MemoryBarrierOp : SPV_Op<"MemoryBarrier", []> {
|
|||
|
||||
let results = (outs);
|
||||
|
||||
let verifier = [{ return verifyMemorySemantics(getOperation(), memory_semantics()); }];
|
||||
|
||||
let autogenSerialization = 0;
|
||||
|
||||
let assemblyFormat = "$memory_scope `,` $memory_semantics attr-dict";
|
||||
|
|
|
@ -4272,10 +4272,10 @@ class SPV_Op<string mnemonic, list<Trait> traits = []> :
|
|||
// * static ParseResult parse<op-c++-class-name>(OpAsmParser &parser,
|
||||
// OperationState &result)
|
||||
// * static void print(OpAsmPrinter &p, <op-c++-class-name> op)
|
||||
// * static LogicalResult verify(<op-c++-class-name> op)
|
||||
// * LogicalResult <op-c++-class-name>::verify()
|
||||
let parser = [{ return ::parse$cppClass(parser, result); }];
|
||||
let printer = [{ return ::print(*this, p); }];
|
||||
let verifier = [{ return ::verify(*this); }];
|
||||
let hasVerifier = 1;
|
||||
|
||||
// Specifies whether this op has a direct corresponding SPIR-V binary
|
||||
// instruction opcode. The (de)serializer use this field to determine whether
|
||||
|
@ -4323,7 +4323,7 @@ class SPV_UnaryOp<string mnemonic, Type resultType, Type operandType,
|
|||
let parser = [{ return ::parseUnaryOp(parser, result); }];
|
||||
let printer = [{ return ::printUnaryOp(getOperation(), p); }];
|
||||
// No additional verification needed in addition to the ODS-generated ones.
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
}
|
||||
|
||||
class SPV_BinaryOp<string mnemonic, Type resultType, Type operandsType,
|
||||
|
@ -4341,7 +4341,7 @@ class SPV_BinaryOp<string mnemonic, Type resultType, Type operandsType,
|
|||
let parser = [{ return impl::parseOneResultSameOperandTypeOp(parser, result); }];
|
||||
let printer = [{ return impl::printOneResultOp(getOperation(), p); }];
|
||||
// No additional verification needed in addition to the ODS-generated ones.
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
}
|
||||
|
||||
class SPV_ExtInstOp<string mnemonic, string setPrefix, string setName,
|
||||
|
|
|
@ -36,7 +36,7 @@ class SPV_BitFieldExtractOp<string mnemonic, list<Trait> traits = []> :
|
|||
SPV_ScalarOrVectorOf<SPV_Integer>:$result
|
||||
);
|
||||
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
|
||||
let assemblyFormat = [{
|
||||
operands attr-dict `:` type($base) `,` type($offset) `,` type($count)
|
||||
|
@ -54,7 +54,7 @@ class SPV_ShiftOp<string mnemonic, list<Trait> traits = []> :
|
|||
[NoSideEffect, SameOperandsAndResultShape])> {
|
||||
let parser = [{ return ::parseShiftOp(parser, result); }];
|
||||
let printer = [{ ::printShiftOp(this->getOperation(), p); }];
|
||||
let verifier = [{ return ::verifyShiftOp(this->getOperation()); }];
|
||||
let hasVerifier = 1;
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -162,7 +162,7 @@ def SPV_BitFieldInsertOp : SPV_Op<"BitFieldInsert",
|
|||
SPV_ScalarOrVectorOf<SPV_Integer>:$result
|
||||
);
|
||||
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
|
||||
let assemblyFormat = [{
|
||||
operands attr-dict `:` type($base) `,` type($offset) `,` type($count)
|
||||
|
|
|
@ -32,7 +32,6 @@ class SPV_CastOp<string mnemonic, Type resultType, Type operandType,
|
|||
|
||||
let parser = [{ return mlir::impl::parseCastOp(parser, result); }];
|
||||
let printer = [{ mlir::impl::printCastOp(this->getOperation(), p); }];
|
||||
let verifier = [{ return verifyCastOp(this->getOperation()); }];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -122,8 +121,6 @@ def SPV_ConvertFToSOp : SPV_CastOp<"ConvertFToS", SPV_Integer, SPV_Float, []> {
|
|||
%3 = spv.ConvertFToS %2 : vector<3xf32> to vector<3xi32>
|
||||
```
|
||||
}];
|
||||
|
||||
let verifier = [{ return verifyCastOp(this->getOperation(), false, true); }];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -157,8 +154,6 @@ def SPV_ConvertFToUOp : SPV_CastOp<"ConvertFToU", SPV_Integer, SPV_Float, []> {
|
|||
%3 = spv.ConvertFToU %2 : vector<3xf32> to vector<3xi32>
|
||||
```
|
||||
}];
|
||||
|
||||
let verifier = [{ return verifyCastOp(this->getOperation(), false, true); }];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -193,8 +188,6 @@ def SPV_ConvertSToFOp : SPV_CastOp<"ConvertSToF",
|
|||
%3 = spv.ConvertSToF %2 : vector<3xi32> to vector<3xf32>
|
||||
```
|
||||
}];
|
||||
|
||||
let verifier = [{ return verifyCastOp(this->getOperation(), false, true); }];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -229,8 +222,6 @@ def SPV_ConvertUToFOp : SPV_CastOp<"ConvertUToF",
|
|||
%3 = spv.ConvertUToF %2 : vector<3xi32> to vector<3xf32>
|
||||
```
|
||||
}];
|
||||
|
||||
let verifier = [{ return verifyCastOp(this->getOperation(), false, true); }];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -267,8 +258,6 @@ def SPV_FConvertOp : SPV_CastOp<"FConvert",
|
|||
%3 = spv.FConvertOp %2 : vector<3xf32> to vector<3xf64>
|
||||
```
|
||||
}];
|
||||
|
||||
let verifier = [{ return verifyCastOp(this->getOperation(), false); }];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -304,8 +293,6 @@ def SPV_SConvertOp : SPV_CastOp<"SConvert",
|
|||
%3 = spv.SConvertOp %2 : vector<3xi32> to vector<3xi64>
|
||||
```
|
||||
}];
|
||||
|
||||
let verifier = [{ return verifyCastOp(this->getOperation(), false); }];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -342,8 +329,6 @@ def SPV_UConvertOp : SPV_CastOp<"UConvert",
|
|||
%3 = spv.UConvertOp %2 : vector<3xi32> to vector<3xi64>
|
||||
```
|
||||
}];
|
||||
|
||||
let verifier = [{ return verifyCastOp(this->getOperation(), false); }];
|
||||
}
|
||||
|
||||
#endif // MLIR_DIALECT_SPIRV_IR_CAST_OPS
|
||||
|
|
|
@ -210,7 +210,7 @@ def SPV_VectorExtractDynamicOp : SPV_Op<"VectorExtractDynamic", [
|
|||
SPV_Scalar:$result
|
||||
);
|
||||
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
|
||||
let assemblyFormat = [{
|
||||
$vector `[` $index `]` attr-dict `:` type($vector) `,` type($index)
|
||||
|
@ -274,7 +274,7 @@ def SPV_VectorInsertDynamicOp : SPV_Op<"VectorInsertDynamic", [
|
|||
SPV_Vector:$result
|
||||
);
|
||||
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
|
||||
let assemblyFormat = [{
|
||||
$component `,` $vector `[` $index `]` attr-dict `:` type($vector) `,` type($index)
|
||||
|
|
|
@ -51,7 +51,7 @@ def SPV_BranchOp : SPV_Op<"Branch", [
|
|||
|
||||
let successors = (successor AnySuccessor:$target);
|
||||
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
|
||||
let builders = [
|
||||
OpBuilder<(ins "Block *":$successor, CArg<"ValueRange", "{}">:$arguments),
|
||||
|
|
|
@ -55,7 +55,7 @@ def SPV_CooperativeMatrixLengthNVOp : SPV_Op<"CooperativeMatrixLengthNV",
|
|||
let results = (outs
|
||||
SPV_Int32:$result
|
||||
);
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -132,11 +132,6 @@ def SPV_CooperativeMatrixLoadNVOp : SPV_Op<"CooperativeMatrixLoadNV", []> {
|
|||
let results = (outs
|
||||
SPV_AnyCooperativeMatrix:$result
|
||||
);
|
||||
|
||||
let verifier = [{
|
||||
return verifyPointerAndCoopMatrixType(*this, pointer().getType(),
|
||||
result().getType());
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -211,8 +206,6 @@ def SPV_CooperativeMatrixMulAddNVOp : SPV_Op<"CooperativeMatrixMulAddNV",
|
|||
let results = (outs
|
||||
SPV_AnyCooperativeMatrix:$result
|
||||
);
|
||||
|
||||
let verifier = [{ return verifyCoopMatrixMulAdd(*this); }];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -274,11 +267,6 @@ def SPV_CooperativeMatrixStoreNVOp : SPV_Op<"CooperativeMatrixStoreNV", []> {
|
|||
);
|
||||
|
||||
let results = (outs);
|
||||
|
||||
let verifier = [{
|
||||
return verifyPointerAndCoopMatrixType(*this, pointer().getType(),
|
||||
object().getType());
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
|
|
@ -49,7 +49,7 @@ class SPV_GLSLUnaryOp<string mnemonic, int opcode, Type resultType,
|
|||
|
||||
let printer = [{ return printUnaryOp(getOperation(), p); }];
|
||||
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
}
|
||||
|
||||
// Base class for GLSL Unary arithmetic ops where return type matches
|
||||
|
@ -76,7 +76,7 @@ class SPV_GLSLBinaryOp<string mnemonic, int opcode, Type resultType,
|
|||
|
||||
let printer = [{ return impl::printOneResultOp(getOperation(), p); }];
|
||||
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
}
|
||||
|
||||
// Base class for GLSL Binary arithmetic ops where operand types and
|
||||
|
@ -104,7 +104,7 @@ class SPV_GLSLTernaryArithmeticOp<string mnemonic, int opcode, Type type,
|
|||
|
||||
let printer = [{ return impl::printOneResultOp(getOperation(), p); }];
|
||||
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -1133,8 +1133,6 @@ def SPV_GLSLFrexpStructOp : SPV_GLSLOp<"FrexpStruct", 52, [NoSideEffect]> {
|
|||
let assemblyFormat = [{
|
||||
attr-dict $operand `:` type($operand) `->` type($result)
|
||||
}];
|
||||
|
||||
let verifier = [{ return ::verifyGLSLFrexpStructOp(*this); }];
|
||||
}
|
||||
|
||||
def SPV_GLSLLdexpOp :
|
||||
|
@ -1187,8 +1185,6 @@ def SPV_GLSLLdexpOp :
|
|||
let assemblyFormat = [{
|
||||
attr-dict $x `:` type($x) `,` $exp `:` type($exp) `->` type($y)
|
||||
}];
|
||||
|
||||
let verifier = [{ return ::verify(*this); }];
|
||||
}
|
||||
|
||||
def SPV_GLSLFMixOp :
|
||||
|
@ -1227,7 +1223,7 @@ def SPV_GLSLFMixOp :
|
|||
attr-dict $x `:` type($x) `,` $y `:` type($y) `,` $a `:` type($a) `->` type($result)
|
||||
}];
|
||||
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
}
|
||||
|
||||
#endif // MLIR_DIALECT_SPIRV_IR_GLSL_OPS
|
||||
|
|
|
@ -139,7 +139,7 @@ def SPV_SubgroupBallotKHROp : SPV_Op<"SubgroupBallotKHR", []> {
|
|||
SPV_Int32Vec4:$result
|
||||
);
|
||||
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
|
||||
let assemblyFormat = "$predicate attr-dict `:` type($result)";
|
||||
}
|
||||
|
|
|
@ -82,8 +82,6 @@ def SPV_ImageDrefGatherOp : SPV_Op<"ImageDrefGather", [NoSideEffect]> {
|
|||
( `(` $operand_arguments^ `:` type($operand_arguments) `)`)?
|
||||
attr-dict
|
||||
`->` type($result)}];
|
||||
|
||||
let verifier = [{ return ::verify(*this); }];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -141,8 +139,6 @@ def SPV_ImageQuerySizeOp : SPV_Op<"ImageQuerySize", [NoSideEffect]> {
|
|||
);
|
||||
|
||||
let assemblyFormat = "attr-dict $image `:` type($image) `->` type($result)";
|
||||
|
||||
let verifier = [{return ::verify(*this);}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -179,8 +175,7 @@ def SPV_ImageOp : SPV_Op<"Image",
|
|||
|
||||
let assemblyFormat = "attr-dict $sampledimage `:` type($sampledimage)";
|
||||
|
||||
let verifier = ?;
|
||||
|
||||
let hasVerifier = 0;
|
||||
}
|
||||
|
||||
#endif // MLIR_DIALECT_SPIRV_IR_GLSL_OPS
|
||||
|
|
|
@ -66,8 +66,6 @@ def SPV_MatrixTimesMatrixOp : SPV_Op<"MatrixTimesMatrix", [NoSideEffect]> {
|
|||
let assemblyFormat = [{
|
||||
operands attr-dict `:` type($leftmatrix) `,` type($rightmatrix) `->` type($result)
|
||||
}];
|
||||
|
||||
let verifier = [{ return verifyMatrixTimesMatrix(*this); }];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -130,8 +128,6 @@ def SPV_MatrixTimesScalarOp : SPV_Op<"MatrixTimesScalar", [NoSideEffect]> {
|
|||
Extension<[]>,
|
||||
Capability<[SPV_C_Matrix]>
|
||||
];
|
||||
|
||||
let verifier = [{ return verifyMatrixTimesScalar(*this); }];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -184,8 +180,6 @@ def SPV_TransposeOp : SPV_Op<"Transpose", [NoSideEffect]> {
|
|||
let assemblyFormat = [{
|
||||
operands attr-dict `:` type($matrix) `->` type($result)
|
||||
}];
|
||||
|
||||
let verifier = [{ return verifyTranspose(*this); }];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
|
|
@ -130,8 +130,6 @@ def SPV_CopyMemoryOp : SPV_Op<"CopyMemory", []> {
|
|||
|
||||
let results = (outs);
|
||||
|
||||
let verifier = [{ return verifyCopyMemory(*this); }];
|
||||
|
||||
let autogenSerialization = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ def SPV_UndefOp : SPV_Op<"Undef", []> {
|
|||
SPV_Type:$result
|
||||
);
|
||||
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
|
||||
let hasOpcode = 0;
|
||||
let autogenSerialization = 0;
|
||||
|
|
|
@ -30,8 +30,6 @@ class SPV_GroupNonUniformArithmeticOp<string mnemonic, Type type,
|
|||
|
||||
let parser = [{ return parseGroupNonUniformArithmeticOp(parser, result); }];
|
||||
let printer = [{ printGroupNonUniformArithmeticOp(getOperation(), p); }];
|
||||
let verifier = [{ return ::verifyGroupNonUniformArithmeticOp(getOperation()); }];
|
||||
|
||||
}
|
||||
|
||||
// -----
|
||||
|
|
|
@ -48,7 +48,7 @@ class SPV_OCLUnaryOp<string mnemonic, int opcode, Type resultType,
|
|||
|
||||
let printer = [{ return printUnaryOp(getOperation(), p); }];
|
||||
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
}
|
||||
|
||||
// Base class for OpenCL Unary arithmetic ops where return type matches
|
||||
|
@ -75,7 +75,7 @@ class SPV_OCLBinaryOp<string mnemonic, int opcode, Type resultType,
|
|||
|
||||
let printer = [{ return impl::printOneResultOp(getOperation(), p); }];
|
||||
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
}
|
||||
|
||||
// Base class for OpenCL Binary arithmetic ops where operand types and
|
||||
|
|
|
@ -241,7 +241,7 @@ def SPV_ExecutionModeOp : SPV_Op<"ExecutionMode", [InModuleScope]> {
|
|||
|
||||
let results = (outs);
|
||||
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
|
||||
let autogenSerialization = 0;
|
||||
|
||||
|
@ -296,7 +296,7 @@ def SPV_FuncOp : SPV_Op<"func", [
|
|||
|
||||
let regions = (region AnyRegion:$body);
|
||||
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
|
||||
let builders = [
|
||||
OpBuilder<(ins "StringRef":$name, "FunctionType":$type,
|
||||
|
@ -788,7 +788,7 @@ def SPV_YieldOp : SPV_Op<"mlir.yield", [
|
|||
|
||||
let assemblyFormat = "attr-dict $operand `:` type($operand)";
|
||||
|
||||
let verifier = [{ return success(); }];
|
||||
let hasVerifier = 0;
|
||||
}
|
||||
|
||||
// -----
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue