[Mlir-commits] [mlir] d48ceb4 - [MLIR][SPIRV] Rename `spv.undef` to `spv.Undef`.

Lei Zhang llvmlistbot at llvm.org
Fri Mar 5 12:49:52 PST 2021


Author: KareemErgawy-TomTom
Date: 2021-03-05T15:49:44-05:00
New Revision: d48ceb45e3026e2c40f0756cebbcb87d38e89c0e

URL: https://github.com/llvm/llvm-project/commit/d48ceb45e3026e2c40f0756cebbcb87d38e89c0e
DIFF: https://github.com/llvm/llvm-project/commit/d48ceb45e3026e2c40f0756cebbcb87d38e89c0e.diff

LOG: [MLIR][SPIRV] Rename `spv.undef` to `spv.Undef`.

To unify the naming scheme across all ops in the SPIR-V dialect, we are
moving from spv.camelCase to spv.CamelCase everywhere. For ops that
don't have a SPIR-V spec counterpart, we use spv.mlir.snake_case.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D98016

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/SPIRV/IR/SPIRVMiscOps.td
    mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td
    mlir/test/Conversion/SPIRVToLLVM/misc-ops-to-llvm.mlir
    mlir/test/Dialect/SPIRV/IR/misc-ops.mlir
    mlir/test/Dialect/SPIRV/Transforms/rewrite-inserts.mlir
    mlir/test/Target/SPIRV/undef.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVMiscOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVMiscOps.td
index 7e227c189564..498b28c5f78a 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVMiscOps.td
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVMiscOps.td
@@ -18,7 +18,7 @@ include "mlir/Dialect/SPIRV/IR/SPIRVBase.td"
 
 // -----
 
-def SPV_UndefOp : SPV_Op<"undef", []> {
+def SPV_UndefOp : SPV_Op<"Undef", []> {
   let summary = "Make an intermediate object whose value is undefined.";
 
   let description = [{
@@ -31,14 +31,14 @@ def SPV_UndefOp : SPV_Op<"undef", []> {
     <!-- End of AutoGen section -->
 
     ```
-    undef-op ::= `spv.undef` `:` spirv-type
+    undef-op ::= `spv.Undef` `:` spirv-type
     ```
 
     #### Example:
 
     ```mlir
-    %0 = spv.undef : f32
-    %1 = spv.undef : !spv.struct<!spv.array<4 x vector<4xi32>>>
+    %0 = spv.Undef : f32
+    %1 = spv.Undef : !spv.struct<!spv.array<4 x vector<4xi32>>>
     ```
   }];
 

diff  --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td
index 9c1375b8779c..0d787dd17cab 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td
@@ -622,7 +622,7 @@ def SPV_SpecConstantCompositeOp : SPV_Op<"SpecConstantComposite", [
     - A symbol referring of another spec constant.
     - The SSA ID of a non-specialization constant (i.e. defined through
       `spv.SpecConstant`).
-    - The SSA ID of a `spv.undef`.
+    - The SSA ID of a `spv.Undef`.
 
     ```
     spv-spec-constant-composite-op ::= `spv.SpecConstantComposite` symbol-ref-id ` (`

diff  --git a/mlir/test/Conversion/SPIRVToLLVM/misc-ops-to-llvm.mlir b/mlir/test/Conversion/SPIRVToLLVM/misc-ops-to-llvm.mlir
index 47263c079c8f..9281a308f03b 100644
--- a/mlir/test/Conversion/SPIRVToLLVM/misc-ops-to-llvm.mlir
+++ b/mlir/test/Conversion/SPIRVToLLVM/misc-ops-to-llvm.mlir
@@ -113,13 +113,13 @@ spv.module Logical OpenCL {
 // CHECK-LABEL: @undef_scalar
 spv.func @undef_scalar() "None" {
   // CHECK: llvm.mlir.undef : f32
-  %0 = spv.undef : f32
+  %0 = spv.Undef : f32
   spv.Return
 }
 
 // CHECK-LABEL: @undef_vector
 spv.func @undef_vector() "None" {
   // CHECK: llvm.mlir.undef : vector<2xi32>
-  %0 = spv.undef : vector<2xi32>
+  %0 = spv.Undef : vector<2xi32>
   spv.Return
 }

diff  --git a/mlir/test/Dialect/SPIRV/IR/misc-ops.mlir b/mlir/test/Dialect/SPIRV/IR/misc-ops.mlir
index 537dccee0b44..3a6006d542da 100644
--- a/mlir/test/Dialect/SPIRV/IR/misc-ops.mlir
+++ b/mlir/test/Dialect/SPIRV/IR/misc-ops.mlir
@@ -1,14 +1,14 @@
 // RUN: mlir-opt -split-input-file -verify-diagnostics %s | FileCheck %s
 
 //===----------------------------------------------------------------------===//
-// spv.undef
+// spv.Undef
 //===----------------------------------------------------------------------===//
 
 func @undef() -> () {
-  // CHECK: %{{.*}} = spv.undef : f32
-  %0 = spv.undef : f32
-  // CHECK: %{{.*}} = spv.undef : vector<4xf32>
-  %1 = spv.undef : vector<4xf32>
+  // CHECK: %{{.*}} = spv.Undef : f32
+  %0 = spv.Undef : f32
+  // CHECK: %{{.*}} = spv.Undef : vector<4xf32>
+  %1 = spv.Undef : vector<4xf32>
   spv.Return
 }
 
@@ -16,7 +16,7 @@ func @undef() -> () {
 
 func @undef() -> () {
   // expected-error @+2{{expected non-function type}}
-  %0 = spv.undef :
+  %0 = spv.Undef :
   spv.Return
 }
 
@@ -24,6 +24,6 @@ func @undef() -> () {
 
 func @undef() -> () {
   // expected-error @+2{{expected ':'}}
-  %0 = spv.undef
+  %0 = spv.Undef
   spv.Return
 }

diff  --git a/mlir/test/Dialect/SPIRV/Transforms/rewrite-inserts.mlir b/mlir/test/Dialect/SPIRV/Transforms/rewrite-inserts.mlir
index 719f00636fbb..af6c1ce3ca5d 100644
--- a/mlir/test/Dialect/SPIRV/Transforms/rewrite-inserts.mlir
+++ b/mlir/test/Dialect/SPIRV/Transforms/rewrite-inserts.mlir
@@ -2,26 +2,26 @@
 
 spv.module Logical GLSL450 {
   spv.func @rewrite(%value0 : f32, %value1 : f32, %value2 : f32, %value3 : i32, %value4: !spv.array<3xf32>) -> vector<3xf32> "None" {
-    %0 = spv.undef : vector<3xf32>
+    %0 = spv.Undef : vector<3xf32>
     // CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}}, {{%.*}} : vector<3xf32>
     %1 = spv.CompositeInsert %value0, %0[0 : i32] : f32 into vector<3xf32>
     %2 = spv.CompositeInsert %value1, %1[1 : i32] : f32 into vector<3xf32>
     %3 = spv.CompositeInsert %value2, %2[2 : i32] : f32 into vector<3xf32>
 
-    %4 = spv.undef : !spv.array<4xf32>
+    %4 = spv.Undef : !spv.array<4xf32>
     // CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}} : !spv.array<4 x f32>
     %5 = spv.CompositeInsert %value0, %4[0 : i32] : f32 into !spv.array<4xf32>
     %6 = spv.CompositeInsert %value1, %5[1 : i32] : f32 into !spv.array<4xf32>
     %7 = spv.CompositeInsert %value2, %6[2 : i32] : f32 into !spv.array<4xf32>
     %8 = spv.CompositeInsert %value0, %7[3 : i32] : f32 into !spv.array<4xf32>
 
-    %9 = spv.undef : !spv.struct<(f32, i32, f32)>
+    %9 = spv.Undef : !spv.struct<(f32, i32, f32)>
     // CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}}, {{%.*}} : !spv.struct<(f32, i32, f32)>
     %10 = spv.CompositeInsert %value0, %9[0 : i32] : f32 into !spv.struct<(f32, i32, f32)>
     %11 = spv.CompositeInsert %value3, %10[1 : i32] : i32 into !spv.struct<(f32, i32, f32)>
     %12 = spv.CompositeInsert %value1, %11[2 : i32] : f32 into !spv.struct<(f32, i32, f32)>
 
-    %13 = spv.undef : !spv.struct<(f32, !spv.array<3xf32>)>
+    %13 = spv.Undef : !spv.struct<(f32, !spv.array<3xf32>)>
     // CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}} : !spv.struct<(f32, !spv.array<3 x f32>)>
     %14 = spv.CompositeInsert %value0, %13[0 : i32] : f32 into !spv.struct<(f32, !spv.array<3xf32>)>
     %15 = spv.CompositeInsert %value4, %14[1 : i32] : !spv.array<3xf32> into !spv.struct<(f32, !spv.array<3xf32>)>

diff  --git a/mlir/test/Target/SPIRV/undef.mlir b/mlir/test/Target/SPIRV/undef.mlir
index efea01001fc6..0fa9a94e43f5 100644
--- a/mlir/test/Target/SPIRV/undef.mlir
+++ b/mlir/test/Target/SPIRV/undef.mlir
@@ -2,19 +2,19 @@
 
 spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
   spv.func @foo() -> () "None" {
-    // CHECK: {{%.*}} = spv.undef : f32
-    // CHECK-NEXT: {{%.*}} = spv.undef : f32
-    %0 = spv.undef : f32
-    %1 = spv.undef : f32
+    // CHECK: {{%.*}} = spv.Undef : f32
+    // CHECK-NEXT: {{%.*}} = spv.Undef : f32
+    %0 = spv.Undef : f32
+    %1 = spv.Undef : f32
     %2 = spv.FAdd %0, %1 : f32
-    // CHECK: {{%.*}} = spv.undef : vector<4xi32>
-    %3 = spv.undef : vector<4xi32>
+    // CHECK: {{%.*}} = spv.Undef : vector<4xi32>
+    %3 = spv.Undef : vector<4xi32>
     %4 = spv.CompositeExtract %3[1 : i32] : vector<4xi32>
-    // CHECK: {{%.*}} = spv.undef : !spv.array<4 x !spv.array<4 x i32>>
-    %5 = spv.undef : !spv.array<4x!spv.array<4xi32>>
+    // CHECK: {{%.*}} = spv.Undef : !spv.array<4 x !spv.array<4 x i32>>
+    %5 = spv.Undef : !spv.array<4x!spv.array<4xi32>>
     %6 = spv.CompositeExtract %5[1 : i32, 2 : i32] : !spv.array<4x!spv.array<4xi32>>
-    // CHECK: {{%.*}} = spv.undef : !spv.ptr<!spv.struct<(f32)>, StorageBuffer>
-    %7 = spv.undef : !spv.ptr<!spv.struct<(f32)>, StorageBuffer>
+    // CHECK: {{%.*}} = spv.Undef : !spv.ptr<!spv.struct<(f32)>, StorageBuffer>
+    %7 = spv.Undef : !spv.ptr<!spv.struct<(f32)>, StorageBuffer>
     %8 = spv.Constant 0 : i32
     %9 = spv.AccessChain %7[%8] : !spv.ptr<!spv.struct<(f32)>, StorageBuffer>, i32
     spv.Return
@@ -27,7 +27,7 @@ spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
   // CHECK: spv.func {{@.*}}
   spv.func @ignore_unused_undef() -> () "None" {
     // CHECK-NEXT: spv.Return
-    %0 = spv.undef : f32
+    %0 = spv.Undef : f32
     spv.Return
   }
 }


        


More information about the Mlir-commits mailing list