| // RUN: clspv %s -o %t.spv -cluster-pod-kernel-args=0 |
| // RUN: spirv-dis -o %t2.spvasm %t.spv |
| // RUN: FileCheck %s < %t2.spvasm |
| // RUN: spirv-val --target-env vulkan1.0 %t.spv |
| |
| int inner(int* arr, int n) { |
| arr[1] = n; |
| } |
| |
| int helper(int* arr, int n) { |
| inner(arr, n); |
| } |
| |
| kernel void foo(global int* A, int n) { |
| int arr[2]; |
| helper(arr, n); |
| *A = arr[1]; |
| } |
| |
| // CHECK: OpDecorate [[__runtimearr_uint:%[0-9a-zA-Z_]+]] ArrayStride 4 |
| // CHECK: OpMemberDecorate [[__struct_4:%[0-9a-zA-Z_]+]] 0 Offset 0 |
| // CHECK: OpDecorate [[__struct_4]] Block |
| // CHECK: OpMemberDecorate [[__struct_6:%[0-9a-zA-Z_]+]] 0 Offset 0 |
| // CHECK: OpDecorate [[__struct_6]] Block |
| // CHECK: OpDecorate [[_18:%[0-9a-zA-Z_]+]] DescriptorSet 0 |
| // CHECK: OpDecorate [[_18]] Binding 0 |
| // CHECK: OpDecorate [[_19:%[0-9a-zA-Z_]+]] DescriptorSet 0 |
| // CHECK: OpDecorate [[_19]] Binding 1 |
| // CHECK-DAG: [[_uint:%[0-9a-zA-Z_]+]] = OpTypeInt 32 0 |
| // CHECK-DAG: [[__ptr_StorageBuffer_uint:%[0-9a-zA-Z_]+]] = OpTypePointer StorageBuffer [[_uint]] |
| // CHECK-DAG: [[__ptr_Uniform_uint:%[0-9a-zA-Z_]+]] = OpTypePointer Uniform [[_uint]] |
| // CHECK-DAG: [[__runtimearr_uint]] = OpTypeRuntimeArray [[_uint]] |
| // CHECK-DAG: [[__struct_4]] = OpTypeStruct [[__runtimearr_uint]] |
| // CHECK-DAG: [[__ptr_StorageBuffer__struct_4:%[0-9a-zA-Z_]+]] = OpTypePointer StorageBuffer [[__struct_4]] |
| // CHECK-DAG: [[__struct_6]] = OpTypeStruct [[_uint]] |
| // CHECK-DAG: [[__ptr_Uniform__struct_6:%[0-9a-zA-Z_]+]] = OpTypePointer Uniform [[__struct_6]] |
| // CHECK-DAG: [[_uint_0:%[0-9a-zA-Z_]+]] = OpConstant [[_uint]] 0 |
| // CHECK: [[_18]] = OpVariable [[__ptr_StorageBuffer__struct_4]] StorageBuffer |
| // CHECK: [[_19]] = OpVariable [[__ptr_Uniform__struct_6]] Uniform |
| // CHECK: [[_21:%[0-9a-zA-Z_]+]] = OpLabel |
| // CHECK: [[_22:%[0-9a-zA-Z_]+]] = OpAccessChain [[__ptr_StorageBuffer_uint]] [[_18]] [[_uint_0]] [[_uint_0]] |
| // CHECK: [[_23:%[0-9a-zA-Z_]+]] = OpAccessChain [[__ptr_Uniform_uint]] [[_19]] [[_uint_0]] |
| // CHECK: [[_24:%[0-9a-zA-Z_]+]] = OpLoad [[_uint]] [[_23]] |
| // CHECK: OpStore [[_22]] [[_24]] |