Skip to content

Commit 817de30

Browse files
committed
[mlir][spirv] Change vendor op mnemonics to spv.VENDOR.name
Make vendor ops more consistent with the naming scheme within the SPIR-V dialect. Issue: llvm/llvm-project#56863 Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D133247
1 parent b8bea83 commit 817de30

19 files changed

+144
-144
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,14 +290,14 @@ def SPV_EXTAtomicFAddOp : SPV_ExtVendorOp<"AtomicFAdd", []> {
290290

291291
```
292292
atomic-fadd-op ::=
293-
`spv.AtomicFAddEXT` scope memory-semantics
293+
`spv.EXT.AtomicFAdd` scope memory-semantics
294294
ssa-use `,` ssa-use `:` spv-pointer-type
295295
```
296296

297297
#### Example:
298298

299299
```mlir
300-
%0 = spv.AtomicFAddEXT "Device" "None" %pointer, %value :
300+
%0 = spv.EXT.AtomicFAdd "Device" "None" %pointer, %value :
301301
!spv.ptr<f32, StorageBuffer>
302302
```mlir
303303
}];

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4545,7 +4545,7 @@ class SPV_ExtInstOp<string mnemonic, string setPrefix, string setName,
45454545
// Op<Name><VENDOR>, e.g., OpCooperativeMatrixStoreNV.
45464546
class SPV_VendorOp<string mnemonic, string vendorName,
45474547
list<Trait> traits = []> :
4548-
SPV_Op<mnemonic # vendorName, traits> {
4548+
SPV_Op<vendorName # "." # mnemonic, traits> {
45494549
string spirvOpName = "Op" # mnemonic # vendorName;
45504550
}
45514551

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ def SPV_NVCooperativeMatrixLengthOp : SPV_NvVendorOp<"CooperativeMatrixLength",
2828
Type is a cooperative matrix type.
2929

3030
``` {.ebnf}
31-
cooperative-matrix-length-op ::= ssa-id `=` `spv.CooperativeMatrixLengthNV
31+
cooperative-matrix-length-op ::= ssa-id `=` `spv.NV.CooperativeMatrixLength
3232
` : ` cooperative-matrix-type
3333
```
3434

3535
For example:
3636

3737
```
38-
%0 = spv.CooperativeMatrixLengthNV : !spv.coopmatrix<Subgroup, i32, 8, 16>
38+
%0 = spv.NV.CooperativeMatrixLength : !spv.coopmatrix<Subgroup, i32, 8, 16>
3939
```
4040
}];
4141

@@ -100,7 +100,7 @@ def SPV_NVCooperativeMatrixLoadOp : SPV_NvVendorOp<"CooperativeMatrixLoad", []>
100100
### Custom assembly form
101101

102102
``` {.ebnf}
103-
cooperative-matrixload-op ::= ssa-id `=` `spv.CooperativeMatrixLoadNV`
103+
cooperative-matrixload-op ::= ssa-id `=` `spv.NV.CooperativeMatrixLoad`
104104
ssa-use `,` ssa-use `,` ssa-use
105105
(`[` memory-access `]`)? ` : `
106106
pointer-type `as`
@@ -110,7 +110,7 @@ def SPV_NVCooperativeMatrixLoadOp : SPV_NvVendorOp<"CooperativeMatrixLoad", []>
110110
For example:
111111

112112
```
113-
%0 = spv.CooperativeMatrixLoadNV %ptr, %stride, %colMajor
113+
%0 = spv.NV.CooperativeMatrixLoad %ptr, %stride, %colMajor
114114
: !spv.ptr<i32, StorageBuffer> as !spv.coopmatrix<i32, Workgroup, 16, 8>
115115
```
116116
}];
@@ -172,7 +172,7 @@ def SPV_NVCooperativeMatrixMulAddOp : SPV_NvVendorOp<"CooperativeMatrixMulAdd",
172172
the scope of the operation).
173173

174174
``` {.ebnf}
175-
cooperative-matrixmuladd-op ::= ssa-id `=` `spv.CooperativeMatrixMulAddNV`
175+
cooperative-matrixmuladd-op ::= ssa-id `=` `spv.NV.CooperativeMatrixMulAdd`
176176
ssa-use `,` ssa-use `,` ssa-use ` : `
177177
a-cooperative-matrix-type,
178178
b-cooperative-matrix-type ->
@@ -181,7 +181,7 @@ def SPV_NVCooperativeMatrixMulAddOp : SPV_NvVendorOp<"CooperativeMatrixMulAdd",
181181
For example:
182182

183183
```
184-
%0 = spv.CooperativeMatrixMulAddNV %arg0, %arg1, %arg2, :
184+
%0 = spv.NV.CooperativeMatrixMulAdd %arg0, %arg1, %arg2, :
185185
!spv.coopmatrix<Subgroup, i32, 8, 16>
186186
```
187187
}];
@@ -236,7 +236,7 @@ def SPV_NVCooperativeMatrixStoreOp : SPV_NvVendorOp<"CooperativeMatrixStore", []
236236
same as specifying None.
237237

238238
``` {.ebnf}
239-
coop-matrix-store-op ::= `spv.CooperativeMatrixStoreNV `
239+
coop-matrix-store-op ::= `spv.NV.CooperativeMatrixStore `
240240
ssa-use `, ` ssa-use `, `
241241
ssa-use `, ` ssa-use `, `
242242
(`[` memory-access `]`)? `:`
@@ -246,7 +246,7 @@ def SPV_NVCooperativeMatrixStoreOp : SPV_NvVendorOp<"CooperativeMatrixStore", []
246246
For example:
247247

248248
```
249-
spv.CooperativeMatrixStoreNV %arg0, %arg2, %arg1, %arg3 :
249+
spv.NV.CooperativeMatrixStore %arg0, %arg2, %arg1, %arg3 :
250250
!spv.ptr<i32, StorageBuffer>, !spv.coopmatrix<Workgroup, i32, 16, 8>
251251
```
252252
}];

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ def SPV_KHRSubgroupBallotOp : SPV_KhrVendorOp<"SubgroupBallot", []> {
113113
<!-- End of AutoGen section -->
114114

115115
```
116-
subgroup-ballot-op ::= ssa-id `=` `spv.SubgroupBallotKHR`
116+
subgroup-ballot-op ::= ssa-id `=` `spv.KHR.SubgroupBallot`
117117
ssa-use `:` `vector` `<` 4 `x` `i32` `>`
118118
```
119119

120120
#### Example:
121121

122122
```mlir
123-
%0 = spv.SubgroupBallotKHR %predicate : vector<4xi32>
123+
%0 = spv.KHR.SubgroupBallot %predicate : vector<4xi32>
124124
```
125125
}];
126126

@@ -168,14 +168,14 @@ def SPV_INTELSubgroupBlockReadOp : SPV_IntelVendorOp<"SubgroupBlockRead", []> {
168168
<!-- End of AutoGen section -->
169169

170170
```
171-
subgroup-block-read-INTEL-op ::= ssa-id `=` `spv.SubgroupBlockReadINTEL`
171+
subgroup-block-read-INTEL-op ::= ssa-id `=` `spv.INTEL.SubgroupBlockRead`
172172
storage-class ssa_use `:` spirv-element-type
173173
```mlir
174174

175175
#### Example:
176176

177177
```
178-
%0 = spv.SubgroupBlockReadINTEL "StorageBuffer" %ptr : i32
178+
%0 = spv.INTEL.SubgroupBlockRead "StorageBuffer" %ptr : i32
179179
```
180180
}];
181181

@@ -218,14 +218,14 @@ def SPV_INTELSubgroupBlockWriteOp : SPV_IntelVendorOp<"SubgroupBlockWrite", []>
218218
<!-- End of AutoGen section -->
219219

220220
```
221-
subgroup-block-write-INTEL-op ::= ssa-id `=` `spv.SubgroupBlockWriteINTEL`
221+
subgroup-block-write-INTEL-op ::= ssa-id `=` `spv.INTEL.SubgroupBlockWrite`
222222
storage-class ssa_use `,` ssa-use `:` spirv-element-type
223223
```mlir
224224

225225
#### Example:
226226

227227
```
228-
spv.SubgroupBlockWriteINTEL "StorageBuffer" %ptr, %value : i32
228+
spv.INTEL.SubgroupBlockWrite "StorageBuffer" %ptr, %value : i32
229229
```
230230
}];
231231

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ def SPV_INTELJointMatrixWorkItemLengthOp : SPV_IntelVendorOp<"JointMatrixWorkIte
2828
Type is a joint matrix type.
2929

3030
``` {.ebnf}
31-
joint-matrix-length-op ::= ssa-id `=` `spv.JointMatrixWorkItemLengthINTEL
31+
joint-matrix-length-op ::= ssa-id `=` `spv.INTEL.JointMatrixWorkItemLength
3232
` : ` joint-matrix-type
3333
```
3434

3535
For example:
3636

3737
```
38-
%0 = spv.JointMatrixWorkItemLengthINTEL : !spv.jointmatrix<Subgroup, i32, 8, 16>
38+
%0 = spv.INTEL.JointMatrixWorkItemLength : !spv.jointmatrix<Subgroup, i32, 8, 16>
3939
```
4040
}];
4141

@@ -85,7 +85,7 @@ def SPV_INTELJointMatrixLoadOp : SPV_IntelVendorOp<"JointMatrixLoad", []> {
8585

8686
#### Example:
8787
```mlir
88-
%0 = spv.JointMatrixLoadINTEL <Subgroup> <RowMajor> %ptr, %stride
88+
%0 = spv.INTEL.JointMatrixLoad <Subgroup> <RowMajor> %ptr, %stride
8989
{memory_access = #spv.memory_access<Volatile>} :
9090
(!spv.ptr<i32, CrossWorkgroup>, i32) ->
9191
!spv.jointmatrix<8x16xi32, ColumnMajor, Subgroup>
@@ -149,7 +149,7 @@ def SPV_INTELJointMatrixMadOp : SPV_IntelVendorOp<"JointMatrixMad",
149149

150150
#### Example:
151151
```mlir
152-
%r = spv.JointMatrixMadINTEL <Subgroup> %a, %b, %c :
152+
%r = spv.INTEL.JointMatrixMad <Subgroup> %a, %b, %c :
153153
!spv.jointmatrix<8x32xi8, RowMajor, Subgroup>,
154154
!spv.jointmatrix<32x8xi8, ColumnMajor, Subgroup>
155155
-> !spv.jointmatrix<8x8xi32, RowMajor, Subgroup>
@@ -212,7 +212,7 @@ def SPV_INTELJointMatrixStoreOp : SPV_IntelVendorOp<"JointMatrixStore", []> {
212212

213213
#### Example:
214214
```mlir
215-
spv.JointMatrixStoreINTEL <Subgroup> <ColumnMajor> %ptr, %m, %stride
215+
spv.INTEL.JointMatrixStore <Subgroup> <ColumnMajor> %ptr, %m, %stride
216216
{memory_access = #spv.memory_access<Volatile>} : (!spv.ptr<i32, Workgroup>,
217217
!spv.jointmatrix<8x16xi32, RowMajor, Subgroup>, i32)
218218
```

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ def SPV_KHRAssumeTrueOp : SPV_KhrVendorOp<"AssumeTrue", []> {
2727
<!-- End of AutoGen section -->
2828

2929
```
30-
assumetruekhr-op ::= `spv.AssumeTrueKHR` ssa-use
30+
assumetruekhr-op ::= `spv.KHR.AssumeTrue` ssa-use
3131
```mlir
3232

3333
#### Example:
3434

3535
```
36-
spv.AssumeTrueKHR %arg
36+
spv.KHR.AssumeTrue %arg
3737
```
3838
}];
3939

mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ void spirv::AtomicIAddOp::print(OpAsmPrinter &p) {
13321332
}
13331333

13341334
//===----------------------------------------------------------------------===//
1335-
// spv.AtomicFAddEXTOp
1335+
// spv.EXT.AtomicFAddOp
13361336
//===----------------------------------------------------------------------===//
13371337

13381338
LogicalResult spirv::EXTAtomicFAddOp::verify() {
@@ -2643,7 +2643,7 @@ LogicalResult spirv::GroupNonUniformShuffleXorOp::verify() {
26432643
}
26442644

26452645
//===----------------------------------------------------------------------===//
2646-
// spv.SubgroupBlockReadINTEL
2646+
// spv.INTEL.SubgroupBlockRead
26472647
//===----------------------------------------------------------------------===//
26482648

26492649
ParseResult spirv::INTELSubgroupBlockReadOp::parse(OpAsmParser &parser,
@@ -2681,7 +2681,7 @@ LogicalResult spirv::INTELSubgroupBlockReadOp::verify() {
26812681
}
26822682

26832683
//===----------------------------------------------------------------------===//
2684-
// spv.SubgroupBlockWriteINTEL
2684+
// spv.INTEL.SubgroupBlockWrite
26852685
//===----------------------------------------------------------------------===//
26862686

26872687
ParseResult spirv::INTELSubgroupBlockWriteOp::parse(OpAsmParser &parser,
@@ -3813,7 +3813,7 @@ LogicalResult spirv::VectorShuffleOp::verify() {
38133813
}
38143814

38153815
//===----------------------------------------------------------------------===//
3816-
// spv.CooperativeMatrixLoadNV
3816+
// spv.NV.CooperativeMatrixLoad
38173817
//===----------------------------------------------------------------------===//
38183818

38193819
ParseResult spirv::NVCooperativeMatrixLoadOp::parse(OpAsmParser &parser,
@@ -3871,7 +3871,7 @@ LogicalResult spirv::NVCooperativeMatrixLoadOp::verify() {
38713871
}
38723872

38733873
//===----------------------------------------------------------------------===//
3874-
// spv.CooperativeMatrixStoreNV
3874+
// spv.NV.CooperativeMatrixStore
38753875
//===----------------------------------------------------------------------===//
38763876

38773877
ParseResult spirv::NVCooperativeMatrixStoreOp::parse(OpAsmParser &parser,
@@ -3911,7 +3911,7 @@ LogicalResult spirv::NVCooperativeMatrixStoreOp::verify() {
39113911
}
39123912

39133913
//===----------------------------------------------------------------------===//
3914-
// spv.CooperativeMatrixMulAddNV
3914+
// spv.NV.CooperativeMatrixMulAdd
39153915
//===----------------------------------------------------------------------===//
39163916

39173917
static LogicalResult
@@ -3960,7 +3960,7 @@ verifyPointerAndJointMatrixType(Operation *op, Type pointer, Type jointMatrix) {
39603960
}
39613961

39623962
//===----------------------------------------------------------------------===//
3963-
// spv.JointMatrixLoadINTEL
3963+
// spv.INTEL.JointMatrixLoad
39643964
//===----------------------------------------------------------------------===//
39653965

39663966
LogicalResult spirv::INTELJointMatrixLoadOp::verify() {
@@ -3969,7 +3969,7 @@ LogicalResult spirv::INTELJointMatrixLoadOp::verify() {
39693969
}
39703970

39713971
//===----------------------------------------------------------------------===//
3972-
// spv.JointMatrixStoreINTEL
3972+
// spv.INTEL.JointMatrixStore
39733973
//===----------------------------------------------------------------------===//
39743974

39753975
LogicalResult spirv::INTELJointMatrixStoreOp::verify() {
@@ -3978,7 +3978,7 @@ LogicalResult spirv::INTELJointMatrixStoreOp::verify() {
39783978
}
39793979

39803980
//===----------------------------------------------------------------------===//
3981-
// spv.JointMatrixMadINTEL
3981+
// spv.INTEL.JointMatrixMad
39823982
//===----------------------------------------------------------------------===//
39833983

39843984
static LogicalResult verifyJointMatrixMad(spirv::INTELJointMatrixMadOp op) {

mlir/test/Dialect/SPIRV/IR/atomic-ops.mlir

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,35 +240,35 @@ func.func @atomic_xor(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32
240240
// -----
241241

242242
//===----------------------------------------------------------------------===//
243-
// spv.AtomicFAddEXT
243+
// spv.EXT.AtomicFAdd
244244
//===----------------------------------------------------------------------===//
245245

246246
func.func @atomic_fadd(%ptr : !spv.ptr<f32, StorageBuffer>, %value : f32) -> f32 {
247-
// CHECK: spv.AtomicFAddEXT "Device" "None" %{{.*}}, %{{.*}} : !spv.ptr<f32, StorageBuffer>
248-
%0 = spv.AtomicFAddEXT "Device" "None" %ptr, %value : !spv.ptr<f32, StorageBuffer>
247+
// CHECK: spv.EXT.AtomicFAdd "Device" "None" %{{.*}}, %{{.*}} : !spv.ptr<f32, StorageBuffer>
248+
%0 = spv.EXT.AtomicFAdd "Device" "None" %ptr, %value : !spv.ptr<f32, StorageBuffer>
249249
return %0 : f32
250250
}
251251

252252
// -----
253253

254254
func.func @atomic_fadd(%ptr : !spv.ptr<i32, StorageBuffer>, %value : f32) -> f32 {
255255
// expected-error @+1 {{pointer operand must point to an float value, found 'i32'}}
256-
%0 = "spv.AtomicFAddEXT"(%ptr, %value) {memory_scope = #spv.scope<Workgroup>, semantics = #spv.memory_semantics<AcquireRelease>} : (!spv.ptr<i32, StorageBuffer>, f32) -> (f32)
256+
%0 = "spv.EXT.AtomicFAdd"(%ptr, %value) {memory_scope = #spv.scope<Workgroup>, semantics = #spv.memory_semantics<AcquireRelease>} : (!spv.ptr<i32, StorageBuffer>, f32) -> (f32)
257257
return %0 : f32
258258
}
259259

260260
// -----
261261

262262
func.func @atomic_fadd(%ptr : !spv.ptr<f32, StorageBuffer>, %value : f64) -> f64 {
263263
// expected-error @+1 {{expected value to have the same type as the pointer operand's pointee type 'f32', but found 'f64'}}
264-
%0 = "spv.AtomicFAddEXT"(%ptr, %value) {memory_scope = #spv.scope<Device>, semantics = #spv.memory_semantics<AcquireRelease>} : (!spv.ptr<f32, StorageBuffer>, f64) -> (f64)
264+
%0 = "spv.EXT.AtomicFAdd"(%ptr, %value) {memory_scope = #spv.scope<Device>, semantics = #spv.memory_semantics<AcquireRelease>} : (!spv.ptr<f32, StorageBuffer>, f64) -> (f64)
265265
return %0 : f64
266266
}
267267

268268
// -----
269269

270270
func.func @atomic_fadd(%ptr : !spv.ptr<f32, StorageBuffer>, %value : f32) -> f32 {
271271
// expected-error @+1 {{expected at most one of these four memory constraints to be set: `Acquire`, `Release`,`AcquireRelease` or `SequentiallyConsistent`}}
272-
%0 = spv.AtomicFAddEXT "Device" "Acquire|Release" %ptr, %value : !spv.ptr<f32, StorageBuffer>
272+
%0 = spv.EXT.AtomicFAdd "Device" "Acquire|Release" %ptr, %value : !spv.ptr<f32, StorageBuffer>
273273
return %0 : f32
274274
}

0 commit comments

Comments
 (0)