1// RUN: mlir-opt -spirv-lower-abi-attrs -verify-diagnostics %s -o - | FileCheck %s
2
3module attributes {
4  spv.target_env = #spv.target_env<
5    #spv.vce<v1.0, [Shader], [SPV_KHR_storage_buffer_storage_class]>, {}>
6} {
7
8// CHECK-LABEL: spv.module
9spv.module Logical GLSL450 {
10  // CHECK-DAG:    spv.globalVariable [[VAR0:@.*]] bind(0, 0) : !spv.ptr<!spv.struct<(f32 [0])>, StorageBuffer>
11  // CHECK-DAG:    spv.globalVariable [[VAR1:@.*]] bind(0, 1) : !spv.ptr<!spv.struct<(!spv.array<12 x f32, stride=4> [0])>, StorageBuffer>
12  // CHECK:    spv.func [[FN:@.*]]()
13  spv.func @kernel(
14    %arg0: f32
15           {spv.interface_var_abi = #spv.interface_var_abi<(0, 0), StorageBuffer>},
16    %arg1: !spv.ptr<!spv.struct<(!spv.array<12 x f32>)>, StorageBuffer>
17           {spv.interface_var_abi = #spv.interface_var_abi<(0, 1)>}) "None"
18  attributes {spv.entry_point_abi = {local_size = dense<[32, 1, 1]> : vector<3xi32>}} {
19    // CHECK: [[ARG1:%.*]] = spv.mlir.addressof [[VAR1]]
20    // CHECK: [[ADDRESSARG0:%.*]] = spv.mlir.addressof [[VAR0]]
21    // CHECK: [[CONST0:%.*]] = spv.constant 0 : i32
22    // CHECK: [[ARG0PTR:%.*]] = spv.AccessChain [[ADDRESSARG0]]{{\[}}[[CONST0]]
23    // CHECK: [[ARG0:%.*]] = spv.Load "StorageBuffer" [[ARG0PTR]]
24    // CHECK: spv.Return
25    spv.Return
26  }
27  // CHECK: spv.EntryPoint "GLCompute" [[FN]]
28  // CHECK: spv.ExecutionMode [[FN]] "LocalSize", 32, 1, 1
29} // end spv.module
30
31} // end module
32