[MLIR][SPIRV] Rename `spv.globalVariable` to `spv.GlobalVariable`.

To unify the naming scheme across all ops in the SPIR-V dialect, we are
moving from spv.camelCase to spv.CamelCase everywhere.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D97919
This commit is contained in:
KareemErgawy-TomTom 2021-03-04 16:17:12 -05:00 committed by Lei Zhang
parent 53d7c63657
commit c74eb466d2
38 changed files with 263 additions and 263 deletions

View File

@ -176,7 +176,7 @@ instructions are represented in the SPIR-V dialect:
#### Adopt symbol-based global variables and specialization constant
* Global variables are defined with the `spv.globalVariable` op. They do not
* Global variables are defined with the `spv.GlobalVariable` op. They do not
generate SSA values. Instead they have symbols and should be referenced via
symbols. To use global variables in a function block, `spv.mlir.addressof` is
needed to turn the symbol into an SSA value.
@ -982,11 +982,11 @@ Similarly, a few transformations are performed during deserialization:
* `OpType*` instructions will be converted into proper `mlir::Type`s.
* `OpConstant*` instructions are materialized as `spv.Constant` at each use
site.
* `OpVariable` instructions will be converted to `spv.globalVariable` ops if
* `OpVariable` instructions will be converted to `spv.GlobalVariable` ops if
in module-level; otherwise they will be converted into `spv.Variable` ops.
* Every use of a module-level `OpVariable` instruction will materialize a
`spv.mlir.addressof` op to turn the symbol of the corresponding
`spv.globalVariable` into an SSA value.
`spv.GlobalVariable` into an SSA value.
* Every use of a `OpSpecConstant` instruction will materialize a
`spv.mlir.referenceof` op to turn the symbol of the corresponding
`spv.SpecConstant` into an SSA value.
@ -1069,7 +1069,7 @@ point function within the `spv.module` on lowering. A later pass
point function and its ABI consistent with the Vulkan validation
rules. Specifically,
* Creates `spv.globalVariable`s for the arguments, and replaces all uses of
* Creates `spv.GlobalVariable`s for the arguments, and replaces all uses of
the argument with this variable. The SSA value used for replacement is
obtained using the `spv.mlir.addressof` operation.
* Adds the `spv.EntryPoint` and `spv.ExecutionMode` operations into the
@ -1078,15 +1078,15 @@ rules. Specifically,
#### Setting layout for shader interface variables
SPIR-V validation rules for shaders require composite objects to be explicitly
laid out. If a `spv.globalVariable` is not explicitly laid out, the utility
laid out. If a `spv.GlobalVariable` is not explicitly laid out, the utility
method `mlir::spirv::decorateType` implements a layout consistent with
the [Vulkan shader requirements][VulkanShaderInterface].
#### Creating builtin variables
In SPIR-V dialect, builtins are represented using `spv.globalVariable`s, with
In SPIR-V dialect, builtins are represented using `spv.GlobalVariable`s, with
`spv.mlir.addressof` used to get a handle to the builtin as an SSA value. The
method `mlir::spirv::getBuiltinVariableValue` creates a `spv.globalVariable` for
method `mlir::spirv::getBuiltinVariableValue` creates a `spv.GlobalVariable` for
the builtin in the current `spv.module` if it does not exist already, and
returns an SSA value generated from an `spv.mlir.addressof` operation.

View File

@ -466,9 +466,9 @@ following cases, based on the value of the attribute:
(`MakePointerAvailable`, `MakePointerVisible`, `NonPrivatePointer`) are not
supported yet.
#### `spv.globalVariable` and `spv.mlir.addressof`
#### `spv.GlobalVariable` and `spv.mlir.addressof`
`spv.globalVariable` is modelled with `llvm.mlir.global` op. However, there
`spv.GlobalVariable` is modelled with `llvm.mlir.global` op. However, there
is a difference that has to be pointed out.
In SPIR-V dialect, the global variable returns a pointer, whereas in LLVM
@ -479,7 +479,7 @@ are used to reference the global.
```mlir
// Original SPIR-V module
spv.module Logical GLSL450 {
spv.globalVariable @struct : !spv.ptr<!spv.struct<f32, !spv.array<10xf32>>, Private>
spv.GlobalVariable @struct : !spv.ptr<!spv.struct<f32, !spv.array<10xf32>>, Private>
spv.func @func() -> () "None" {
%0 = spv.mlir.addressof @struct : !spv.ptr<!spv.struct<f32, !spv.array<10xf32>>, Private>
spv.Return
@ -517,7 +517,7 @@ If the global variable's pointer has `Input` storage class, then a `constant`
flag is added to LLVM op:
```mlir
spv.globalVariable @var : !spv.ptr<f32, Input> => llvm.mlir.global external constant @var() : f32
spv.GlobalVariable @var : !spv.ptr<f32, Input> => llvm.mlir.global external constant @var() : f32
```
#### `spv.Variable`
@ -873,7 +873,7 @@ Lowering `gpu` dialect to SPIR-V dialect results in
```mlir
spv.module @__spv__foo /*VCE triple and other metadata here*/ {
spv.globalVariable @__spv__foo_arg bind(0,0) : ...
spv.GlobalVariable @__spv__foo_arg bind(0,0) : ...
spv.func @bar() {
// Kernel code.
}
@ -897,7 +897,7 @@ code.
```mlir
spv.module @__spv__foo /*VCE triple and other metadata here*/ {
spv.globalVariable @__spv__foo_arg bind(0,0) : ...
spv.GlobalVariable @__spv__foo_arg bind(0,0) : ...
spv.func @bar() {
// Kernel code.
}

View File

@ -148,11 +148,11 @@ def SPV_EntryPointOp : SPV_Op<"EntryPoint", [InModuleScope]> {
OpEntryPoint instructions with the same Execution Model and the same
Name string.
Interface is a list of symbol references to `spv.globalVariable`
Interface is a list of symbol references to `spv.GlobalVariable`
operations. These declare the set of global variables from a
module that form the interface of this entry point. The set of
Interface symbols must be equal to or a superset of the
`spv.globalVariable`s referenced by the entry points static call
`spv.GlobalVariable`s referenced by the entry points static call
tree, within the interfaces storage classes. Before version 1.4,
the interfaces storage classes are limited to the Input and
Output storage classes. Starting with version 1.4, the interfaces
@ -325,7 +325,7 @@ def SPV_FuncOp : SPV_Op<"func", [
// -----
def SPV_GlobalVariableOp : SPV_Op<"globalVariable", [InModuleScope, Symbol]> {
def SPV_GlobalVariableOp : SPV_Op<"GlobalVariable", [InModuleScope, Symbol]> {
let summary = [{
Allocate an object in memory at module scope. The object is
referenced using a symbol name.
@ -343,13 +343,13 @@ def SPV_GlobalVariableOp : SPV_Op<"globalVariable", [InModuleScope, Symbol]> {
Initializer is optional. If Initializer is present, it will be
the initial value of the variables memory content. Initializer
must be an symbol defined from a constant instruction or other
`spv.globalVariable` operation in module scope. Initializer must
`spv.GlobalVariable` operation in module scope. Initializer must
have the same type as the type of the defined symbol.
<!-- End of AutoGen section -->
```
variable-op ::= `spv.globalVariable` spirv-type symbol-ref-id
variable-op ::= `spv.GlobalVariable` spirv-type symbol-ref-id
(`initializer(` symbol-ref-id `)`)?
(`bind(` integer-literal, integer-literal `)`)?
(`built_in(` string-literal `)`)?
@ -363,10 +363,10 @@ def SPV_GlobalVariableOp : SPV_Op<"globalVariable", [InModuleScope, Symbol]> {
#### Example:
```mlir
spv.globalVariable @var0 : !spv.ptr<f32, Input> @var0
spv.globalVariable @var1 initializer(@var0) : !spv.ptr<f32, Output>
spv.globalVariable @var2 bind(1, 2) : !spv.ptr<f32, Uniform>
spv.globalVariable @var3 built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
spv.GlobalVariable @var0 : !spv.ptr<f32, Input> @var0
spv.GlobalVariable @var1 initializer(@var0) : !spv.ptr<f32, Output>
spv.GlobalVariable @var2 bind(1, 2) : !spv.ptr<f32, Uniform>
spv.GlobalVariable @var3 built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
```
}];

View File

@ -41,7 +41,7 @@ class ModuleOp;
///
/// For deduplication, the following 3 cases are taken into consideration:
///
/// - If 2 spv.globalVariable's have either the same descriptor set + binding
/// - If 2 spv.GlobalVariable's have either the same descriptor set + binding
/// or the same build_in attribute value, then replace one of them using the
/// other.
/// - If 2 spv.SpecConstant's have the same spec_id attribute value, then

View File

@ -94,7 +94,7 @@ static bool hasDescriptorSetAndBinding(spirv::GlobalVariableOp op) {
/// Fills `globalVariableMap` with SPIR-V global variables that represent kernel
/// arguments from the given SPIR-V module. We assume that the module contains a
/// single entry point function. Hence, all `spv.globalVariable`s with a bind
/// single entry point function. Hence, all `spv.GlobalVariable`s with a bind
/// attribute are kernel arguments.
static LogicalResult getKernelGlobalVariables(
spirv::ModuleOp module,

View File

@ -706,7 +706,7 @@ public:
}
};
/// Converts `spv.globalVariable` to `llvm.mlir.global`. Note that SPIR-V global
/// Converts `spv.GlobalVariable` to `llvm.mlir.global`. Note that SPIR-V global
/// returns a pointer, whereas in LLVM dialect the global holds an actual value.
/// This difference is handled by `spv.mlir.addressof` and
/// `llvm.mlir.addressof`ops that both return a pointer.

View File

@ -250,7 +250,7 @@ public:
// Get the SPIR-V type for the allocation.
Type spirvType = getTypeConverter()->convertType(allocType);
// Insert spv.globalVariable for this allocation.
// Insert spv.GlobalVariable for this allocation.
Operation *parent =
SymbolTable::getNearestSymbolTable(operation->getParentOp());
if (!parent)

View File

@ -1064,7 +1064,7 @@ static LogicalResult verify(spirv::AddressOfOp addressOfOp) {
SymbolTable::lookupNearestSymbolFrom(addressOfOp->getParentOp(),
addressOfOp.variable()));
if (!varOp) {
return addressOfOp.emitOpError("expected spv.globalVariable symbol");
return addressOfOp.emitOpError("expected spv.GlobalVariable symbol");
}
if (addressOfOp.pointer().getType() != varOp.type()) {
return addressOfOp.emitOpError(
@ -1959,7 +1959,7 @@ Operation::operand_range spirv::FunctionCallOp::getArgOperands() {
}
//===----------------------------------------------------------------------===//
// spv.globalVariable
// spv.GlobalVariable
//===----------------------------------------------------------------------===//
void spirv::GlobalVariableOp::build(OpBuilder &builder, OperationState &state,
@ -2067,7 +2067,7 @@ static LogicalResult verify(spirv::GlobalVariableOp varOp) {
if (!initOp ||
!isa<spirv::GlobalVariableOp, spirv::SpecConstantOp>(initOp)) {
return varOp.emitOpError("initializer must be result of a "
"spv.SpecConstant or spv.globalVariable op");
"spv.SpecConstant or spv.GlobalVariable op");
}
}
@ -2593,7 +2593,7 @@ static LogicalResult verify(spirv::ModuleOp moduleOp) {
auto variableOp =
table.lookup<spirv::GlobalVariableOp>(varSymRef.getValue());
if (!variableOp) {
return entryPointOp.emitError("expected spv.globalVariable "
return entryPointOp.emitError("expected spv.GlobalVariable "
"symbol reference instead of'")
<< varSymRef << "'";
}
@ -3000,7 +3000,7 @@ static LogicalResult verify(spirv::VariableOp varOp) {
if (varOp.storage_class() != spirv::StorageClass::Function) {
return varOp.emitOpError(
"can only be used to model function-level variables. Use "
"spv.globalVariable for module-level variables.");
"spv.GlobalVariable for module-level variables.");
}
auto pointerType = varOp.pointer().getType().cast<spirv::PointerType>();
@ -3016,7 +3016,7 @@ static LogicalResult verify(spirv::VariableOp varOp) {
spirv::ReferenceOfOp, // for spec constant
spirv::AddressOfOp>(initOp))
return varOp.emitOpError("initializer must be the result of a "
"constant or spv.globalVariable op");
"constant or spv.GlobalVariable op");
}
// TODO: generate these strings using ODS.
@ -3031,7 +3031,7 @@ static LogicalResult verify(spirv::VariableOp varOp) {
for (const auto &attr : {descriptorSetName, bindingName, builtInName}) {
if (op->getAttr(attr))
return varOp.emitOpError("cannot have '")
<< attr << "' attribute (only allowed in spv.globalVariable)";
<< attr << "' attribute (only allowed in spv.GlobalVariable)";
}
return success();

View File

@ -527,7 +527,7 @@ void mlir::populateBuiltinFuncToSPIRVPatterns(
static spirv::GlobalVariableOp getBuiltinVariable(Block &body,
spirv::BuiltIn builtin) {
// Look through all global variables in the given `body` block and check if
// there is a spv.globalVariable that has the same `builtin` attribute.
// there is a spv.GlobalVariable that has the same `builtin` attribute.
for (auto varOp : body.getOps<spirv::GlobalVariableOp>()) {
if (auto builtinAttr = varOp->getAttrOfType<StringAttr>(
spirv::SPIRVDialect::getAttributeName(

View File

@ -239,7 +239,7 @@ private:
/// Processes the OpVariable instructions at current `offset` into `binary`.
/// It is expected that this method is used for variables that are to be
/// defined at module scope and will be deserialized into a spv.globalVariable
/// defined at module scope and will be deserialized into a spv.GlobalVariable
/// instruction.
LogicalResult processGlobalVariable(ArrayRef<uint32_t> operands);

View File

@ -9,7 +9,7 @@ module attributes {gpu.container_module} {
}
// CHECK-LABEL: spv.module @{{.*}} Logical GLSL450
// CHECK: spv.globalVariable [[WORKGROUPID:@.*]] built_in("WorkgroupId")
// CHECK: spv.GlobalVariable [[WORKGROUPID:@.*]] built_in("WorkgroupId")
gpu.module @kernels {
gpu.func @builtin_workgroup_id_x() kernel
attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} {
@ -33,7 +33,7 @@ module attributes {gpu.container_module} {
}
// CHECK-LABEL: spv.module @{{.*}} Logical GLSL450
// CHECK: spv.globalVariable [[WORKGROUPID:@.*]] built_in("WorkgroupId")
// CHECK: spv.GlobalVariable [[WORKGROUPID:@.*]] built_in("WorkgroupId")
gpu.module @kernels {
gpu.func @builtin_workgroup_id_y() kernel
attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} {
@ -57,7 +57,7 @@ module attributes {gpu.container_module} {
}
// CHECK-LABEL: spv.module @{{.*}} Logical GLSL450
// CHECK: spv.globalVariable [[WORKGROUPID:@.*]] built_in("WorkgroupId")
// CHECK: spv.GlobalVariable [[WORKGROUPID:@.*]] built_in("WorkgroupId")
gpu.module @kernels {
gpu.func @builtin_workgroup_id_z() kernel
attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} {
@ -150,7 +150,7 @@ module attributes {gpu.container_module} {
}
// CHECK-LABEL: spv.module @{{.*}} Logical GLSL450
// CHECK: spv.globalVariable [[LOCALINVOCATIONID:@.*]] built_in("LocalInvocationId")
// CHECK: spv.GlobalVariable [[LOCALINVOCATIONID:@.*]] built_in("LocalInvocationId")
gpu.module @kernels {
gpu.func @builtin_local_id_x() kernel
attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} {
@ -174,7 +174,7 @@ module attributes {gpu.container_module} {
}
// CHECK-LABEL: spv.module @{{.*}} Logical GLSL450
// CHECK: spv.globalVariable [[NUMWORKGROUPS:@.*]] built_in("NumWorkgroups")
// CHECK: spv.GlobalVariable [[NUMWORKGROUPS:@.*]] built_in("NumWorkgroups")
gpu.module @kernels {
gpu.func @builtin_num_workgroups_x() kernel
attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} {
@ -191,7 +191,7 @@ module attributes {gpu.container_module} {
module attributes {gpu.container_module} {
// CHECK-LABEL: spv.module @{{.*}} Logical GLSL450
// CHECK: spv.globalVariable [[SUBGROUPID:@.*]] built_in("SubgroupId")
// CHECK: spv.GlobalVariable [[SUBGROUPID:@.*]] built_in("SubgroupId")
gpu.module @kernels {
gpu.func @builtin_subgroup_id() kernel
attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} {
@ -207,7 +207,7 @@ module attributes {gpu.container_module} {
module attributes {gpu.container_module} {
// CHECK-LABEL: spv.module @{{.*}} Logical GLSL450
// CHECK: spv.globalVariable [[NUMSUBGROUPS:@.*]] built_in("NumSubgroups")
// CHECK: spv.GlobalVariable [[NUMSUBGROUPS:@.*]] built_in("NumSubgroups")
gpu.module @kernels {
gpu.func @builtin_num_subgroups() kernel
attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} {
@ -223,7 +223,7 @@ module attributes {gpu.container_module} {
module attributes {gpu.container_module} {
// CHECK-LABEL: spv.module @{{.*}} Logical GLSL450
// CHECK: spv.globalVariable [[SUBGROUPSIZE:@.*]] built_in("SubgroupSize")
// CHECK: spv.GlobalVariable [[SUBGROUPSIZE:@.*]] built_in("SubgroupSize")
gpu.module @kernels {
gpu.func @builtin_subgroup_size() kernel
attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} {

View File

@ -24,9 +24,9 @@ module attributes {
// CHECK-LABEL: spv.module @{{.*}} Logical GLSL450
gpu.module @kernels {
// CHECK-DAG: spv.globalVariable @[[NUMWORKGROUPSVAR:.*]] built_in("NumWorkgroups") : !spv.ptr<vector<3xi32>, Input>
// CHECK-DAG: spv.globalVariable @[[$LOCALINVOCATIONIDVAR:.*]] built_in("LocalInvocationId") : !spv.ptr<vector<3xi32>, Input>
// CHECK-DAG: spv.globalVariable @[[$WORKGROUPIDVAR:.*]] built_in("WorkgroupId") : !spv.ptr<vector<3xi32>, Input>
// CHECK-DAG: spv.GlobalVariable @[[NUMWORKGROUPSVAR:.*]] built_in("NumWorkgroups") : !spv.ptr<vector<3xi32>, Input>
// CHECK-DAG: spv.GlobalVariable @[[$LOCALINVOCATIONIDVAR:.*]] built_in("LocalInvocationId") : !spv.ptr<vector<3xi32>, Input>
// CHECK-DAG: spv.GlobalVariable @[[$WORKGROUPIDVAR:.*]] built_in("WorkgroupId") : !spv.ptr<vector<3xi32>, Input>
// CHECK-LABEL: spv.func @load_store_kernel
// CHECK-SAME: %[[ARG0:.*]]: !spv.ptr<!spv.struct<(!spv.array<48 x f32, stride=4> [0])>, StorageBuffer> {spv.interface_var_abi = #spv.interface_var_abi<(0, 0)>}
// CHECK-SAME: %[[ARG1:.*]]: !spv.ptr<!spv.struct<(!spv.array<48 x f32, stride=4> [0])>, StorageBuffer> {spv.interface_var_abi = #spv.interface_var_abi<(0, 1)>}

View File

@ -6,7 +6,7 @@
module attributes {gpu.container_module} {
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], [SPV_KHR_storage_buffer_storage_class]> {
spv.globalVariable @kernel_arg_0 bind(0, 0) : !spv.ptr<!spv.struct<(!spv.array<12 x f32, stride=4> [0])>, StorageBuffer>
spv.GlobalVariable @kernel_arg_0 bind(0, 0) : !spv.ptr<!spv.struct<(!spv.array<12 x f32, stride=4> [0])>, StorageBuffer>
spv.func @kernel() "None" attributes {workgroup_attributions = 0 : i64} {
%0 = spv.mlir.addressof @kernel_arg_0 : !spv.ptr<!spv.struct<(!spv.array<12 x f32, stride=4> [0])>, StorageBuffer>
%2 = spv.Constant 0 : i32

View File

@ -17,7 +17,7 @@ module attributes {
#spv.vce<v1.3, [Shader, GroupNonUniformArithmetic], []>, {}>
} {
// CHECK: spv.globalVariable
// CHECK: spv.GlobalVariable
// CHECK-SAME: built_in("LocalInvocationId")
// CHECK: @single_workgroup_reduction

View File

@ -6,7 +6,7 @@ module attributes {gpu.container_module, spv.target_env = #spv.target_env<#spv.v
// CHECK: llvm.func @__spv__foo_bar()
// CHECK: spv.module @__spv__foo
// CHECK: spv.globalVariable @bar_arg_0 bind(0, 0) : !spv.ptr<!spv.struct<(!spv.array<6 x i32, stride=4> [0])>, StorageBuffer>
// CHECK: spv.GlobalVariable @bar_arg_0 bind(0, 0) : !spv.ptr<!spv.struct<(!spv.array<6 x i32, stride=4> [0])>, StorageBuffer>
// CHECK: spv.func @__spv__foo_bar
// CHECK: spv.EntryPoint "GLCompute" @__spv__foo_bar
@ -22,7 +22,7 @@ module attributes {gpu.container_module, spv.target_env = #spv.target_env<#spv.v
// CHECK-NEXT: "llvm.intr.memcpy"(%[[SRC]], %[[DEST]], %[[SIZE]], %{{.*}}) : (!llvm.ptr<i32>, !llvm.ptr<struct<(array<6 x i32>)>>, i64, i1) -> ()
spv.module @__spv__foo Logical GLSL450 requires #spv.vce<v1.0, [Shader], [SPV_KHR_variable_pointers]> {
spv.globalVariable @bar_arg_0 bind(0, 0) : !spv.ptr<!spv.struct<(!spv.array<6 x i32, stride=4> [0])>, StorageBuffer>
spv.GlobalVariable @bar_arg_0 bind(0, 0) : !spv.ptr<!spv.struct<(!spv.array<6 x i32, stride=4> [0])>, StorageBuffer>
spv.func @bar() "None" attributes {workgroup_attributions = 0 : i64} {
%0 = spv.mlir.addressof @bar_arg_0 : !spv.ptr<!spv.struct<(!spv.array<6 x i32, stride=4> [0])>, StorageBuffer>
spv.Return

View File

@ -26,19 +26,19 @@ spv.func @access_chain_array(%arg0 : i32) "None" {
}
//===----------------------------------------------------------------------===//
// spv.globalVariable and spv.mlir.addressof
// spv.GlobalVariable and spv.mlir.addressof
//===----------------------------------------------------------------------===//
spv.module Logical GLSL450 {
// CHECK: llvm.mlir.global external constant @var() : f32
spv.globalVariable @var : !spv.ptr<f32, Input>
spv.GlobalVariable @var : !spv.ptr<f32, Input>
}
spv.module Logical GLSL450 {
// CHECK: llvm.mlir.global private @struct() : !llvm.struct<packed (f32, array<10 x f32>)>
// CHECK-LABEL: @func
// CHECK: llvm.mlir.addressof @struct : !llvm.ptr<struct<packed (f32, array<10 x f32>)>>
spv.globalVariable @struct : !spv.ptr<!spv.struct<(f32, !spv.array<10xf32>)>, Private>
spv.GlobalVariable @struct : !spv.ptr<!spv.struct<(f32, !spv.array<10xf32>)>, Private>
spv.func @func() "None" {
%0 = spv.mlir.addressof @struct : !spv.ptr<!spv.struct<(f32, !spv.array<10xf32>)>, Private>
spv.Return
@ -49,7 +49,7 @@ spv.module Logical GLSL450 {
// CHECK: llvm.mlir.global external @bar_descriptor_set0_binding0() : i32
// CHECK-LABEL: @foo
// CHECK: llvm.mlir.addressof @bar_descriptor_set0_binding0 : !llvm.ptr<i32>
spv.globalVariable @bar bind(0, 0) : !spv.ptr<i32, StorageBuffer>
spv.GlobalVariable @bar bind(0, 0) : !spv.ptr<i32, StorageBuffer>
spv.func @foo() "None" {
%0 = spv.mlir.addressof @bar : !spv.ptr<i32, StorageBuffer>
spv.Return
@ -60,7 +60,7 @@ spv.module @name Logical GLSL450 {
// CHECK: llvm.mlir.global external @name_bar_descriptor_set0_binding0() : i32
// CHECK-LABEL: @foo
// CHECK: llvm.mlir.addressof @name_bar_descriptor_set0_binding0 : !llvm.ptr<i32>
spv.globalVariable @bar bind(0, 0) : !spv.ptr<i32, StorageBuffer>
spv.GlobalVariable @bar bind(0, 0) : !spv.ptr<i32, StorageBuffer>
spv.func @foo() "None" {
%0 = spv.mlir.addressof @bar : !spv.ptr<i32, StorageBuffer>
spv.Return

View File

@ -17,7 +17,7 @@ module attributes {
return
}
}
// CHECK: spv.globalVariable @[[VAR:.+]] : !spv.ptr<!spv.struct<(!spv.array<20 x f32, stride=4>)>, Workgroup>
// CHECK: spv.GlobalVariable @[[VAR:.+]] : !spv.ptr<!spv.struct<(!spv.array<20 x f32, stride=4>)>, Workgroup>
// CHECK: func @alloc_dealloc_workgroup_mem
// CHECK-NOT: alloc
// CHECK: %[[PTR:.+]] = spv.mlir.addressof @[[VAR]]
@ -44,7 +44,7 @@ module attributes {
}
}
// CHECK: spv.globalVariable @__workgroup_mem__{{[0-9]+}}
// CHECK: spv.GlobalVariable @__workgroup_mem__{{[0-9]+}}
// CHECK-SAME: !spv.ptr<!spv.struct<(!spv.array<20 x i32, stride=4>)>, Workgroup>
// CHECK_LABEL: spv.func @alloc_dealloc_workgroup_mem
// CHECK: %[[VAR:.+]] = spv.mlir.addressof @__workgroup_mem__0
@ -71,9 +71,9 @@ module attributes {
}
}
// CHECK-DAG: spv.globalVariable @__workgroup_mem__{{[0-9]+}}
// CHECK-DAG: spv.GlobalVariable @__workgroup_mem__{{[0-9]+}}
// CHECK-SAME: !spv.ptr<!spv.struct<(!spv.array<6 x i32, stride=4>)>, Workgroup>
// CHECK-DAG: spv.globalVariable @__workgroup_mem__{{[0-9]+}}
// CHECK-DAG: spv.GlobalVariable @__workgroup_mem__{{[0-9]+}}
// CHECK-SAME: !spv.ptr<!spv.struct<(!spv.array<20 x f32, stride=4>)>, Workgroup>
// CHECK: spv.func @two_allocs()
// CHECK: spv.Return
@ -92,9 +92,9 @@ module attributes {
}
}
// CHECK-DAG: spv.globalVariable @__workgroup_mem__{{[0-9]+}}
// CHECK-DAG: spv.GlobalVariable @__workgroup_mem__{{[0-9]+}}
// CHECK-SAME: !spv.ptr<!spv.struct<(!spv.array<2 x vector<2xi32>, stride=8>)>, Workgroup>
// CHECK-DAG: spv.globalVariable @__workgroup_mem__{{[0-9]+}}
// CHECK-DAG: spv.GlobalVariable @__workgroup_mem__{{[0-9]+}}
// CHECK-SAME: !spv.ptr<!spv.struct<(!spv.array<4 x vector<4xf32>, stride=16>)>, Workgroup>
// CHECK: spv.func @two_allocs_vector()
// CHECK: spv.Return

View File

@ -340,7 +340,7 @@ func @aligned_load_incorrect_attributes() -> () {
// -----
spv.module Logical GLSL450 {
spv.globalVariable @var0 : !spv.ptr<f32, Input>
spv.GlobalVariable @var0 : !spv.ptr<f32, Input>
// CHECK_LABEL: @simple_load
spv.func @simple_load() -> () "None" {
// CHECK: spv.Load "Input" {{%.*}} : f32
@ -463,7 +463,7 @@ func @aligned_store_incorrect_attributes(%arg0 : f32) -> () {
// -----
spv.module Logical GLSL450 {
spv.globalVariable @var0 : !spv.ptr<f32, Input>
spv.GlobalVariable @var0 : !spv.ptr<f32, Input>
spv.func @simple_store(%arg0 : f32) -> () "None" {
%0 = spv.mlir.addressof @var0 : !spv.ptr<f32, Input>
// CHECK: spv.Store "Input" {{%.*}}, {{%.*}} : f32
@ -496,7 +496,7 @@ func @variable_init_normal_constant() -> () {
// -----
spv.module Logical GLSL450 {
spv.globalVariable @global : !spv.ptr<f32, Workgroup>
spv.GlobalVariable @global : !spv.ptr<f32, Workgroup>
spv.func @variable_init_global_variable() -> () "None" {
%0 = spv.mlir.addressof @global : !spv.ptr<f32, Workgroup>
// CHECK: spv.Variable init({{.*}}) : !spv.ptr<!spv.ptr<f32, Workgroup>, Function>
@ -521,7 +521,7 @@ spv.module Logical GLSL450 {
// -----
func @variable_bind() -> () {
// expected-error @+1 {{cannot have 'descriptor_set' attribute (only allowed in spv.globalVariable)}}
// expected-error @+1 {{cannot have 'descriptor_set' attribute (only allowed in spv.GlobalVariable)}}
%0 = spv.Variable bind(1, 2) : !spv.ptr<f32, Function>
return
}
@ -530,7 +530,7 @@ func @variable_bind() -> () {
func @variable_init_bind() -> () {
%0 = spv.Constant 4.0 : f32
// expected-error @+1 {{cannot have 'binding' attribute (only allowed in spv.globalVariable)}}
// expected-error @+1 {{cannot have 'binding' attribute (only allowed in spv.GlobalVariable)}}
%1 = spv.Variable init(%0) {binding = 5 : i32} : !spv.ptr<f32, Function>
return
}
@ -538,7 +538,7 @@ func @variable_init_bind() -> () {
// -----
func @variable_builtin() -> () {
// expected-error @+1 {{cannot have 'built_in' attribute (only allowed in spv.globalVariable)}}
// expected-error @+1 {{cannot have 'built_in' attribute (only allowed in spv.GlobalVariable)}}
%1 = spv.Variable built_in("GlobalInvocationID") : !spv.ptr<vector<3xi32>, Function>
return
}
@ -554,7 +554,7 @@ func @expect_ptr_result_type(%arg0: f32) -> () {
// -----
func @variable_init(%arg0: f32) -> () {
// expected-error @+1 {{op initializer must be the result of a constant or spv.globalVariable op}}
// expected-error @+1 {{op initializer must be the result of a constant or spv.GlobalVariable op}}
%0 = spv.Variable init(%arg0) : !spv.ptr<f32, Function>
return
}
@ -562,7 +562,7 @@ func @variable_init(%arg0: f32) -> () {
// -----
func @cannot_be_generic_storage_class(%arg0: f32) -> () {
// expected-error @+1 {{op can only be used to model function-level variables. Use spv.globalVariable for module-level variables}}
// expected-error @+1 {{op can only be used to model function-level variables. Use spv.GlobalVariable for module-level variables}}
%0 = spv.Variable : !spv.ptr<f32, Generic>
return
}

View File

@ -5,7 +5,7 @@
//===----------------------------------------------------------------------===//
spv.module Logical GLSL450 {
spv.globalVariable @var1 : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Input>
spv.GlobalVariable @var1 : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Input>
spv.func @access_chain() -> () "None" {
%0 = spv.Constant 1: i32
// CHECK: [[VAR1:%.*]] = spv.mlir.addressof @var1 : !spv.ptr<!spv.struct<(f32, !spv.array<4 x f32>)>, Input>
@ -19,7 +19,7 @@ spv.module Logical GLSL450 {
// -----
// Allow taking address of global variables in other module-like ops
spv.globalVariable @var : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Input>
spv.GlobalVariable @var : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Input>
func @addressof() -> () {
// CHECK: spv.mlir.addressof @var
%1 = spv.mlir.addressof @var : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Input>
@ -29,9 +29,9 @@ func @addressof() -> () {
// -----
spv.module Logical GLSL450 {
spv.globalVariable @var1 : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Input>
spv.GlobalVariable @var1 : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Input>
spv.func @foo() -> () "None" {
// expected-error @+1 {{expected spv.globalVariable symbol}}
// expected-error @+1 {{expected spv.GlobalVariable symbol}}
%0 = spv.mlir.addressof @var2 : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Input>
}
}
@ -39,7 +39,7 @@ spv.module Logical GLSL450 {
// -----
spv.module Logical GLSL450 {
spv.globalVariable @var1 : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Input>
spv.GlobalVariable @var1 : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Input>
spv.func @foo() -> () "None" {
// expected-error @+1 {{result type mismatch with the referenced global variable's type}}
%0 = spv.mlir.addressof @var1 : !spv.ptr<f32, Input>
@ -144,8 +144,8 @@ spv.module Logical GLSL450 {
}
spv.module Logical GLSL450 {
spv.globalVariable @var2 : !spv.ptr<f32, Input>
spv.globalVariable @var3 : !spv.ptr<f32, Output>
spv.GlobalVariable @var2 : !spv.ptr<f32, Input>
spv.GlobalVariable @var3 : !spv.ptr<f32, Output>
spv.func @do_something(%arg0 : !spv.ptr<f32, Input>, %arg1 : !spv.ptr<f32, Output>) -> () "None" {
%1 = spv.Load "Input" %arg0 : f32
spv.Store "Output" %arg1, %1 : f32
@ -298,93 +298,93 @@ spv.module Logical GLSL450 {
// -----
//===----------------------------------------------------------------------===//
// spv.globalVariable
// spv.GlobalVariable
//===----------------------------------------------------------------------===//
spv.module Logical GLSL450 {
// CHECK: spv.globalVariable @var0 : !spv.ptr<f32, Input>
spv.globalVariable @var0 : !spv.ptr<f32, Input>
// CHECK: spv.GlobalVariable @var0 : !spv.ptr<f32, Input>
spv.GlobalVariable @var0 : !spv.ptr<f32, Input>
}
// TODO: Fix test case after initialization with normal constant is addressed
// spv.module Logical GLSL450 {
// %0 = spv.Constant 4.0 : f32
// // CHECK1: spv.Variable init(%0) : !spv.ptr<f32, Private>
// spv.globalVariable @var1 init(%0) : !spv.ptr<f32, Private>
// spv.GlobalVariable @var1 init(%0) : !spv.ptr<f32, Private>
// }
// -----
spv.module Logical GLSL450 {
spv.SpecConstant @sc = 4.0 : f32
// CHECK: spv.globalVariable @var initializer(@sc) : !spv.ptr<f32, Private>
spv.globalVariable @var initializer(@sc) : !spv.ptr<f32, Private>
// CHECK: spv.GlobalVariable @var initializer(@sc) : !spv.ptr<f32, Private>
spv.GlobalVariable @var initializer(@sc) : !spv.ptr<f32, Private>
}
// -----
// Allow initializers coming from other module-like ops
spv.SpecConstant @sc = 4.0 : f32
// CHECK: spv.globalVariable @var initializer(@sc)
spv.globalVariable @var initializer(@sc) : !spv.ptr<f32, Private>
// CHECK: spv.GlobalVariable @var initializer(@sc)
spv.GlobalVariable @var initializer(@sc) : !spv.ptr<f32, Private>
// -----
spv.module Logical GLSL450 {
// CHECK: spv.globalVariable @var0 bind(1, 2) : !spv.ptr<f32, Uniform>
spv.globalVariable @var0 bind(1, 2) : !spv.ptr<f32, Uniform>
// CHECK: spv.GlobalVariable @var0 bind(1, 2) : !spv.ptr<f32, Uniform>
spv.GlobalVariable @var0 bind(1, 2) : !spv.ptr<f32, Uniform>
}
// TODO: Fix test case after initialization with constant is addressed
// spv.module Logical GLSL450 {
// %0 = spv.Constant 4.0 : f32
// // CHECK1: spv.globalVariable @var1 initializer(%0) {binding = 5 : i32} : !spv.ptr<f32, Private>
// spv.globalVariable @var1 initializer(%0) {binding = 5 : i32} : !spv.ptr<f32, Private>
// // CHECK1: spv.GlobalVariable @var1 initializer(%0) {binding = 5 : i32} : !spv.ptr<f32, Private>
// spv.GlobalVariable @var1 initializer(%0) {binding = 5 : i32} : !spv.ptr<f32, Private>
// }
// -----
spv.module Logical GLSL450 {
// CHECK: spv.globalVariable @var1 built_in("GlobalInvocationID") : !spv.ptr<vector<3xi32>, Input>
spv.globalVariable @var1 built_in("GlobalInvocationID") : !spv.ptr<vector<3xi32>, Input>
// CHECK: spv.globalVariable @var2 built_in("GlobalInvocationID") : !spv.ptr<vector<3xi32>, Input>
spv.globalVariable @var2 {built_in = "GlobalInvocationID"} : !spv.ptr<vector<3xi32>, Input>
// CHECK: spv.GlobalVariable @var1 built_in("GlobalInvocationID") : !spv.ptr<vector<3xi32>, Input>
spv.GlobalVariable @var1 built_in("GlobalInvocationID") : !spv.ptr<vector<3xi32>, Input>
// CHECK: spv.GlobalVariable @var2 built_in("GlobalInvocationID") : !spv.ptr<vector<3xi32>, Input>
spv.GlobalVariable @var2 {built_in = "GlobalInvocationID"} : !spv.ptr<vector<3xi32>, Input>
}
// -----
// Allow in other module-like ops
module {
// CHECK: spv.globalVariable
spv.globalVariable @var0 : !spv.ptr<f32, Input>
// CHECK: spv.GlobalVariable
spv.GlobalVariable @var0 : !spv.ptr<f32, Input>
}
// -----
spv.module Logical GLSL450 {
// expected-error @+1 {{expected spv.ptr type}}
spv.globalVariable @var0 : f32
spv.GlobalVariable @var0 : f32
}
// -----
spv.module Logical GLSL450 {
// expected-error @+1 {{op initializer must be result of a spv.SpecConstant or spv.globalVariable op}}
spv.globalVariable @var0 initializer(@var1) : !spv.ptr<f32, Private>
// expected-error @+1 {{op initializer must be result of a spv.SpecConstant or spv.GlobalVariable op}}
spv.GlobalVariable @var0 initializer(@var1) : !spv.ptr<f32, Private>
}
// -----
spv.module Logical GLSL450 {
// expected-error @+1 {{storage class cannot be 'Generic'}}
spv.globalVariable @var0 : !spv.ptr<f32, Generic>
spv.GlobalVariable @var0 : !spv.ptr<f32, Generic>
}
// -----
spv.module Logical GLSL450 {
// expected-error @+1 {{storage class cannot be 'Function'}}
spv.globalVariable @var0 : !spv.ptr<f32, Function>
spv.GlobalVariable @var0 : !spv.ptr<f32, Function>
}
// -----
@ -392,7 +392,7 @@ spv.module Logical GLSL450 {
spv.module Logical GLSL450 {
spv.func @foo() "None" {
// expected-error @+1 {{op must appear in a module-like op's block}}
spv.globalVariable @var0 : !spv.ptr<f32, Input>
spv.GlobalVariable @var0 : !spv.ptr<f32, Input>
spv.Return
}
}

View File

@ -240,7 +240,7 @@ spv.module Logical GLSL450 {
// CHECK-NEXT: spv.ReturnValue
// CHECK-NEXT: }
// CHECK-NEXT: spv.globalVariable @foo_1
// CHECK-NEXT: spv.GlobalVariable @foo_1
// CHECK-NEXT: }
module {
@ -251,7 +251,7 @@ spv.module Logical GLSL450 {
}
spv.module Logical GLSL450 {
spv.globalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
spv.GlobalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
}
}
@ -266,7 +266,7 @@ spv.module Logical GLSL450 {
// CHECK-NEXT: spv.ReturnValue
// CHECK-NEXT: }
// CHECK-NEXT: spv.globalVariable @foo_1
// CHECK-NEXT: spv.GlobalVariable @foo_1
// CHECK-NEXT: spv.func @bar
// CHECK-NEXT: spv.mlir.addressof @foo_1
// CHECK-NEXT: spv.Load
@ -282,7 +282,7 @@ spv.module Logical GLSL450 {
}
spv.module Logical GLSL450 {
spv.globalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
spv.GlobalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
spv.func @bar() -> f32 "None" {
%0 = spv.mlir.addressof @foo : !spv.ptr<f32, Input>
@ -299,7 +299,7 @@ spv.module Logical GLSL450 {
// CHECK: module {
// CHECK-NEXT: spv.module Logical GLSL450 {
// CHECK-NEXT: spv.globalVariable @foo_1
// CHECK-NEXT: spv.GlobalVariable @foo_1
// CHECK-NEXT: spv.func @bar
// CHECK-NEXT: spv.mlir.addressof @foo_1
// CHECK-NEXT: spv.Load
@ -313,7 +313,7 @@ spv.module Logical GLSL450 {
module {
spv.module Logical GLSL450 {
spv.globalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
spv.GlobalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
spv.func @bar() -> f32 "None" {
%0 = spv.mlir.addressof @foo : !spv.ptr<f32, Input>
@ -582,18 +582,18 @@ spv.module Logical GLSL450 {
// CHECK: module {
// CHECK-NEXT: spv.module Logical GLSL450 {
// CHECK-NEXT: spv.globalVariable @foo_1 bind(1, 0)
// CHECK-NEXT: spv.GlobalVariable @foo_1 bind(1, 0)
// CHECK-NEXT: spv.globalVariable @foo bind(2, 0)
// CHECK-NEXT: spv.GlobalVariable @foo bind(2, 0)
// CHECK-NEXT: }
module {
spv.module Logical GLSL450 {
spv.globalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
spv.GlobalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
}
spv.module Logical GLSL450 {
spv.globalVariable @foo bind(2, 0) : !spv.ptr<f32, Input>
spv.GlobalVariable @foo bind(2, 0) : !spv.ptr<f32, Input>
}
}
@ -601,18 +601,18 @@ spv.module Logical GLSL450 {
// CHECK: module {
// CHECK-NEXT: spv.module Logical GLSL450 {
// CHECK-NEXT: spv.globalVariable @foo_1 built_in("GlobalInvocationId")
// CHECK-NEXT: spv.GlobalVariable @foo_1 built_in("GlobalInvocationId")
// CHECK-NEXT: spv.globalVariable @foo built_in("LocalInvocationId")
// CHECK-NEXT: spv.GlobalVariable @foo built_in("LocalInvocationId")
// CHECK-NEXT: }
module {
spv.module Logical GLSL450 {
spv.globalVariable @foo built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
spv.GlobalVariable @foo built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
}
spv.module Logical GLSL450 {
spv.globalVariable @foo built_in("LocalInvocationId") : !spv.ptr<vector<3xi32>, Input>
spv.GlobalVariable @foo built_in("LocalInvocationId") : !spv.ptr<vector<3xi32>, Input>
}
}
@ -622,14 +622,14 @@ spv.module Logical GLSL450 {
// CHECK: module {
// CHECK-NEXT: spv.module Logical GLSL450 {
// CHECK-NEXT: spv.globalVariable @foo_1
// CHECK-NEXT: spv.GlobalVariable @foo_1
// CHECK-NEXT: spv.SpecConstant @foo
// CHECK-NEXT: }
module {
spv.module Logical GLSL450 {
spv.globalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
spv.GlobalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
}
spv.module Logical GLSL450 {
@ -645,7 +645,7 @@ spv.module Logical GLSL450 {
// CHECK-NEXT: spv.module Logical GLSL450 {
// CHECK-NEXT: spv.SpecConstant @foo_1
// CHECK-NEXT: spv.globalVariable @foo
// CHECK-NEXT: spv.GlobalVariable @foo
// CHECK-NEXT: }
module {
@ -654,7 +654,7 @@ spv.module Logical GLSL450 {
}
spv.module Logical GLSL450 {
spv.globalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
spv.GlobalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
}
}
@ -664,7 +664,7 @@ spv.module Logical GLSL450 {
// CHECK: module {
// CHECK-NEXT: spv.module Logical GLSL450 {
// CHECK-NEXT: spv.globalVariable @foo_1
// CHECK-NEXT: spv.GlobalVariable @foo_1
// CHECK-NEXT: spv.SpecConstant @bar
// CHECK-NEXT: spv.SpecConstantComposite @foo (@bar, @bar)
@ -672,7 +672,7 @@ spv.module Logical GLSL450 {
module {
spv.module Logical GLSL450 {
spv.globalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
spv.GlobalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
}
spv.module Logical GLSL450 {
@ -690,7 +690,7 @@ spv.module Logical GLSL450 {
// CHECK-NEXT: spv.SpecConstant @bar
// CHECK-NEXT: spv.SpecConstantComposite @foo_1 (@bar, @bar)
// CHECK-NEXT: spv.globalVariable @foo
// CHECK-NEXT: spv.GlobalVariable @foo
// CHECK-NEXT: }
module {
@ -700,6 +700,6 @@ spv.module Logical GLSL450 {
}
spv.module Logical GLSL450 {
spv.globalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
spv.GlobalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
}
}

View File

@ -4,7 +4,7 @@
// CHECK: module {
// CHECK-NEXT: spv.module Logical GLSL450 {
// CHECK-NEXT: spv.globalVariable @foo
// CHECK-NEXT: spv.GlobalVariable @foo
// CHECK-NEXT: spv.func @use_foo
// CHECK-NEXT: spv.mlir.addressof @foo
@ -23,7 +23,7 @@
module {
spv.module Logical GLSL450 {
spv.globalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
spv.GlobalVariable @foo bind(1, 0) : !spv.ptr<f32, Input>
spv.func @use_foo() -> f32 "None" {
%0 = spv.mlir.addressof @foo : !spv.ptr<f32, Input>
@ -33,7 +33,7 @@ spv.module Logical GLSL450 {
}
spv.module Logical GLSL450 {
spv.globalVariable @bar bind(1, 0) : !spv.ptr<f32, Input>
spv.GlobalVariable @bar bind(1, 0) : !spv.ptr<f32, Input>
spv.func @use_bar() -> f32 "None" {
%0 = spv.mlir.addressof @bar : !spv.ptr<f32, Input>
@ -50,9 +50,9 @@ spv.module Logical GLSL450 {
// CHECK: module {
// CHECK-NEXT: spv.module Logical GLSL450 {
// CHECK-NEXT: spv.globalVariable @foo bind(1, 0)
// CHECK-NEXT: spv.GlobalVariable @foo bind(1, 0)
// CHECK-NEXT: spv.globalVariable @bar bind(1, 0)
// CHECK-NEXT: spv.GlobalVariable @bar bind(1, 0)
// CHECK-NEXT: spv.func @use_bar
// CHECK-NEXT: spv.mlir.addressof @bar
@ -64,11 +64,11 @@ spv.module Logical GLSL450 {
module {
spv.module Logical GLSL450 {
spv.globalVariable @foo bind(1, 0) : !spv.ptr<i32, Input>
spv.GlobalVariable @foo bind(1, 0) : !spv.ptr<i32, Input>
}
spv.module Logical GLSL450 {
spv.globalVariable @bar bind(1, 0) : !spv.ptr<f32, Input>
spv.GlobalVariable @bar bind(1, 0) : !spv.ptr<f32, Input>
spv.func @use_bar() -> f32 "None" {
%0 = spv.mlir.addressof @bar : !spv.ptr<f32, Input>
@ -84,7 +84,7 @@ spv.module Logical GLSL450 {
// CHECK: module {
// CHECK-NEXT: spv.module Logical GLSL450 {
// CHECK-NEXT: spv.globalVariable @foo built_in("GlobalInvocationId")
// CHECK-NEXT: spv.GlobalVariable @foo built_in("GlobalInvocationId")
// CHECK-NEXT: spv.func @use_bar
// CHECK-NEXT: spv.mlir.addressof @foo
// CHECK-NEXT: spv.Load
@ -95,11 +95,11 @@ spv.module Logical GLSL450 {
module {
spv.module Logical GLSL450 {
spv.globalVariable @foo built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
spv.GlobalVariable @foo built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
}
spv.module Logical GLSL450 {
spv.globalVariable @bar built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
spv.GlobalVariable @bar built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
spv.func @use_bar() -> vector<3xi32> "None" {
%0 = spv.mlir.addressof @bar : !spv.ptr<vector<3xi32>, Input>

View File

@ -7,8 +7,8 @@ module attributes {
// CHECK-LABEL: spv.module
spv.module Logical GLSL450 {
// CHECK-DAG: spv.globalVariable [[VAR0:@.*]] bind(0, 0) : !spv.ptr<!spv.struct<(f32 [0])>, StorageBuffer>
// CHECK-DAG: spv.globalVariable [[VAR1:@.*]] bind(0, 1) : !spv.ptr<!spv.struct<(!spv.array<12 x f32, stride=4> [0])>, StorageBuffer>
// CHECK-DAG: spv.GlobalVariable [[VAR0:@.*]] bind(0, 0) : !spv.ptr<!spv.struct<(f32 [0])>, StorageBuffer>
// CHECK-DAG: spv.GlobalVariable [[VAR1:@.*]] bind(0, 1) : !spv.ptr<!spv.struct<(!spv.array<12 x f32, stride=4> [0])>, StorageBuffer>
// CHECK: spv.func [[FN:@.*]]()
spv.func @kernel(
%arg0: f32

View File

@ -7,21 +7,21 @@ module attributes {
// CHECK-LABEL: spv.module
spv.module Logical GLSL450 {
// CHECK-DAG: spv.globalVariable [[WORKGROUPSIZE:@.*]] built_in("WorkgroupSize")
spv.globalVariable @__builtin_var_WorkgroupSize__ built_in("WorkgroupSize") : !spv.ptr<vector<3xi32>, Input>
// CHECK-DAG: spv.globalVariable [[NUMWORKGROUPS:@.*]] built_in("NumWorkgroups")
spv.globalVariable @__builtin_var_NumWorkgroups__ built_in("NumWorkgroups") : !spv.ptr<vector<3xi32>, Input>
// CHECK-DAG: spv.globalVariable [[LOCALINVOCATIONID:@.*]] built_in("LocalInvocationId")
spv.globalVariable @__builtin_var_LocalInvocationId__ built_in("LocalInvocationId") : !spv.ptr<vector<3xi32>, Input>
// CHECK-DAG: spv.globalVariable [[WORKGROUPID:@.*]] built_in("WorkgroupId")
spv.globalVariable @__builtin_var_WorkgroupId__ built_in("WorkgroupId") : !spv.ptr<vector<3xi32>, Input>
// CHECK-DAG: spv.globalVariable [[VAR0:@.*]] bind(0, 0) : !spv.ptr<!spv.struct<(!spv.array<12 x !spv.array<4 x f32, stride=4>, stride=16> [0])>, StorageBuffer>
// CHECK-DAG: spv.globalVariable [[VAR1:@.*]] bind(0, 1) : !spv.ptr<!spv.struct<(!spv.array<12 x !spv.array<4 x f32, stride=4>, stride=16> [0])>, StorageBuffer>
// CHECK-DAG: spv.globalVariable [[VAR2:@.*]] bind(0, 2) : !spv.ptr<!spv.struct<(!spv.array<12 x !spv.array<4 x f32, stride=4>, stride=16> [0])>, StorageBuffer>
// CHECK-DAG: spv.globalVariable [[VAR3:@.*]] bind(0, 3) : !spv.ptr<!spv.struct<(i32 [0])>, StorageBuffer>
// CHECK-DAG: spv.globalVariable [[VAR4:@.*]] bind(0, 4) : !spv.ptr<!spv.struct<(i32 [0])>, StorageBuffer>
// CHECK-DAG: spv.globalVariable [[VAR5:@.*]] bind(0, 5) : !spv.ptr<!spv.struct<(i32 [0])>, StorageBuffer>
// CHECK-DAG: spv.globalVariable [[VAR6:@.*]] bind(0, 6) : !spv.ptr<!spv.struct<(i32 [0])>, StorageBuffer>
// CHECK-DAG: spv.GlobalVariable [[WORKGROUPSIZE:@.*]] built_in("WorkgroupSize")
spv.GlobalVariable @__builtin_var_WorkgroupSize__ built_in("WorkgroupSize") : !spv.ptr<vector<3xi32>, Input>
// CHECK-DAG: spv.GlobalVariable [[NUMWORKGROUPS:@.*]] built_in("NumWorkgroups")
spv.GlobalVariable @__builtin_var_NumWorkgroups__ built_in("NumWorkgroups") : !spv.ptr<vector<3xi32>, Input>
// CHECK-DAG: spv.GlobalVariable [[LOCALINVOCATIONID:@.*]] built_in("LocalInvocationId")
spv.GlobalVariable @__builtin_var_LocalInvocationId__ built_in("LocalInvocationId") : !spv.ptr<vector<3xi32>, Input>
// CHECK-DAG: spv.GlobalVariable [[WORKGROUPID:@.*]] built_in("WorkgroupId")
spv.GlobalVariable @__builtin_var_WorkgroupId__ built_in("WorkgroupId") : !spv.ptr<vector<3xi32>, Input>
// CHECK-DAG: spv.GlobalVariable [[VAR0:@.*]] bind(0, 0) : !spv.ptr<!spv.struct<(!spv.array<12 x !spv.array<4 x f32, stride=4>, stride=16> [0])>, StorageBuffer>
// CHECK-DAG: spv.GlobalVariable [[VAR1:@.*]] bind(0, 1) : !spv.ptr<!spv.struct<(!spv.array<12 x !spv.array<4 x f32, stride=4>, stride=16> [0])>, StorageBuffer>
// CHECK-DAG: spv.GlobalVariable [[VAR2:@.*]] bind(0, 2) : !spv.ptr<!spv.struct<(!spv.array<12 x !spv.array<4 x f32, stride=4>, stride=16> [0])>, StorageBuffer>
// CHECK-DAG: spv.GlobalVariable [[VAR3:@.*]] bind(0, 3) : !spv.ptr<!spv.struct<(i32 [0])>, StorageBuffer>
// CHECK-DAG: spv.GlobalVariable [[VAR4:@.*]] bind(0, 4) : !spv.ptr<!spv.struct<(i32 [0])>, StorageBuffer>
// CHECK-DAG: spv.GlobalVariable [[VAR5:@.*]] bind(0, 5) : !spv.ptr<!spv.struct<(i32 [0])>, StorageBuffer>
// CHECK-DAG: spv.GlobalVariable [[VAR6:@.*]] bind(0, 6) : !spv.ptr<!spv.struct<(i32 [0])>, StorageBuffer>
// CHECK: spv.func [[FN:@.*]]()
spv.func @load_store_kernel(
%arg0: !spv.ptr<!spv.struct<(!spv.array<12 x !spv.array<4 x f32>>)>, StorageBuffer>

View File

@ -33,7 +33,7 @@ spv.module Logical GLSL450 {
// -----
spv.module Logical GLSL450 {
spv.globalVariable @data bind(0, 0) : !spv.ptr<!spv.struct<(!spv.rtarray<i32> [0])>, StorageBuffer>
spv.GlobalVariable @data bind(0, 0) : !spv.ptr<!spv.struct<(!spv.rtarray<i32> [0])>, StorageBuffer>
spv.func @callee() "None" {
%0 = spv.mlir.addressof @data : !spv.ptr<!spv.struct<(!spv.rtarray<i32> [0])>, StorageBuffer>
%1 = spv.Constant 0: i32
@ -184,8 +184,8 @@ spv.module Logical GLSL450 {
// -----
spv.module Logical GLSL450 {
spv.globalVariable @arg_0 bind(0, 0) : !spv.ptr<!spv.struct<(i32 [0])>, StorageBuffer>
spv.globalVariable @arg_1 bind(0, 1) : !spv.ptr<!spv.struct<(i32 [0])>, StorageBuffer>
spv.GlobalVariable @arg_0 bind(0, 0) : !spv.ptr<!spv.struct<(i32 [0])>, StorageBuffer>
spv.GlobalVariable @arg_1 bind(0, 1) : !spv.ptr<!spv.struct<(i32 [0])>, StorageBuffer>
// CHECK: @inline_into_selection_region
spv.func @inline_into_selection_region() "None" {

View File

@ -1,23 +1,23 @@
// RUN: mlir-opt -decorate-spirv-composite-type-layout -split-input-file -verify-diagnostics %s -o - | FileCheck %s
spv.module Logical GLSL450 {
// CHECK: spv.globalVariable @var0 bind(0, 1) : !spv.ptr<!spv.struct<(i32 [0], !spv.struct<(f32 [0], i32 [4])> [4], f32 [12])>, Uniform>
spv.globalVariable @var0 bind(0,1) : !spv.ptr<!spv.struct<(i32, !spv.struct<(f32, i32)>, f32)>, Uniform>
// CHECK: spv.GlobalVariable @var0 bind(0, 1) : !spv.ptr<!spv.struct<(i32 [0], !spv.struct<(f32 [0], i32 [4])> [4], f32 [12])>, Uniform>
spv.GlobalVariable @var0 bind(0,1) : !spv.ptr<!spv.struct<(i32, !spv.struct<(f32, i32)>, f32)>, Uniform>
// CHECK: spv.globalVariable @var1 bind(0, 2) : !spv.ptr<!spv.struct<(!spv.array<64 x i32, stride=4> [0], f32 [256])>, StorageBuffer>
spv.globalVariable @var1 bind(0,2) : !spv.ptr<!spv.struct<(!spv.array<64xi32>, f32)>, StorageBuffer>
// CHECK: spv.GlobalVariable @var1 bind(0, 2) : !spv.ptr<!spv.struct<(!spv.array<64 x i32, stride=4> [0], f32 [256])>, StorageBuffer>
spv.GlobalVariable @var1 bind(0,2) : !spv.ptr<!spv.struct<(!spv.array<64xi32>, f32)>, StorageBuffer>
// CHECK: spv.globalVariable @var2 bind(1, 0) : !spv.ptr<!spv.struct<(!spv.struct<(!spv.array<64 x i32, stride=4> [0], f32 [256])> [0], i32 [260])>, StorageBuffer>
spv.globalVariable @var2 bind(1,0) : !spv.ptr<!spv.struct<(!spv.struct<(!spv.array<64xi32>, f32)>, i32)>, StorageBuffer>
// CHECK: spv.GlobalVariable @var2 bind(1, 0) : !spv.ptr<!spv.struct<(!spv.struct<(!spv.array<64 x i32, stride=4> [0], f32 [256])> [0], i32 [260])>, StorageBuffer>
spv.GlobalVariable @var2 bind(1,0) : !spv.ptr<!spv.struct<(!spv.struct<(!spv.array<64xi32>, f32)>, i32)>, StorageBuffer>
// CHECK: spv.globalVariable @var3 : !spv.ptr<!spv.struct<(!spv.array<16 x !spv.struct<(f32 [0], f32 [4], !spv.array<16 x f32, stride=4> [8])>, stride=72> [0], f32 [1152])>, StorageBuffer>
spv.globalVariable @var3 : !spv.ptr<!spv.struct<(!spv.array<16x!spv.struct<(f32, f32, !spv.array<16xf32>)>>, f32)>, StorageBuffer>
// CHECK: spv.GlobalVariable @var3 : !spv.ptr<!spv.struct<(!spv.array<16 x !spv.struct<(f32 [0], f32 [4], !spv.array<16 x f32, stride=4> [8])>, stride=72> [0], f32 [1152])>, StorageBuffer>
spv.GlobalVariable @var3 : !spv.ptr<!spv.struct<(!spv.array<16x!spv.struct<(f32, f32, !spv.array<16xf32>)>>, f32)>, StorageBuffer>
// CHECK: spv.globalVariable @var4 bind(1, 2) : !spv.ptr<!spv.struct<(!spv.struct<(!spv.struct<(i1 [0], i8 [1], i16 [2], i32 [4], i64 [8])> [0], f32 [16], i1 [20])> [0], i1 [24])>, StorageBuffer>
spv.globalVariable @var4 bind(1,2) : !spv.ptr<!spv.struct<(!spv.struct<(!spv.struct<(i1, i8, i16, i32, i64)>, f32, i1)>, i1)>, StorageBuffer>
// CHECK: spv.GlobalVariable @var4 bind(1, 2) : !spv.ptr<!spv.struct<(!spv.struct<(!spv.struct<(i1 [0], i8 [1], i16 [2], i32 [4], i64 [8])> [0], f32 [16], i1 [20])> [0], i1 [24])>, StorageBuffer>
spv.GlobalVariable @var4 bind(1,2) : !spv.ptr<!spv.struct<(!spv.struct<(!spv.struct<(i1, i8, i16, i32, i64)>, f32, i1)>, i1)>, StorageBuffer>
// CHECK: spv.globalVariable @var5 bind(1, 3) : !spv.ptr<!spv.struct<(!spv.array<256 x f32, stride=4> [0])>, StorageBuffer>
spv.globalVariable @var5 bind(1,3) : !spv.ptr<!spv.struct<(!spv.array<256xf32>)>, StorageBuffer>
// CHECK: spv.GlobalVariable @var5 bind(1, 3) : !spv.ptr<!spv.struct<(!spv.array<256 x f32, stride=4> [0])>, StorageBuffer>
spv.GlobalVariable @var5 bind(1,3) : !spv.ptr<!spv.struct<(!spv.array<256xf32>)>, StorageBuffer>
spv.func @kernel() -> () "None" {
%c0 = spv.Constant 0 : i32
@ -32,68 +32,68 @@ spv.module Logical GLSL450 {
// -----
spv.module Logical GLSL450 {
// CHECK: spv.globalVariable @var0 : !spv.ptr<!spv.struct<(!spv.struct<(!spv.struct<(!spv.struct<(!spv.struct<(i1 [0], i1 [1], f64 [8])> [0], i1 [16])> [0], i1 [24])> [0], i1 [32])> [0], i1 [40])>, Uniform>
spv.globalVariable @var0 : !spv.ptr<!spv.struct<(!spv.struct<(!spv.struct<(!spv.struct<(!spv.struct<(i1, i1, f64)>, i1)>, i1)>, i1)>, i1)>, Uniform>
// CHECK: spv.GlobalVariable @var0 : !spv.ptr<!spv.struct<(!spv.struct<(!spv.struct<(!spv.struct<(!spv.struct<(i1 [0], i1 [1], f64 [8])> [0], i1 [16])> [0], i1 [24])> [0], i1 [32])> [0], i1 [40])>, Uniform>
spv.GlobalVariable @var0 : !spv.ptr<!spv.struct<(!spv.struct<(!spv.struct<(!spv.struct<(!spv.struct<(i1, i1, f64)>, i1)>, i1)>, i1)>, i1)>, Uniform>
// CHECK: spv.globalVariable @var1 : !spv.ptr<!spv.struct<(!spv.struct<(i16 [0], !spv.struct<(i1 [0], f64 [8])> [8], f32 [24])> [0], f32 [32])>, Uniform>
spv.globalVariable @var1 : !spv.ptr<!spv.struct<(!spv.struct<(i16, !spv.struct<(i1, f64)>, f32)>, f32)>, Uniform>
// CHECK: spv.GlobalVariable @var1 : !spv.ptr<!spv.struct<(!spv.struct<(i16 [0], !spv.struct<(i1 [0], f64 [8])> [8], f32 [24])> [0], f32 [32])>, Uniform>
spv.GlobalVariable @var1 : !spv.ptr<!spv.struct<(!spv.struct<(i16, !spv.struct<(i1, f64)>, f32)>, f32)>, Uniform>
// CHECK: spv.globalVariable @var2 : !spv.ptr<!spv.struct<(!spv.struct<(i16 [0], !spv.struct<(i1 [0], !spv.array<16 x !spv.array<16 x i64, stride=8>, stride=128> [8])> [8], f32 [2064])> [0], f32 [2072])>, Uniform>
spv.globalVariable @var2 : !spv.ptr<!spv.struct<(!spv.struct<(i16, !spv.struct<(i1, !spv.array<16x!spv.array<16xi64>>)>, f32)>, f32)>, Uniform>
// CHECK: spv.GlobalVariable @var2 : !spv.ptr<!spv.struct<(!spv.struct<(i16 [0], !spv.struct<(i1 [0], !spv.array<16 x !spv.array<16 x i64, stride=8>, stride=128> [8])> [8], f32 [2064])> [0], f32 [2072])>, Uniform>
spv.GlobalVariable @var2 : !spv.ptr<!spv.struct<(!spv.struct<(i16, !spv.struct<(i1, !spv.array<16x!spv.array<16xi64>>)>, f32)>, f32)>, Uniform>
// CHECK: spv.globalVariable @var3 : !spv.ptr<!spv.struct<(!spv.struct<(!spv.array<64 x i64, stride=8> [0], i1 [512])> [0], i1 [520])>, Uniform>
spv.globalVariable @var3 : !spv.ptr<!spv.struct<(!spv.struct<(!spv.array<64xi64>, i1)>, i1)>, Uniform>
// CHECK: spv.GlobalVariable @var3 : !spv.ptr<!spv.struct<(!spv.struct<(!spv.array<64 x i64, stride=8> [0], i1 [512])> [0], i1 [520])>, Uniform>
spv.GlobalVariable @var3 : !spv.ptr<!spv.struct<(!spv.struct<(!spv.array<64xi64>, i1)>, i1)>, Uniform>
// CHECK: spv.globalVariable @var4 : !spv.ptr<!spv.struct<(i1 [0], !spv.struct<(i64 [0], i1 [8], i1 [9], i1 [10], i1 [11])> [8], i1 [24])>, Uniform>
spv.globalVariable @var4 : !spv.ptr<!spv.struct<(i1, !spv.struct<(i64, i1, i1, i1, i1)>, i1)>, Uniform>
// CHECK: spv.GlobalVariable @var4 : !spv.ptr<!spv.struct<(i1 [0], !spv.struct<(i64 [0], i1 [8], i1 [9], i1 [10], i1 [11])> [8], i1 [24])>, Uniform>
spv.GlobalVariable @var4 : !spv.ptr<!spv.struct<(i1, !spv.struct<(i64, i1, i1, i1, i1)>, i1)>, Uniform>
// CHECK: spv.globalVariable @var5 : !spv.ptr<!spv.struct<(i1 [0], !spv.struct<(i1 [0], i1 [1], i1 [2], i1 [3], i64 [8])> [8], i1 [24])>, Uniform>
spv.globalVariable @var5 : !spv.ptr<!spv.struct<(i1, !spv.struct<(i1, i1, i1, i1, i64)>, i1)>, Uniform>
// CHECK: spv.GlobalVariable @var5 : !spv.ptr<!spv.struct<(i1 [0], !spv.struct<(i1 [0], i1 [1], i1 [2], i1 [3], i64 [8])> [8], i1 [24])>, Uniform>
spv.GlobalVariable @var5 : !spv.ptr<!spv.struct<(i1, !spv.struct<(i1, i1, i1, i1, i64)>, i1)>, Uniform>
// CHECK: spv.globalVariable @var6 : !spv.ptr<!spv.struct<(i1 [0], !spv.struct<(i64 [0], i32 [8], i16 [12], i8 [14], i1 [15])> [8], i1 [24])>, Uniform>
spv.globalVariable @var6 : !spv.ptr<!spv.struct<(i1, !spv.struct<(i64, i32, i16, i8, i1)>, i1)>, Uniform>
// CHECK: spv.GlobalVariable @var6 : !spv.ptr<!spv.struct<(i1 [0], !spv.struct<(i64 [0], i32 [8], i16 [12], i8 [14], i1 [15])> [8], i1 [24])>, Uniform>
spv.GlobalVariable @var6 : !spv.ptr<!spv.struct<(i1, !spv.struct<(i64, i32, i16, i8, i1)>, i1)>, Uniform>
// CHECK: spv.globalVariable @var7 : !spv.ptr<!spv.struct<(i1 [0], !spv.struct<(!spv.struct<(i1 [0], i64 [8])> [0], i1 [16])> [8], i1 [32])>, Uniform>
spv.globalVariable @var7 : !spv.ptr<!spv.struct<(i1, !spv.struct<(!spv.struct<(i1, i64)>, i1)>, i1)>, Uniform>
// CHECK: spv.GlobalVariable @var7 : !spv.ptr<!spv.struct<(i1 [0], !spv.struct<(!spv.struct<(i1 [0], i64 [8])> [0], i1 [16])> [8], i1 [32])>, Uniform>
spv.GlobalVariable @var7 : !spv.ptr<!spv.struct<(i1, !spv.struct<(!spv.struct<(i1, i64)>, i1)>, i1)>, Uniform>
}
// -----
spv.module Logical GLSL450 {
// CHECK: spv.globalVariable @var0 : !spv.ptr<!spv.struct<(vector<2xi32> [0], f32 [8])>, StorageBuffer>
spv.globalVariable @var0 : !spv.ptr<!spv.struct<(vector<2xi32>, f32)>, StorageBuffer>
// CHECK: spv.GlobalVariable @var0 : !spv.ptr<!spv.struct<(vector<2xi32> [0], f32 [8])>, StorageBuffer>
spv.GlobalVariable @var0 : !spv.ptr<!spv.struct<(vector<2xi32>, f32)>, StorageBuffer>
// CHECK: spv.globalVariable @var1 : !spv.ptr<!spv.struct<(vector<3xi32> [0], f32 [12])>, StorageBuffer>
spv.globalVariable @var1 : !spv.ptr<!spv.struct<(vector<3xi32>, f32)>, StorageBuffer>
// CHECK: spv.GlobalVariable @var1 : !spv.ptr<!spv.struct<(vector<3xi32> [0], f32 [12])>, StorageBuffer>
spv.GlobalVariable @var1 : !spv.ptr<!spv.struct<(vector<3xi32>, f32)>, StorageBuffer>
// CHECK: spv.globalVariable @var2 : !spv.ptr<!spv.struct<(vector<4xi32> [0], f32 [16])>, StorageBuffer>
spv.globalVariable @var2 : !spv.ptr<!spv.struct<(vector<4xi32>, f32)>, StorageBuffer>
// CHECK: spv.GlobalVariable @var2 : !spv.ptr<!spv.struct<(vector<4xi32> [0], f32 [16])>, StorageBuffer>
spv.GlobalVariable @var2 : !spv.ptr<!spv.struct<(vector<4xi32>, f32)>, StorageBuffer>
}
// -----
spv.module Logical GLSL450 {
// CHECK: spv.globalVariable @emptyStructAsMember : !spv.ptr<!spv.struct<(!spv.struct<()> [0])>, StorageBuffer>
spv.globalVariable @emptyStructAsMember : !spv.ptr<!spv.struct<(!spv.struct<()>)>, StorageBuffer>
// CHECK: spv.GlobalVariable @emptyStructAsMember : !spv.ptr<!spv.struct<(!spv.struct<()> [0])>, StorageBuffer>
spv.GlobalVariable @emptyStructAsMember : !spv.ptr<!spv.struct<(!spv.struct<()>)>, StorageBuffer>
// CHECK: spv.globalVariable @arrayType : !spv.ptr<!spv.array<4 x !spv.array<4 x f32>>, StorageBuffer>
spv.globalVariable @arrayType : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, StorageBuffer>
// CHECK: spv.GlobalVariable @arrayType : !spv.ptr<!spv.array<4 x !spv.array<4 x f32>>, StorageBuffer>
spv.GlobalVariable @arrayType : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, StorageBuffer>
// CHECK: spv.globalVariable @InputStorage : !spv.ptr<!spv.struct<(!spv.array<256 x f32>)>, Input>
spv.globalVariable @InputStorage : !spv.ptr<!spv.struct<(!spv.array<256xf32>)>, Input>
// CHECK: spv.GlobalVariable @InputStorage : !spv.ptr<!spv.struct<(!spv.array<256 x f32>)>, Input>
spv.GlobalVariable @InputStorage : !spv.ptr<!spv.struct<(!spv.array<256xf32>)>, Input>
// CHECK: spv.globalVariable @customLayout : !spv.ptr<!spv.struct<(f32 [256], i32 [512])>, Uniform>
spv.globalVariable @customLayout : !spv.ptr<!spv.struct<(f32 [256], i32 [512])>, Uniform>
// CHECK: spv.GlobalVariable @customLayout : !spv.ptr<!spv.struct<(f32 [256], i32 [512])>, Uniform>
spv.GlobalVariable @customLayout : !spv.ptr<!spv.struct<(f32 [256], i32 [512])>, Uniform>
// CHECK: spv.globalVariable @emptyStruct : !spv.ptr<!spv.struct<()>, Uniform>
spv.globalVariable @emptyStruct : !spv.ptr<!spv.struct<()>, Uniform>
// CHECK: spv.GlobalVariable @emptyStruct : !spv.ptr<!spv.struct<()>, Uniform>
spv.GlobalVariable @emptyStruct : !spv.ptr<!spv.struct<()>, Uniform>
}
// -----
spv.module Logical GLSL450 {
// CHECK: spv.globalVariable @var0 : !spv.ptr<!spv.struct<(i32 [0])>, PushConstant>
spv.globalVariable @var0 : !spv.ptr<!spv.struct<(i32)>, PushConstant>
// CHECK: spv.globalVariable @var1 : !spv.ptr<!spv.struct<(i32 [0])>, PhysicalStorageBuffer>
spv.globalVariable @var1 : !spv.ptr<!spv.struct<(i32)>, PhysicalStorageBuffer>
// CHECK: spv.GlobalVariable @var0 : !spv.ptr<!spv.struct<(i32 [0])>, PushConstant>
spv.GlobalVariable @var0 : !spv.ptr<!spv.struct<(i32)>, PushConstant>
// CHECK: spv.GlobalVariable @var1 : !spv.ptr<!spv.struct<(i32 [0])>, PhysicalStorageBuffer>
spv.GlobalVariable @var1 : !spv.ptr<!spv.struct<(i32)>, PhysicalStorageBuffer>
}

View File

@ -192,6 +192,6 @@ spv.module Logical GLSL450 attributes {
#spv.vce<v1.5, [Shader, UniformAndStorageBuffer8BitAccess, StorageBuffer16BitAccess, StorageUniform16, Int16, ImageBuffer, StorageImageExtendedFormats], []>,
{}>
} {
spv.globalVariable @data : !spv.ptr<!spv.struct<(i8 [0], f16 [2], i64 [4])>, Uniform>
spv.globalVariable @img : !spv.ptr<!spv.image<f32, Buffer, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Rg32f>, UniformConstant>
spv.GlobalVariable @data : !spv.ptr<!spv.struct<(i8 [0], f16 [2], i64 [4])>, Uniform>
spv.GlobalVariable @img : !spv.ptr<!spv.image<f32, Buffer, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Rg32f>, UniformConstant>
}

View File

@ -11,8 +11,8 @@ spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// -----
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// CHECK: spv.globalVariable {{@.*}} : !spv.ptr<!spv.rtarray<f32, stride=4>, StorageBuffer>
spv.globalVariable @var0 : !spv.ptr<!spv.rtarray<f32, stride=4>, StorageBuffer>
// CHECK: spv.globalVariable {{@.*}} : !spv.ptr<!spv.rtarray<vector<4xf16>>, Input>
spv.globalVariable @var1 : !spv.ptr<!spv.rtarray<vector<4xf16>>, Input>
// CHECK: spv.GlobalVariable {{@.*}} : !spv.ptr<!spv.rtarray<f32, stride=4>, StorageBuffer>
spv.GlobalVariable @var0 : !spv.ptr<!spv.rtarray<f32, stride=4>, StorageBuffer>
// CHECK: spv.GlobalVariable {{@.*}} : !spv.ptr<!spv.rtarray<vector<4xf16>>, Input>
spv.GlobalVariable @var1 : !spv.ptr<!spv.rtarray<vector<4xf16>>, Input>
}

View File

@ -2,7 +2,7 @@
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// CHECK: loc({{".*debug.mlir"}}:5:3)
spv.globalVariable @var0 bind(0, 1) : !spv.ptr<f32, Input>
spv.GlobalVariable @var0 bind(0, 1) : !spv.ptr<f32, Input>
spv.func @arithmetic(%arg0 : vector<4xf32>, %arg1 : vector<4xf32>) "None" {
// CHECK: loc({{".*debug.mlir"}}:8:10)
%0 = spv.FAdd %arg0, %arg1 : vector<4xf32>

View File

@ -2,21 +2,21 @@
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// CHECK: location = 0 : i32
spv.globalVariable @var {location = 0 : i32} : !spv.ptr<vector<4xf32>, Input>
spv.GlobalVariable @var {location = 0 : i32} : !spv.ptr<vector<4xf32>, Input>
}
// -----
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// CHECK: no_perspective
spv.globalVariable @var {no_perspective} : !spv.ptr<vector<4xf32>, Input>
spv.GlobalVariable @var {no_perspective} : !spv.ptr<vector<4xf32>, Input>
}
// -----
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// CHECK: flat
spv.globalVariable @var {flat} : !spv.ptr<si32, Input>
spv.GlobalVariable @var {flat} : !spv.ptr<si32, Input>
}
// -----
@ -24,28 +24,28 @@ spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// CHECK: aliased
// CHECK: aliased
spv.globalVariable @var1 bind(0, 0) {aliased} : !spv.ptr<!spv.struct<(!spv.array<4xf32, stride=4>[0])>, StorageBuffer>
spv.globalVariable @var2 bind(0, 0) {aliased} : !spv.ptr<!spv.struct<(vector<4xf32>[0])>, StorageBuffer>
spv.GlobalVariable @var1 bind(0, 0) {aliased} : !spv.ptr<!spv.struct<(!spv.array<4xf32, stride=4>[0])>, StorageBuffer>
spv.GlobalVariable @var2 bind(0, 0) {aliased} : !spv.ptr<!spv.struct<(vector<4xf32>[0])>, StorageBuffer>
}
// -----
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// CHECK: non_readable
spv.globalVariable @var bind(0, 0) {non_readable} : !spv.ptr<!spv.struct<(!spv.array<4xf32, stride=4>[0])>, StorageBuffer>
spv.GlobalVariable @var bind(0, 0) {non_readable} : !spv.ptr<!spv.struct<(!spv.array<4xf32, stride=4>[0])>, StorageBuffer>
}
// -----
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// CHECK: non_writable
spv.globalVariable @var bind(0, 0) {non_writable} : !spv.ptr<!spv.struct<(!spv.array<4xf32, stride=4>[0])>, StorageBuffer>
spv.GlobalVariable @var bind(0, 0) {non_writable} : !spv.ptr<!spv.struct<(!spv.array<4xf32, stride=4>[0])>, StorageBuffer>
}
// -----
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// CHECK: restrict
spv.globalVariable @var bind(0, 0) {restrict} : !spv.ptr<!spv.struct<(!spv.array<4xf32, stride=4>[0])>, StorageBuffer>
spv.GlobalVariable @var bind(0, 0) {restrict} : !spv.ptr<!spv.struct<(!spv.array<4xf32, stride=4>[0])>, StorageBuffer>
}

View File

@ -13,12 +13,12 @@ spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// -----
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// CHECK: spv.globalVariable @var2 : !spv.ptr<f32, Input>
// CHECK-NEXT: spv.globalVariable @var3 : !spv.ptr<f32, Output>
// CHECK: spv.GlobalVariable @var2 : !spv.ptr<f32, Input>
// CHECK-NEXT: spv.GlobalVariable @var3 : !spv.ptr<f32, Output>
// CHECK-NEXT: spv.func @noop({{%.*}}: !spv.ptr<f32, Input>, {{%.*}}: !spv.ptr<f32, Output>) "None"
// CHECK: spv.EntryPoint "GLCompute" @noop, @var2, @var3
spv.globalVariable @var2 : !spv.ptr<f32, Input>
spv.globalVariable @var3 : !spv.ptr<f32, Output>
spv.GlobalVariable @var2 : !spv.ptr<f32, Input>
spv.GlobalVariable @var3 : !spv.ptr<f32, Output>
spv.func @noop(%arg0 : !spv.ptr<f32, Input>, %arg1 : !spv.ptr<f32, Output>) -> () "None" {
spv.Return
}

View File

@ -1,7 +1,7 @@
// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
spv.globalVariable @var1 : !spv.ptr<!spv.array<4xf32>, Input>
spv.GlobalVariable @var1 : !spv.ptr<!spv.array<4xf32>, Input>
spv.func @fmain() -> i32 "None" {
%0 = spv.Constant 16 : i32
%1 = spv.mlir.addressof @var1 : !spv.ptr<!spv.array<4xf32>, Input>

View File

@ -1,30 +1,30 @@
// 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>
// 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 requires #spv.vce<v1.0, [Shader], []> {
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.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 requires #spv.vce<v1.0, [Shader], []> {
// 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>
// 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 requires #spv.vce<v1.0, [Shader], []> {
spv.globalVariable @globalInvocationID built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
spv.GlobalVariable @globalInvocationID built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
spv.func @foo() "None" {
// CHECK: %[[ADDR:.*]] = spv.mlir.addressof @globalInvocationID : !spv.ptr<vector<3xi32>, Input>
%0 = spv.mlir.addressof @globalInvocationID : !spv.ptr<vector<3xi32>, Input>

View File

@ -2,11 +2,11 @@
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// CHECK: !spv.ptr<!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>, UniformConstant>
spv.globalVariable @var0 bind(0, 1) : !spv.ptr<!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>, UniformConstant>
spv.GlobalVariable @var0 bind(0, 1) : !spv.ptr<!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>, UniformConstant>
// CHECK: !spv.ptr<!spv.image<si32, Cube, IsDepth, NonArrayed, SingleSampled, NeedSampler, R8ui>, UniformConstant>
spv.globalVariable @var1 : !spv.ptr<!spv.image<si32, Cube, IsDepth, NonArrayed, SingleSampled, NeedSampler, R8ui>, UniformConstant>
spv.GlobalVariable @var1 : !spv.ptr<!spv.image<si32, Cube, IsDepth, NonArrayed, SingleSampled, NeedSampler, R8ui>, UniformConstant>
// CHECK: !spv.ptr<!spv.image<i32, SubpassData, DepthUnknown, Arrayed, MultiSampled, NoSampler, Unknown>, UniformConstant>
spv.globalVariable @var2 : !spv.ptr<!spv.image<i32, SubpassData, DepthUnknown, Arrayed, MultiSampled, NoSampler, Unknown>, UniformConstant>
spv.GlobalVariable @var2 : !spv.ptr<!spv.image<i32, SubpassData, DepthUnknown, Arrayed, MultiSampled, NoSampler, Unknown>, UniformConstant>
}

View File

@ -60,8 +60,8 @@ spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// -----
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
spv.globalVariable @GV1 bind(0, 0) : !spv.ptr<!spv.struct<(!spv.array<10 x f32, stride=4> [0])>, StorageBuffer>
spv.globalVariable @GV2 bind(0, 1) : !spv.ptr<!spv.struct<(!spv.array<10 x f32, stride=4> [0])>, StorageBuffer>
spv.GlobalVariable @GV1 bind(0, 0) : !spv.ptr<!spv.struct<(!spv.array<10 x f32, stride=4> [0])>, StorageBuffer>
spv.GlobalVariable @GV2 bind(0, 1) : !spv.ptr<!spv.struct<(!spv.array<10 x f32, stride=4> [0])>, StorageBuffer>
spv.func @loop_kernel() "None" {
%0 = spv.mlir.addressof @GV1 : !spv.ptr<!spv.struct<(!spv.array<10 x f32, stride=4> [0])>, StorageBuffer>
%1 = spv.Constant 0 : i32

View File

@ -48,12 +48,12 @@ spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// -----
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// CHECK: spv.globalVariable {{@.*}} : !spv.ptr<!spv.matrix<3 x vector<3xf32>>, StorageBuffer>
spv.globalVariable @var0 : !spv.ptr<!spv.matrix<3 x vector<3xf32>>, StorageBuffer>
// CHECK: spv.GlobalVariable {{@.*}} : !spv.ptr<!spv.matrix<3 x vector<3xf32>>, StorageBuffer>
spv.GlobalVariable @var0 : !spv.ptr<!spv.matrix<3 x vector<3xf32>>, StorageBuffer>
// CHECK: spv.globalVariable {{@.*}} : !spv.ptr<!spv.matrix<2 x vector<3xf32>>, StorageBuffer>
spv.globalVariable @var1 : !spv.ptr<!spv.matrix<2 x vector<3xf32>>, StorageBuffer>
// CHECK: spv.GlobalVariable {{@.*}} : !spv.ptr<!spv.matrix<2 x vector<3xf32>>, StorageBuffer>
spv.GlobalVariable @var1 : !spv.ptr<!spv.matrix<2 x vector<3xf32>>, StorageBuffer>
// CHECK: spv.globalVariable {{@.*}} : !spv.ptr<!spv.matrix<4 x vector<4xf16>>, StorageBuffer>
spv.globalVariable @var2 : !spv.ptr<!spv.matrix<4 x vector<4xf16>>, StorageBuffer>
// CHECK: spv.GlobalVariable {{@.*}} : !spv.ptr<!spv.matrix<4 x vector<4xf16>>, StorageBuffer>
spv.GlobalVariable @var2 : !spv.ptr<!spv.matrix<4 x vector<4xf16>>, StorageBuffer>
}

View File

@ -159,8 +159,8 @@ spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// Test nested loops with block arguments
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
spv.globalVariable @__builtin_var_NumWorkgroups__ built_in("NumWorkgroups") : !spv.ptr<vector<3xi32>, Input>
spv.globalVariable @__builtin_var_WorkgroupId__ built_in("WorkgroupId") : !spv.ptr<vector<3xi32>, Input>
spv.GlobalVariable @__builtin_var_NumWorkgroups__ built_in("NumWorkgroups") : !spv.ptr<vector<3xi32>, Input>
spv.GlobalVariable @__builtin_var_WorkgroupId__ built_in("WorkgroupId") : !spv.ptr<vector<3xi32>, Input>
spv.func @fmul_kernel() "None" {
%3 = spv.Constant 12 : i32
%4 = spv.Constant 32 : i32

View File

@ -2,11 +2,11 @@
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// CHECK: !spv.ptr<!spv.sampled_image<!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, UniformConstant>
spv.globalVariable @var0 bind(0, 1) : !spv.ptr<!spv.sampled_image<!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, UniformConstant>
spv.GlobalVariable @var0 bind(0, 1) : !spv.ptr<!spv.sampled_image<!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, UniformConstant>
// CHECK: !spv.ptr<!spv.sampled_image<!spv.image<si32, SubpassData, DepthUnknown, Arrayed, MultiSampled, NoSampler, Unknown>>, UniformConstant>
spv.globalVariable @var1 bind(0, 0) : !spv.ptr<!spv.sampled_image<!spv.image<si32, SubpassData, DepthUnknown, Arrayed, MultiSampled, NoSampler, Unknown>>, UniformConstant>
spv.GlobalVariable @var1 bind(0, 0) : !spv.ptr<!spv.sampled_image<!spv.image<si32, SubpassData, DepthUnknown, Arrayed, MultiSampled, NoSampler, Unknown>>, UniformConstant>
// CHECK: !spv.ptr<!spv.sampled_image<!spv.image<i32, Rect, DepthUnknown, Arrayed, MultiSampled, NeedSampler, R8ui>>, UniformConstant>
spv.globalVariable @var2 bind(0, 0) : !spv.ptr<!spv.sampled_image<!spv.image<i32, Rect, DepthUnknown, Arrayed, MultiSampled, NeedSampler, R8ui>>, UniformConstant>
spv.GlobalVariable @var2 bind(0, 0) : !spv.ptr<!spv.sampled_image<!spv.image<i32, Rect, DepthUnknown, Arrayed, MultiSampled, NeedSampler, R8ui>>, UniformConstant>
}

View File

@ -2,47 +2,47 @@
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// CHECK: !spv.ptr<!spv.struct<(!spv.array<128 x f32, stride=4> [0])>, Input>
spv.globalVariable @var0 bind(0, 1) : !spv.ptr<!spv.struct<(!spv.array<128 x f32, stride=4> [0])>, Input>
spv.GlobalVariable @var0 bind(0, 1) : !spv.ptr<!spv.struct<(!spv.array<128 x f32, stride=4> [0])>, Input>
// CHECK: !spv.ptr<!spv.struct<(f32 [0], !spv.struct<(f32 [0], !spv.array<16 x f32, stride=4> [4])> [4])>, Input>
spv.globalVariable @var1 bind(0, 2) : !spv.ptr<!spv.struct<(f32 [0], !spv.struct<(f32 [0], !spv.array<16 x f32, stride=4> [4])> [4])>, Input>
spv.GlobalVariable @var1 bind(0, 2) : !spv.ptr<!spv.struct<(f32 [0], !spv.struct<(f32 [0], !spv.array<16 x f32, stride=4> [4])> [4])>, Input>
// CHECK: !spv.ptr<!spv.struct<(f32 [0], i32 [4], f64 [8], i64 [16], f32 [24], i32 [30], f32 [34], i32 [38])>, StorageBuffer>
spv.globalVariable @var2 : !spv.ptr<!spv.struct<(f32 [0], i32 [4], f64 [8], i64 [16], f32 [24], i32 [30], f32 [34], i32 [38])>, StorageBuffer>
spv.GlobalVariable @var2 : !spv.ptr<!spv.struct<(f32 [0], i32 [4], f64 [8], i64 [16], f32 [24], i32 [30], f32 [34], i32 [38])>, StorageBuffer>
// CHECK: !spv.ptr<!spv.struct<(!spv.array<128 x !spv.struct<(!spv.array<128 x f32, stride=4> [0])>, stride=512> [0])>, StorageBuffer>
spv.globalVariable @var3 : !spv.ptr<!spv.struct<(!spv.array<128 x !spv.struct<(!spv.array<128 x f32, stride=4> [0])>, stride=512> [0])>, StorageBuffer>
spv.GlobalVariable @var3 : !spv.ptr<!spv.struct<(!spv.array<128 x !spv.struct<(!spv.array<128 x f32, stride=4> [0])>, stride=512> [0])>, StorageBuffer>
// CHECK: !spv.ptr<!spv.struct<(f32 [0, NonWritable], i32 [4])>, StorageBuffer>
spv.globalVariable @var4 : !spv.ptr<!spv.struct<(f32 [0, NonWritable], i32 [4])>, StorageBuffer>
spv.GlobalVariable @var4 : !spv.ptr<!spv.struct<(f32 [0, NonWritable], i32 [4])>, StorageBuffer>
// CHECK: !spv.ptr<!spv.struct<(f32 [NonWritable], i32 [NonWritable, NonReadable])>, StorageBuffer>
spv.globalVariable @var5 : !spv.ptr<!spv.struct<(f32 [NonWritable], i32 [NonWritable, NonReadable])>, StorageBuffer>
spv.GlobalVariable @var5 : !spv.ptr<!spv.struct<(f32 [NonWritable], i32 [NonWritable, NonReadable])>, StorageBuffer>
// CHECK: !spv.ptr<!spv.struct<(f32 [0, NonWritable], i32 [4, NonWritable, NonReadable])>, StorageBuffer>
spv.globalVariable @var6 : !spv.ptr<!spv.struct<(f32 [0, NonWritable], i32 [4, NonWritable, NonReadable])>, StorageBuffer>
spv.GlobalVariable @var6 : !spv.ptr<!spv.struct<(f32 [0, NonWritable], i32 [4, NonWritable, NonReadable])>, StorageBuffer>
// CHECK: !spv.ptr<!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, ColMajor, MatrixStride=16])>, StorageBuffer>
spv.globalVariable @var7 : !spv.ptr<!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, ColMajor, MatrixStride=16])>, StorageBuffer>
spv.GlobalVariable @var7 : !spv.ptr<!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, ColMajor, MatrixStride=16])>, StorageBuffer>
// CHECK: !spv.ptr<!spv.struct<()>, StorageBuffer>
spv.globalVariable @empty : !spv.ptr<!spv.struct<()>, StorageBuffer>
spv.GlobalVariable @empty : !spv.ptr<!spv.struct<()>, StorageBuffer>
// CHECK: !spv.ptr<!spv.struct<empty_struct, ()>, StorageBuffer>
spv.globalVariable @id_empty : !spv.ptr<!spv.struct<empty_struct, ()>, StorageBuffer>
spv.GlobalVariable @id_empty : !spv.ptr<!spv.struct<empty_struct, ()>, StorageBuffer>
// CHECK: !spv.ptr<!spv.struct<test_id, (!spv.array<128 x f32, stride=4> [0])>, Input>
spv.globalVariable @id_var0 : !spv.ptr<!spv.struct<test_id, (!spv.array<128 x f32, stride=4> [0])>, Input>
spv.GlobalVariable @id_var0 : !spv.ptr<!spv.struct<test_id, (!spv.array<128 x f32, stride=4> [0])>, Input>
// CHECK: !spv.ptr<!spv.struct<rec, (!spv.ptr<!spv.struct<rec>, StorageBuffer>)>, StorageBuffer>
spv.globalVariable @recursive_simple : !spv.ptr<!spv.struct<rec, (!spv.ptr<!spv.struct<rec>, StorageBuffer>)>, StorageBuffer>
spv.GlobalVariable @recursive_simple : !spv.ptr<!spv.struct<rec, (!spv.ptr<!spv.struct<rec>, StorageBuffer>)>, StorageBuffer>
// CHECK: !spv.ptr<!spv.struct<a, (!spv.ptr<!spv.struct<b, (!spv.ptr<!spv.struct<a>, Uniform>)>, Uniform>)>, Uniform>
spv.globalVariable @recursive_2 : !spv.ptr<!spv.struct<a, (!spv.ptr<!spv.struct<b, (!spv.ptr<!spv.struct<a>, Uniform>)>, Uniform>)>, Uniform>
spv.GlobalVariable @recursive_2 : !spv.ptr<!spv.struct<a, (!spv.ptr<!spv.struct<b, (!spv.ptr<!spv.struct<a>, Uniform>)>, Uniform>)>, Uniform>
// CHECK: !spv.ptr<!spv.struct<axx, (!spv.ptr<!spv.struct<bxx, (!spv.ptr<!spv.struct<axx>, Uniform>, !spv.ptr<!spv.struct<bxx>, Uniform>)>, Uniform>)>, Uniform>
spv.globalVariable @recursive_3 : !spv.ptr<!spv.struct<axx, (!spv.ptr<!spv.struct<bxx, (!spv.ptr<!spv.struct<axx>, Uniform>, !spv.ptr<!spv.struct<bxx>, Uniform>)>, Uniform>)>, Uniform>
spv.GlobalVariable @recursive_3 : !spv.ptr<!spv.struct<axx, (!spv.ptr<!spv.struct<bxx, (!spv.ptr<!spv.struct<axx>, Uniform>, !spv.ptr<!spv.struct<bxx>, Uniform>)>, Uniform>)>, Uniform>
// CHECK: !spv.ptr<!spv.struct<(!spv.array<128 x f32, stride=4> [0])>, Input>,
// CHECK-SAME: !spv.ptr<!spv.struct<(!spv.array<128 x f32, stride=4> [0])>, Output>