Files
wgpu/tests/out/msl/workgroup-var-init.msl
T
Jim Blandyandteoxoy 59a2441a43 [msl-out] Revert af4d989 since #764 removes the need for it (#2331)
Assigning arrays by value works fine since all arrays are now wrapped by a struct.

Co-authored-by: teoxoy <28601907+teoxoy@users.noreply.github.com>
2023-05-09 16:20:15 -07:00

41 lines
1015 B
Plaintext

// language: metal2.0
#include <metal_stdlib>
#include <simd/simd.h>
using metal::uint;
struct type_1 {
uint inner[512];
};
struct type_3 {
metal::atomic_int inner[8];
};
struct type_4 {
type_3 inner[8];
};
struct WStruct {
type_1 arr;
metal::atomic_int atom;
type_4 atom_arr;
};
kernel void main_(
metal::uint3 __local_invocation_id [[thread_position_in_threadgroup]]
, threadgroup WStruct& w_mem
, device type_1& output [[buffer(0)]]
) {
if (metal::all(__local_invocation_id == metal::uint3(0u))) {
w_mem.arr = {};
metal::atomic_store_explicit(&w_mem.atom, 0, metal::memory_order_relaxed);
for (int __i0 = 0; __i0 < 8; __i0++) {
for (int __i1 = 0; __i1 < 8; __i1++) {
metal::atomic_store_explicit(&w_mem.atom_arr.inner[__i0].inner[__i1], 0, metal::memory_order_relaxed);
}
}
}
metal::threadgroup_barrier(metal::mem_flags::mem_threadgroup);
type_1 _e3 = w_mem.arr;
output = _e3;
return;
}