summaryrefslogtreecommitdiffstats
path: root/mlir/test/Conversion/GPUToSPIRV
diff options
context:
space:
mode:
authorMahesh Ravishankar <ravishankarm@google.com>2019-08-17 10:19:48 -0700
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-08-17 10:20:13 -0700
commitd745101339f3e56f202311a0243d1ba7ef04f56a (patch)
tree300dbddf775a9f1a366f5c544298f4651b55906a /mlir/test/Conversion/GPUToSPIRV
parentc268666f15ee5ad36ed39b0a38ec5bf9d58216d4 (diff)
downloadbcm5719-llvm-d745101339f3e56f202311a0243d1ba7ef04f56a.tar.gz
bcm5719-llvm-d745101339f3e56f202311a0243d1ba7ef04f56a.zip
Add spirv::GlobalVariableOp that allows module level definition of variables
FuncOps in MLIR use explicit capture. So global variables defined in module scope need to have a symbol name and this should be used to refer to the variable within the function. This deviates from SPIR-V spec, which assigns an SSA value to variables at all scopes that can be used to refer to the variable, which requires SPIR-V functions to allow implicit capture. To handle this add a new op, spirv::GlobalVariableOp that can be used to define module scope variables. Since instructions need an SSA value, an new spirv::AddressOfOp is added to convert a symbol reference to an SSA value for use with other instructions. This also means the spirv::EntryPointOp instruction needs to change to allow initializers to be specified using symbol reference instead of SSA value The current spirv::VariableOp which returns an SSA value (as defined by SPIR-V spec) can still be used to define function-scope variables. PiperOrigin-RevId: 263951109
Diffstat (limited to 'mlir/test/Conversion/GPUToSPIRV')
-rw-r--r--mlir/test/Conversion/GPUToSPIRV/simple.mlir4
1 files changed, 2 insertions, 2 deletions
diff --git a/mlir/test/Conversion/GPUToSPIRV/simple.mlir b/mlir/test/Conversion/GPUToSPIRV/simple.mlir
index 671a38bd1fa..dc7964d0c95 100644
--- a/mlir/test/Conversion/GPUToSPIRV/simple.mlir
+++ b/mlir/test/Conversion/GPUToSPIRV/simple.mlir
@@ -1,8 +1,8 @@
// RUN: mlir-opt -convert-gpu-to-spirv %s -o - | FileCheck %s
// CHECK: spv.module "Logical" "VulkanKHR" {
-// CHECK-NEXT: [[VAR1:%.*]] = spv.Variable bind(0, 0) : !spv.ptr<f32, StorageBuffer>
-// CHECK-NEXT: [[VAR2:%.*]] = spv.Variable bind(0, 1) : !spv.ptr<!spv.array<12 x f32>, StorageBuffer>
+// CHECK-NEXT: spv.globalVariable !spv.ptr<f32, StorageBuffer> [[VAR1:@.*]] bind(0, 0)
+// CHECK-NEXT: spv.globalVariable !spv.ptr<!spv.array<12 x f32>, StorageBuffer> [[VAR2:@.*]] bind(0, 1)
// CHECK-NEXT: func @kernel_1
// CHECK-NEXT: spv.Return
// CHECK: spv.EntryPoint "GLCompute" @kernel_1, [[VAR1]], [[VAR2]]
OpenPOWER on IntegriCloud