summaryrefslogtreecommitdiffstats
path: root/mlir/test/Dialect/SPIRV/Serialization
diff options
context:
space:
mode:
authorLei Zhang <antiagainst@google.com>2019-09-23 19:56:49 -0700
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-09-23 19:57:17 -0700
commit6caa4f500b149fd74086e60ff5dbcd33a826c30e (patch)
treec696dbab122a9f7ef408bbba56e33d76db1abf06 /mlir/test/Dialect/SPIRV/Serialization
parent69af46875479c33cf40fdad96f1517260f9f33fb (diff)
downloadbcm5719-llvm-6caa4f500b149fd74086e60ff5dbcd33a826c30e.tar.gz
bcm5719-llvm-6caa4f500b149fd74086e60ff5dbcd33a826c30e.zip
[spirv] NFC: clean up (de)serialization tests
This CL uses the newly added -split-input-file CLI option to mlir-translate to combine certain (de)serialization tests. It also renames certain test filenames. PiperOrigin-RevId: 270816324
Diffstat (limited to 'mlir/test/Dialect/SPIRV/Serialization')
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/arithmetic-ops.mlir (renamed from mlir/test/Dialect/SPIRV/Serialization/bin_ops.mlir)50
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/array.mlir (renamed from mlir/test/Dialect/SPIRV/Serialization/array_stride.mlir)11
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/capability.mlir7
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/entry-point.mlir (renamed from mlir/test/Dialect/SPIRV/Serialization/entry_interface.mlir)14
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/entry.mlir11
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/execution-mode.mlir (renamed from mlir/test/Dialect/SPIRV/Serialization/execution_mode.mlir)0
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/extension.mlir8
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/function-call.mlir (renamed from mlir/test/Dialect/SPIRV/Serialization/function_call.mlir)0
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/global-variable.mlir36
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/glsl-ops.mlir (renamed from mlir/test/Dialect/SPIRV/Serialization/glslops.mlir)0
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/load_store.mlir13
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/logical-ops.mlir75
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/memory-ops.mlir (renamed from mlir/test/Dialect/SPIRV/Serialization/access_chain.mlir)16
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/minimal-module.mlir13
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/module.mlir30
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/rtarray.mlir8
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/select.mlir20
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/spec-constant.mlir (renamed from mlir/test/Dialect/SPIRV/Serialization/spec_constant.mlir)0
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/variable_reference.mlir13
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/variables.mlir13
-rw-r--r--mlir/test/Dialect/SPIRV/Serialization/variables_init.mlir8
21 files changed, 179 insertions, 167 deletions
diff --git a/mlir/test/Dialect/SPIRV/Serialization/bin_ops.mlir b/mlir/test/Dialect/SPIRV/Serialization/arithmetic-ops.mlir
index 0521cf7a729..0389a169b79 100644
--- a/mlir/test/Dialect/SPIRV/Serialization/bin_ops.mlir
+++ b/mlir/test/Dialect/SPIRV/Serialization/arithmetic-ops.mlir
@@ -71,54 +71,4 @@ spv.module "Logical" "GLSL450" {
%0 = spv.SRem %arg0, %arg1 : vector<4xi32>
spv.Return
}
- func @iequal_scalar(%arg0: i32, %arg1: i32) {
- // CHECK: {{.*}} = spv.IEqual {{.*}}, {{.*}} : i32
- %0 = spv.IEqual %arg0, %arg1 : i32
- spv.Return
- }
- func @inotequal_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
- // CHECK: {{.*}} = spv.INotEqual {{.*}}, {{.*}} : vector<4xi32>
- %0 = spv.INotEqual %arg0, %arg1 : vector<4xi32>
- spv.Return
- }
- func @sgt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
- // CHECK: {{.*}} = spv.SGreaterThan {{.*}}, {{.*}} : vector<4xi32>
- %0 = spv.SGreaterThan %arg0, %arg1 : vector<4xi32>
- spv.Return
- }
- func @sge_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
- // CHECK: {{.*}} = spv.SGreaterThanEqual {{.*}}, {{.*}} : vector<4xi32>
- %0 = spv.SGreaterThanEqual %arg0, %arg1 : vector<4xi32>
- spv.Return
- }
- func @slt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
- // CHECK: {{.*}} = spv.SLessThan {{.*}}, {{.*}} : vector<4xi32>
- %0 = spv.SLessThan %arg0, %arg1 : vector<4xi32>
- spv.Return
- }
- func @slte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
- // CHECK: {{.*}} = spv.SLessThanEqual {{.*}}, {{.*}} : vector<4xi32>
- %0 = spv.SLessThanEqual %arg0, %arg1 : vector<4xi32>
- spv.Return
- }
- func @ugt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
- // CHECK: {{.*}} = spv.UGreaterThan {{.*}}, {{.*}} : vector<4xi32>
- %0 = spv.UGreaterThan %arg0, %arg1 : vector<4xi32>
- spv.Return
- }
- func @ugte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
- // CHECK: {{.*}} = spv.UGreaterThanEqual {{.*}}, {{.*}} : vector<4xi32>
- %0 = spv.UGreaterThanEqual %arg0, %arg1 : vector<4xi32>
- spv.Return
- }
- func @ult_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
- // CHECK: {{.*}} = spv.ULessThan {{.*}}, {{.*}} : vector<4xi32>
- %0 = spv.ULessThan %arg0, %arg1 : vector<4xi32>
- spv.Return
- }
- func @ulte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
- // CHECK: {{.*}} = spv.ULessThanEqual {{.*}}, {{.*}} : vector<4xi32>
- %0 = spv.ULessThanEqual %arg0, %arg1 : vector<4xi32>
- spv.Return
- }
}
diff --git a/mlir/test/Dialect/SPIRV/Serialization/array_stride.mlir b/mlir/test/Dialect/SPIRV/Serialization/array.mlir
index 691a67f108a..9dfef23fb39 100644
--- a/mlir/test/Dialect/SPIRV/Serialization/array_stride.mlir
+++ b/mlir/test/Dialect/SPIRV/Serialization/array.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
+// RUN: mlir-translate -split-input-file -test-spirv-roundtrip %s | FileCheck %s
spv.module "Logical" "GLSL450" {
func @array_stride(%arg0 : !spv.ptr<!spv.array<4x!spv.array<4xf32 [4]> [128]>, StorageBuffer>,
@@ -8,3 +8,12 @@ spv.module "Logical" "GLSL450" {
spv.Return
}
}
+
+// -----
+
+spv.module "Logical" "GLSL450" {
+ // CHECK: spv.globalVariable {{@.*}} : !spv.ptr<!spv.rtarray<f32>, StorageBuffer>
+ spv.globalVariable @var0 : !spv.ptr<!spv.rtarray<f32>, StorageBuffer>
+ // CHECK: spv.globalVariable {{@.*}} : !spv.ptr<!spv.rtarray<vector<4xf16>>, Input>
+ spv.globalVariable @var1 : !spv.ptr<!spv.rtarray<vector<4xf16>>, Input>
+}
diff --git a/mlir/test/Dialect/SPIRV/Serialization/capability.mlir b/mlir/test/Dialect/SPIRV/Serialization/capability.mlir
deleted file mode 100644
index 32885b2de21..00000000000
--- a/mlir/test/Dialect/SPIRV/Serialization/capability.mlir
+++ /dev/null
@@ -1,7 +0,0 @@
-// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
-
-spv.module "Logical" "GLSL450" {
-} attributes {
- // CHECK: capabilities = ["Shader", "Float16"]
- capabilities = ["Shader", "Float16"]
-}
diff --git a/mlir/test/Dialect/SPIRV/Serialization/entry_interface.mlir b/mlir/test/Dialect/SPIRV/Serialization/entry-point.mlir
index 6ce06f02ca1..be5ac0bc1a0 100644
--- a/mlir/test/Dialect/SPIRV/Serialization/entry_interface.mlir
+++ b/mlir/test/Dialect/SPIRV/Serialization/entry-point.mlir
@@ -1,4 +1,16 @@
-// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
+// RUN: mlir-translate -test-spirv-roundtrip -split-input-file %s | FileCheck %s
+
+spv.module "Logical" "GLSL450" {
+ func @noop() -> () {
+ spv.Return
+ }
+ // CHECK: spv.EntryPoint "GLCompute" @noop
+ // CHECK-NEXT: spv.ExecutionMode @noop "ContractionOff"
+ spv.EntryPoint "GLCompute" @noop
+ spv.ExecutionMode @noop "ContractionOff"
+}
+
+// -----
spv.module "Logical" "GLSL450" {
// CHECK: spv.globalVariable @var2 : !spv.ptr<f32, Input>
diff --git a/mlir/test/Dialect/SPIRV/Serialization/entry.mlir b/mlir/test/Dialect/SPIRV/Serialization/entry.mlir
deleted file mode 100644
index 93cf953775d..00000000000
--- a/mlir/test/Dialect/SPIRV/Serialization/entry.mlir
+++ /dev/null
@@ -1,11 +0,0 @@
-// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
-
-spv.module "Logical" "GLSL450" {
- func @noop() -> () {
- spv.Return
- }
- // CHECK: spv.EntryPoint "GLCompute" @noop
- // CHECK-NEXT: spv.ExecutionMode @noop "ContractionOff"
- spv.EntryPoint "GLCompute" @noop
- spv.ExecutionMode @noop "ContractionOff"
-}
diff --git a/mlir/test/Dialect/SPIRV/Serialization/execution_mode.mlir b/mlir/test/Dialect/SPIRV/Serialization/execution-mode.mlir
index ad3ba1eb5da..ad3ba1eb5da 100644
--- a/mlir/test/Dialect/SPIRV/Serialization/execution_mode.mlir
+++ b/mlir/test/Dialect/SPIRV/Serialization/execution-mode.mlir
diff --git a/mlir/test/Dialect/SPIRV/Serialization/extension.mlir b/mlir/test/Dialect/SPIRV/Serialization/extension.mlir
deleted file mode 100644
index 4c9f52b831b..00000000000
--- a/mlir/test/Dialect/SPIRV/Serialization/extension.mlir
+++ /dev/null
@@ -1,8 +0,0 @@
-// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
-
-spv.module "Logical" "GLSL450" {
-} attributes {
- // CHECK: extensions = ["SPV_KHR_float_controls", "SPV_KHR_subgroup_vote"]
- extensions = ["SPV_KHR_float_controls", "SPV_KHR_subgroup_vote"]
-}
-
diff --git a/mlir/test/Dialect/SPIRV/Serialization/function_call.mlir b/mlir/test/Dialect/SPIRV/Serialization/function-call.mlir
index 530be05bcd3..530be05bcd3 100644
--- a/mlir/test/Dialect/SPIRV/Serialization/function_call.mlir
+++ b/mlir/test/Dialect/SPIRV/Serialization/function-call.mlir
diff --git a/mlir/test/Dialect/SPIRV/Serialization/global-variable.mlir b/mlir/test/Dialect/SPIRV/Serialization/global-variable.mlir
new file mode 100644
index 00000000000..12a16a4b269
--- /dev/null
+++ b/mlir/test/Dialect/SPIRV/Serialization/global-variable.mlir
@@ -0,0 +1,36 @@
+// RUN: mlir-translate -test-spirv-roundtrip -split-input-file %s | FileCheck %s
+
+// CHECK: spv.globalVariable @var0 bind(1, 0) : !spv.ptr<f32, Input>
+// CHECK-NEXT: spv.globalVariable @var1 bind(0, 1) : !spv.ptr<f32, Output>
+// CHECK-NEXT: spv.globalVariable @var2 built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
+// CHECK-NEXT: spv.globalVariable @var3 built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
+
+spv.module "Logical" "GLSL450" {
+ spv.globalVariable @var0 bind(1, 0) : !spv.ptr<f32, Input>
+ spv.globalVariable @var1 bind(0, 1) : !spv.ptr<f32, Output>
+ spv.globalVariable @var2 {built_in = "GlobalInvocationId"} : !spv.ptr<vector<3xi32>, Input>
+ spv.globalVariable @var3 built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
+}
+
+// -----
+
+spv.module "Logical" "GLSL450" {
+ // CHECK: spv.globalVariable @var1 : !spv.ptr<f32, Input>
+ // CHECK-NEXT: spv.globalVariable @var2 initializer(@var1) bind(1, 0) : !spv.ptr<f32, Input>
+ spv.globalVariable @var1 : !spv.ptr<f32, Input>
+ spv.globalVariable @var2 initializer(@var1) bind(1, 0) : !spv.ptr<f32, Input>
+}
+
+// -----
+
+spv.module "Logical" "GLSL450" {
+ spv.globalVariable @globalInvocationID built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
+ func @foo() {
+ // CHECK: %[[ADDR:.*]] = spv._address_of @globalInvocationID : !spv.ptr<vector<3xi32>, Input>
+ %0 = spv._address_of @globalInvocationID : !spv.ptr<vector<3xi32>, Input>
+ %1 = spv.constant 0: i32
+ // CHECK: spv.AccessChain %[[ADDR]]
+ %2 = spv.AccessChain %0[%1] : !spv.ptr<vector<3xi32>, Input>
+ spv.Return
+ }
+}
diff --git a/mlir/test/Dialect/SPIRV/Serialization/glslops.mlir b/mlir/test/Dialect/SPIRV/Serialization/glsl-ops.mlir
index b6c95d52869..b6c95d52869 100644
--- a/mlir/test/Dialect/SPIRV/Serialization/glslops.mlir
+++ b/mlir/test/Dialect/SPIRV/Serialization/glsl-ops.mlir
diff --git a/mlir/test/Dialect/SPIRV/Serialization/load_store.mlir b/mlir/test/Dialect/SPIRV/Serialization/load_store.mlir
deleted file mode 100644
index 3293f9a5456..00000000000
--- a/mlir/test/Dialect/SPIRV/Serialization/load_store.mlir
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
-
-// CHECK: func {{@.*}}([[ARG1:%.*]]: !spv.ptr<f32, Input>, [[ARG2:%.*]]: !spv.ptr<f32, Output>) {
-// CHECK-NEXT: [[VALUE:%.*]] = spv.Load "Input" [[ARG1]] : f32
-// CHECK-NEXT: spv.Store "Output" [[ARG2]], [[VALUE]] : f32
-
-spv.module "Logical" "GLSL450" {
- func @load_store(%arg0 : !spv.ptr<f32, Input>, %arg1 : !spv.ptr<f32, Output>) {
- %1 = spv.Load "Input" %arg0 : f32
- spv.Store "Output" %arg1, %1 : f32
- spv.Return
- }
-}
diff --git a/mlir/test/Dialect/SPIRV/Serialization/logical-ops.mlir b/mlir/test/Dialect/SPIRV/Serialization/logical-ops.mlir
new file mode 100644
index 00000000000..09915c7f0cf
--- /dev/null
+++ b/mlir/test/Dialect/SPIRV/Serialization/logical-ops.mlir
@@ -0,0 +1,75 @@
+// RUN: mlir-translate -split-input-file -test-spirv-roundtrip %s | FileCheck %s
+
+spv.module "Logical" "GLSL450" {
+ func @iequal_scalar(%arg0: i32, %arg1: i32) {
+ // CHECK: {{.*}} = spv.IEqual {{.*}}, {{.*}} : i32
+ %0 = spv.IEqual %arg0, %arg1 : i32
+ spv.Return
+ }
+ func @inotequal_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
+ // CHECK: {{.*}} = spv.INotEqual {{.*}}, {{.*}} : vector<4xi32>
+ %0 = spv.INotEqual %arg0, %arg1 : vector<4xi32>
+ spv.Return
+ }
+ func @sgt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
+ // CHECK: {{.*}} = spv.SGreaterThan {{.*}}, {{.*}} : vector<4xi32>
+ %0 = spv.SGreaterThan %arg0, %arg1 : vector<4xi32>
+ spv.Return
+ }
+ func @sge_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
+ // CHECK: {{.*}} = spv.SGreaterThanEqual {{.*}}, {{.*}} : vector<4xi32>
+ %0 = spv.SGreaterThanEqual %arg0, %arg1 : vector<4xi32>
+ spv.Return
+ }
+ func @slt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
+ // CHECK: {{.*}} = spv.SLessThan {{.*}}, {{.*}} : vector<4xi32>
+ %0 = spv.SLessThan %arg0, %arg1 : vector<4xi32>
+ spv.Return
+ }
+ func @slte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
+ // CHECK: {{.*}} = spv.SLessThanEqual {{.*}}, {{.*}} : vector<4xi32>
+ %0 = spv.SLessThanEqual %arg0, %arg1 : vector<4xi32>
+ spv.Return
+ }
+ func @ugt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
+ // CHECK: {{.*}} = spv.UGreaterThan {{.*}}, {{.*}} : vector<4xi32>
+ %0 = spv.UGreaterThan %arg0, %arg1 : vector<4xi32>
+ spv.Return
+ }
+ func @ugte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
+ // CHECK: {{.*}} = spv.UGreaterThanEqual {{.*}}, {{.*}} : vector<4xi32>
+ %0 = spv.UGreaterThanEqual %arg0, %arg1 : vector<4xi32>
+ spv.Return
+ }
+ func @ult_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
+ // CHECK: {{.*}} = spv.ULessThan {{.*}}, {{.*}} : vector<4xi32>
+ %0 = spv.ULessThan %arg0, %arg1 : vector<4xi32>
+ spv.Return
+ }
+ func @ulte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) {
+ // CHECK: {{.*}} = spv.ULessThanEqual {{.*}}, {{.*}} : vector<4xi32>
+ %0 = spv.ULessThanEqual %arg0, %arg1 : vector<4xi32>
+ spv.Return
+ }
+}
+
+// -----
+
+spv.module "Logical" "GLSL450" {
+ spv.specConstant @condition_scalar = true
+ func @select() -> () {
+ %0 = spv.constant 4.0 : f32
+ %1 = spv.constant 5.0 : f32
+ %2 = spv._reference_of @condition_scalar : i1
+ // CHECK: spv.Select {{.*}}, {{.*}}, {{.*}} : i1, f32
+ %3 = spv.Select %2, %0, %1 : i1, f32
+ %4 = spv.constant dense<[2.0, 3.0, 4.0, 5.0]> : vector<4xf32>
+ %5 = spv.constant dense<[6.0, 7.0, 8.0, 9.0]> : vector<4xf32>
+ // CHECK: spv.Select {{.*}}, {{.*}}, {{.*}} : i1, vector<4xf32>
+ %6 = spv.Select %2, %4, %5 : i1, vector<4xf32>
+ %7 = spv.constant dense<[true, true, true, true]> : vector<4xi1>
+ // CHECK: spv.Select {{.*}}, {{.*}}, {{.*}} : vector<4xi1>, vector<4xf32>
+ %8 = spv.Select %7, %4, %5 : vector<4xi1>, vector<4xf32>
+ spv.Return
+ }
+}
diff --git a/mlir/test/Dialect/SPIRV/Serialization/access_chain.mlir b/mlir/test/Dialect/SPIRV/Serialization/memory-ops.mlir
index a8830498f14..bc932b1424e 100644
--- a/mlir/test/Dialect/SPIRV/Serialization/access_chain.mlir
+++ b/mlir/test/Dialect/SPIRV/Serialization/memory-ops.mlir
@@ -1,4 +1,18 @@
-// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
+// RUN: mlir-translate -test-spirv-roundtrip -split-input-file %s | FileCheck %s
+
+// CHECK: func {{@.*}}([[ARG1:%.*]]: !spv.ptr<f32, Input>, [[ARG2:%.*]]: !spv.ptr<f32, Output>) {
+// CHECK-NEXT: [[VALUE:%.*]] = spv.Load "Input" [[ARG1]] : f32
+// CHECK-NEXT: spv.Store "Output" [[ARG2]], [[VALUE]] : f32
+
+spv.module "Logical" "GLSL450" {
+ func @load_store(%arg0 : !spv.ptr<f32, Input>, %arg1 : !spv.ptr<f32, Output>) {
+ %1 = spv.Load "Input" %arg0 : f32
+ spv.Store "Output" %arg1, %1 : f32
+ spv.Return
+ }
+}
+
+// -----
spv.module "Logical" "GLSL450" {
func @access_chain(%arg0 : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>,
diff --git a/mlir/test/Dialect/SPIRV/Serialization/minimal-module.mlir b/mlir/test/Dialect/SPIRV/Serialization/minimal-module.mlir
deleted file mode 100644
index 18312f22a76..00000000000
--- a/mlir/test/Dialect/SPIRV/Serialization/minimal-module.mlir
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
-
-// CHECK: spv.module "Logical" "GLSL450" {
-// CHECK-NEXT: func @foo() {
-// CHECK-NEXT: spv.Return
-// CHECK-NEXT: }
-// CHECK-NEXT: } attributes {major_version = 1 : i32, minor_version = 0 : i32}
-
-spv.module "Logical" "GLSL450" {
- func @foo() -> () {
- spv.Return
- }
-}
diff --git a/mlir/test/Dialect/SPIRV/Serialization/module.mlir b/mlir/test/Dialect/SPIRV/Serialization/module.mlir
new file mode 100644
index 00000000000..a66116aeb25
--- /dev/null
+++ b/mlir/test/Dialect/SPIRV/Serialization/module.mlir
@@ -0,0 +1,30 @@
+// RUN: mlir-translate -test-spirv-roundtrip -split-input-file %s | FileCheck %s
+
+// CHECK: spv.module "Logical" "GLSL450" {
+// CHECK-NEXT: func @foo() {
+// CHECK-NEXT: spv.Return
+// CHECK-NEXT: }
+// CHECK-NEXT: } attributes {major_version = 1 : i32, minor_version = 0 : i32}
+
+spv.module "Logical" "GLSL450" {
+ func @foo() -> () {
+ spv.Return
+ }
+}
+
+// -----
+
+spv.module "Logical" "GLSL450" {
+} attributes {
+ // CHECK: capabilities = ["Shader", "Float16"]
+ capabilities = ["Shader", "Float16"]
+}
+
+// -----
+
+spv.module "Logical" "GLSL450" {
+} attributes {
+ // CHECK: extensions = ["SPV_KHR_float_controls", "SPV_KHR_subgroup_vote"]
+ extensions = ["SPV_KHR_float_controls", "SPV_KHR_subgroup_vote"]
+}
+
diff --git a/mlir/test/Dialect/SPIRV/Serialization/rtarray.mlir b/mlir/test/Dialect/SPIRV/Serialization/rtarray.mlir
deleted file mode 100644
index 91bc802ed4c..00000000000
--- a/mlir/test/Dialect/SPIRV/Serialization/rtarray.mlir
+++ /dev/null
@@ -1,8 +0,0 @@
-// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
-
-spv.module "Logical" "GLSL450" {
- // CHECK: spv.globalVariable {{@.*}} : !spv.ptr<!spv.rtarray<f32>, StorageBuffer>
- spv.globalVariable @var0 : !spv.ptr<!spv.rtarray<f32>, StorageBuffer>
- // CHECK: spv.globalVariable {{@.*}} : !spv.ptr<!spv.rtarray<vector<4xf16>>, Input>
- spv.globalVariable @var1 : !spv.ptr<!spv.rtarray<vector<4xf16>>, Input>
-} \ No newline at end of file
diff --git a/mlir/test/Dialect/SPIRV/Serialization/select.mlir b/mlir/test/Dialect/SPIRV/Serialization/select.mlir
deleted file mode 100644
index f6c69c160ba..00000000000
--- a/mlir/test/Dialect/SPIRV/Serialization/select.mlir
+++ /dev/null
@@ -1,20 +0,0 @@
-// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
-
-spv.module "Logical" "GLSL450" {
- spv.specConstant @condition_scalar = true
- func @select() -> () {
- %0 = spv.constant 4.0 : f32
- %1 = spv.constant 5.0 : f32
- %2 = spv._reference_of @condition_scalar : i1
- // CHECK: spv.Select {{.*}}, {{.*}}, {{.*}} : i1, f32
- %3 = spv.Select %2, %0, %1 : i1, f32
- %4 = spv.constant dense<[2.0, 3.0, 4.0, 5.0]> : vector<4xf32>
- %5 = spv.constant dense<[6.0, 7.0, 8.0, 9.0]> : vector<4xf32>
- // CHECK: spv.Select {{.*}}, {{.*}}, {{.*}} : i1, vector<4xf32>
- %6 = spv.Select %2, %4, %5 : i1, vector<4xf32>
- %7 = spv.constant dense<[true, true, true, true]> : vector<4xi1>
- // CHECK: spv.Select {{.*}}, {{.*}}, {{.*}} : vector<4xi1>, vector<4xf32>
- %8 = spv.Select %7, %4, %5 : vector<4xi1>, vector<4xf32>
- spv.Return
- }
-} \ No newline at end of file
diff --git a/mlir/test/Dialect/SPIRV/Serialization/spec_constant.mlir b/mlir/test/Dialect/SPIRV/Serialization/spec-constant.mlir
index 5859d829b27..5859d829b27 100644
--- a/mlir/test/Dialect/SPIRV/Serialization/spec_constant.mlir
+++ b/mlir/test/Dialect/SPIRV/Serialization/spec-constant.mlir
diff --git a/mlir/test/Dialect/SPIRV/Serialization/variable_reference.mlir b/mlir/test/Dialect/SPIRV/Serialization/variable_reference.mlir
deleted file mode 100644
index 2fd51dd8802..00000000000
--- a/mlir/test/Dialect/SPIRV/Serialization/variable_reference.mlir
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
-
-spv.module "Logical" "GLSL450" {
- spv.globalVariable @globalInvocationID built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
- func @foo() {
- // CHECK: %[[ADDR:.*]] = spv._address_of @globalInvocationID : !spv.ptr<vector<3xi32>, Input>
- %0 = spv._address_of @globalInvocationID : !spv.ptr<vector<3xi32>, Input>
- %1 = spv.constant 0: i32
- // CHECK: spv.AccessChain %[[ADDR]]
- %2 = spv.AccessChain %0[%1] : !spv.ptr<vector<3xi32>, Input>
- spv.Return
- }
-}
diff --git a/mlir/test/Dialect/SPIRV/Serialization/variables.mlir b/mlir/test/Dialect/SPIRV/Serialization/variables.mlir
deleted file mode 100644
index 537dab2eca4..00000000000
--- a/mlir/test/Dialect/SPIRV/Serialization/variables.mlir
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
-
-// CHECK: spv.globalVariable @var0 bind(1, 0) : !spv.ptr<f32, Input>
-// CHECK-NEXT: spv.globalVariable @var1 bind(0, 1) : !spv.ptr<f32, Output>
-// CHECK-NEXT: spv.globalVariable @var2 built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
-// CHECK-NEXT: spv.globalVariable @var3 built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
-
-spv.module "Logical" "GLSL450" {
- spv.globalVariable @var0 bind(1, 0) : !spv.ptr<f32, Input>
- spv.globalVariable @var1 bind(0, 1) : !spv.ptr<f32, Output>
- spv.globalVariable @var2 {built_in = "GlobalInvocationId"} : !spv.ptr<vector<3xi32>, Input>
- spv.globalVariable @var3 built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
-}
diff --git a/mlir/test/Dialect/SPIRV/Serialization/variables_init.mlir b/mlir/test/Dialect/SPIRV/Serialization/variables_init.mlir
deleted file mode 100644
index 866262bb133..00000000000
--- a/mlir/test/Dialect/SPIRV/Serialization/variables_init.mlir
+++ /dev/null
@@ -1,8 +0,0 @@
-// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
-
-spv.module "Logical" "GLSL450" {
- // CHECK: spv.globalVariable @var1 : !spv.ptr<f32, Input>
- // CHECK-NEXT: spv.globalVariable @var2 initializer(@var1) bind(1, 0) : !spv.ptr<f32, Input>
- spv.globalVariable @var1 : !spv.ptr<f32, Input>
- spv.globalVariable @var2 initializer(@var1) bind(1, 0) : !spv.ptr<f32, Input>
-}
OpenPOWER on IntegriCloud