Skip to content

Commit adf9f64

Browse files
ergawyantiagainst
authored andcommitted
[MLIR][SPIRV] Rename spv._reference_of to spv.mlir.referenceof
This commit does the renaming mentioned in the title in order to bring 'spv' dialect closer to the MLIR naming conventions. Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D91715
1 parent 068da2c commit adf9f64

File tree

11 files changed

+46
-46
lines changed

11 files changed

+46
-46
lines changed

mlir/docs/Dialects/SPIR-V.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ instructions are represented in the SPIR-V dialect:
182182
needed to turn the symbol into an SSA value.
183183
* Specialization constants are defined with the `spv.specConstant` op. Similar
184184
to global variables, they do not generate SSA values and have symbols for
185-
reference, too. `spv._reference_of` is needed to turn the symbol into an SSA
185+
reference, too. `spv.mlir.referenceof` is needed to turn the symbol into an SSA
186186
value for use in a function block.
187187

188188
The above choices enables functions in the SPIR-V dialect to be isolated and
@@ -971,7 +971,7 @@ Similarly, a few transformations are performed during deserialization:
971971
`spv.mlir.addressof` op to turn the symbol of the corresponding
972972
`spv.globalVariable` into an SSA value.
973973
* Every use of a `OpSpecConstant` instruction will materialize a
974-
`spv._reference_of` op to turn the symbol of the corresponding
974+
`spv.mlir.referenceof` op to turn the symbol of the corresponding
975975
`spv.specConstant` into an SSA value.
976976
* `OpPhi` instructions are converted to block arguments.
977977
* Structured control flow are placed inside `spv.selection` and `spv.loop`.

mlir/docs/SPIRVToLLVMDialectConversion.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ As well as:
618618
* spv.GLSL.SSign
619619
* spv.GLSL.FSign
620620
* spv.MemoryBarrier
621-
* spv._reference_of
621+
* spv.mlir.referenceof
622622
* spv.SMod
623623
* spv.specConstant
624624
* spv.SubgroupBallotKHR

mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ def SPV_ModuleEndOp : SPV_Op<"_module_end", [InModuleScope, Terminator]> {
468468

469469
// -----
470470

471-
def SPV_ReferenceOfOp : SPV_Op<"_reference_of", [NoSideEffect]> {
471+
def SPV_ReferenceOfOp : SPV_Op<"mlir.referenceof", [NoSideEffect]> {
472472
let summary = "Reference a specialization constant.";
473473

474474
let description = [{
@@ -482,14 +482,14 @@ def SPV_ReferenceOfOp : SPV_Op<"_reference_of", [NoSideEffect]> {
482482
<!-- End of AutoGen section -->
483483

484484
```
485-
spv-reference-of-op ::= ssa-id `=` `spv._reference_of` symbol-ref-id
485+
spv-reference-of-op ::= ssa-id `=` `spv.mlir.referenceof` symbol-ref-id
486486
`:` spirv-scalar-type
487487
```
488488

489489
#### Example:
490490

491491
```mlir
492-
%0 = spv._reference_of @spec_const : f32
492+
%0 = spv.mlir.referenceof @spec_const : f32
493493
```
494494

495495
TODO Add support for composite specialization constants.

mlir/lib/Dialect/SPIRV/SPIRVOps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2571,7 +2571,7 @@ static LogicalResult verify(spirv::ModuleOp moduleOp) {
25712571
}
25722572

25732573
//===----------------------------------------------------------------------===//
2574-
// spv._reference_of
2574+
// spv.mlir.referenceof
25752575
//===----------------------------------------------------------------------===//
25762576

25772577
static LogicalResult verify(spirv::ReferenceOfOp referenceOfOp) {

mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ class Deserializer {
399399
/// Get the Value associated with a result <id>.
400400
///
401401
/// This method materializes normal constants and inserts "casting" ops
402-
/// (`spv.mlir.addressof` and `spv._reference_of`) to turn an symbol into a
402+
/// (`spv.mlir.addressof` and `spv.mlir.referenceof`) to turn an symbol into a
403403
/// SSA value for handling uses of module scope constants/variables in
404404
/// functions.
405405
Value getValue(uint32_t id);

mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/basic.mlir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// CHECK-NEXT: spv.specConstant @m1_sc
66
// CHECK-NEXT: spv.specConstant @m2_sc
77
// CHECK-NEXT: spv.func @variable_init_spec_constant
8-
// CHECK-NEXT: spv._reference_of @m2_sc
8+
// CHECK-NEXT: spv.mlir.referenceof @m2_sc
99
// CHECK-NEXT: spv.Variable init
1010
// CHECK-NEXT: spv.Return
1111
// CHECK-NEXT: }
@@ -20,7 +20,7 @@ spv.module Logical GLSL450 {
2020
spv.module Logical GLSL450 {
2121
spv.specConstant @m2_sc = 42 : i32
2222
spv.func @variable_init_spec_constant() -> () "None" {
23-
%0 = spv._reference_of @m2_sc : i32
23+
%0 = spv.mlir.referenceof @m2_sc : i32
2424
%1 = spv.Variable init(%0) : !spv.ptr<i32, Function>
2525
spv.Return
2626
}

mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/conflict_resolution.mlir

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ spv.module Logical GLSL450 {
363363

364364
// CHECK-NEXT: spv.specConstant @foo_1
365365
// CHECK-NEXT: spv.func @bar
366-
// CHECK-NEXT: spv._reference_of @foo_1
366+
// CHECK-NEXT: spv.mlir.referenceof @foo_1
367367
// CHECK-NEXT: spv.ReturnValue
368368
// CHECK-NEXT: }
369369
// CHECK-NEXT: }
@@ -379,7 +379,7 @@ spv.module Logical GLSL450 {
379379
spv.specConstant @foo = -5 : i32
380380

381381
spv.func @bar() -> i32 "None" {
382-
%0 = spv._reference_of @foo : i32
382+
%0 = spv.mlir.referenceof @foo : i32
383383
spv.ReturnValue %0 : i32
384384
}
385385
}
@@ -394,7 +394,7 @@ spv.module Logical GLSL450 {
394394
// CHECK-NEXT: spv.module Logical GLSL450 {
395395
// CHECK-NEXT: spv.specConstant @foo_1
396396
// CHECK-NEXT: spv.func @bar
397-
// CHECK-NEXT: spv._reference_of @foo_1
397+
// CHECK-NEXT: spv.mlir.referenceof @foo_1
398398
// CHECK-NEXT: spv.ReturnValue
399399
// CHECK-NEXT: }
400400

@@ -408,7 +408,7 @@ spv.module Logical GLSL450 {
408408
spv.specConstant @foo = -5 : i32
409409

410410
spv.func @bar() -> i32 "None" {
411-
%0 = spv._reference_of @foo : i32
411+
%0 = spv.mlir.referenceof @foo : i32
412412
spv.ReturnValue %0 : i32
413413
}
414414
}
@@ -461,7 +461,7 @@ spv.module Logical GLSL450 {
461461
// CHECK-NEXT: spv.specConstant @bar
462462
// CHECK-NEXT: spv.specConstantComposite @foo_1 (@bar, @bar)
463463
// CHECK-NEXT: spv.func @baz
464-
// CHECK-NEXT: spv._reference_of @foo_1
464+
// CHECK-NEXT: spv.mlir.referenceof @foo_1
465465
// CHECK-NEXT: spv.CompositeExtract
466466
// CHECK-NEXT: spv.ReturnValue
467467
// CHECK-NEXT: }
@@ -479,7 +479,7 @@ spv.module Logical GLSL450 {
479479
spv.specConstantComposite @foo (@bar, @bar) : !spv.array<2 x i32>
480480

481481
spv.func @baz() -> i32 "None" {
482-
%0 = spv._reference_of @foo : !spv.array<2 x i32>
482+
%0 = spv.mlir.referenceof @foo : !spv.array<2 x i32>
483483
%1 = spv.CompositeExtract %0[0 : i32] : !spv.array<2 x i32>
484484
spv.ReturnValue %1 : i32
485485
}
@@ -496,7 +496,7 @@ spv.module Logical GLSL450 {
496496
// CHECK-NEXT: spv.specConstant @bar
497497
// CHECK-NEXT: spv.specConstantComposite @foo_1 (@bar, @bar)
498498
// CHECK-NEXT: spv.func @baz
499-
// CHECK-NEXT: spv._reference_of @foo_1
499+
// CHECK-NEXT: spv.mlir.referenceof @foo_1
500500
// CHECK-NEXT: spv.CompositeExtract
501501
// CHECK-NEXT: spv.ReturnValue
502502
// CHECK-NEXT: }
@@ -512,7 +512,7 @@ spv.module Logical GLSL450 {
512512
spv.specConstantComposite @foo (@bar, @bar) : !spv.array<2 x i32>
513513

514514
spv.func @baz() -> i32 "None" {
515-
%0 = spv._reference_of @foo : !spv.array<2 x i32>
515+
%0 = spv.mlir.referenceof @foo : !spv.array<2 x i32>
516516
%1 = spv.CompositeExtract %0[0 : i32] : !spv.array<2 x i32>
517517
spv.ReturnValue %1 : i32
518518
}
@@ -535,7 +535,7 @@ spv.module Logical GLSL450 {
535535
// CHECK-NEXT: spv.specConstant @bar_1
536536
// CHECK-NEXT: spv.specConstantComposite @foo_2 (@bar_1, @bar_1)
537537
// CHECK-NEXT: spv.func @baz
538-
// CHECK-NEXT: spv._reference_of @foo_2
538+
// CHECK-NEXT: spv.mlir.referenceof @foo_2
539539
// CHECK-NEXT: spv.CompositeExtract
540540
// CHECK-NEXT: spv.ReturnValue
541541
// CHECK-NEXT: }
@@ -555,7 +555,7 @@ spv.module Logical GLSL450 {
555555
spv.specConstantComposite @foo (@bar, @bar) : !spv.array<2 x i32>
556556

557557
spv.func @baz() -> i32 "None" {
558-
%0 = spv._reference_of @foo : !spv.array<2 x i32>
558+
%0 = spv.mlir.referenceof @foo : !spv.array<2 x i32>
559559
%1 = spv.CompositeExtract %0[0 : i32] : !spv.array<2 x i32>
560560
spv.ReturnValue %1 : i32
561561
}

mlir/test/Dialect/SPIRV/Serialization/logical-ops.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
8787
spv.func @select() -> () "None" {
8888
%0 = spv.constant 4.0 : f32
8989
%1 = spv.constant 5.0 : f32
90-
%2 = spv._reference_of @condition_scalar : i1
90+
%2 = spv.mlir.referenceof @condition_scalar : i1
9191
// CHECK: spv.Select {{.*}}, {{.*}}, {{.*}} : i1, f32
9292
%3 = spv.Select %2, %0, %1 : i1, f32
9393
%4 = spv.constant dense<[2.0, 3.0, 4.0, 5.0]> : vector<4xf32>

mlir/test/Dialect/SPIRV/Serialization/spec-constant.mlir

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,28 @@ spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
1717

1818
// CHECK-LABEL: @use
1919
spv.func @use() -> (i32) "None" {
20-
// We materialize a `spv._reference_of` op at every use of a
20+
// We materialize a `spv.mlir.referenceof` op at every use of a
2121
// specialization constant in the deserializer. So two ops here.
22-
// CHECK: %[[USE1:.*]] = spv._reference_of @sc_int : i32
23-
// CHECK: %[[USE2:.*]] = spv._reference_of @sc_int : i32
22+
// CHECK: %[[USE1:.*]] = spv.mlir.referenceof @sc_int : i32
23+
// CHECK: %[[USE2:.*]] = spv.mlir.referenceof @sc_int : i32
2424
// CHECK: spv.IAdd %[[USE1]], %[[USE2]]
2525

26-
%0 = spv._reference_of @sc_int : i32
26+
%0 = spv.mlir.referenceof @sc_int : i32
2727
%1 = spv.IAdd %0, %0 : i32
2828
spv.ReturnValue %1 : i32
2929
}
3030

3131
// CHECK-LABEL: @use
3232
spv.func @use_composite() -> (i32) "None" {
33-
// We materialize a `spv._reference_of` op at every use of a
33+
// We materialize a `spv.mlir.referenceof` op at every use of a
3434
// specialization constant in the deserializer. So two ops here.
35-
// CHECK: %[[USE1:.*]] = spv._reference_of @scc : !spv.array<2 x i32>
35+
// CHECK: %[[USE1:.*]] = spv.mlir.referenceof @scc : !spv.array<2 x i32>
3636
// CHECK: %[[ITM0:.*]] = spv.CompositeExtract %[[USE1]][0 : i32] : !spv.array<2 x i32>
37-
// CHECK: %[[USE2:.*]] = spv._reference_of @scc : !spv.array<2 x i32>
37+
// CHECK: %[[USE2:.*]] = spv.mlir.referenceof @scc : !spv.array<2 x i32>
3838
// CHECK: %[[ITM1:.*]] = spv.CompositeExtract %[[USE2]][1 : i32] : !spv.array<2 x i32>
3939
// CHECK: spv.IAdd %[[ITM0]], %[[ITM1]]
4040

41-
%0 = spv._reference_of @scc : !spv.array<2 x i32>
41+
%0 = spv.mlir.referenceof @scc : !spv.array<2 x i32>
4242
%1 = spv.CompositeExtract %0[0 : i32] : !spv.array<2 x i32>
4343
%2 = spv.CompositeExtract %0[1 : i32] : !spv.array<2 x i32>
4444
%3 = spv.IAdd %1, %2 : i32

mlir/test/Dialect/SPIRV/ops.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ spv.module Logical GLSL450 {
12371237
spv.specConstant @sc = 42 : i32
12381238
// CHECK-LABEL: @variable_init_spec_constant
12391239
spv.func @variable_init_spec_constant() -> () "None" {
1240-
%0 = spv._reference_of @sc : i32
1240+
%0 = spv.mlir.referenceof @sc : i32
12411241
// CHECK: spv.Variable init(%0) : !spv.ptr<i32, Function>
12421242
%1 = spv.Variable init(%0) : !spv.ptr<i32, Function>
12431243
spv.Return

0 commit comments

Comments
 (0)