Skip to content

Commit 6a378b3

Browse files
committed
[mlir][spirv] Add base classes for vendor ops
This is the first patch in the series to rename vendor ops from `spv.NameVENDOR` to `spv.VENDOR.Name`. The goal is to make the SPIR-V dialect more internally consistent. Issue: llvm/llvm-project#56863
1 parent 94c6dfb commit 6a378b3

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4541,4 +4541,28 @@ class SPV_ExtInstOp<string mnemonic, string setPrefix, string setName,
45414541
string extendedInstSetName = setName;
45424542
}
45434543

4544+
// Base classes for SPIR-V vendor ops. These have opcode in the form of
4545+
// Op<Name><VENDOR>, e.g., OpCooperativeMatrixStoreNV.
4546+
class SPV_VendorOp<string mnemonic, string vendorName,
4547+
list<Trait> traits = []> :
4548+
SPV_Op<mnemonic # vendorName, traits> {
4549+
string spirvOpName = "Op" # mnemonic # vendorName;
4550+
}
4551+
4552+
class SPV_ExtVendorOp<string mnemonic, list<Trait> traits = []> :
4553+
SPV_VendorOp<mnemonic, "EXT", traits> {
4554+
}
4555+
4556+
class SPV_KhrVendorOp<string mnemonic, list<Trait> traits = []> :
4557+
SPV_VendorOp<mnemonic, "KHR", traits> {
4558+
}
4559+
4560+
class SPV_IntelVendorOp<string mnemonic, list<Trait> traits = []> :
4561+
SPV_VendorOp<mnemonic, "INTEL", traits> {
4562+
}
4563+
4564+
class SPV_NvVendorOp<string mnemonic, list<Trait> traits = []> :
4565+
SPV_VendorOp<mnemonic, "NV", traits> {
4566+
}
4567+
45444568
#endif // MLIR_DIALECT_SPIRV_IR_BASE

0 commit comments

Comments
 (0)