| #include <metal_stdlib> | |
| using namespace metal; | |
| struct S { | |
| int x; | |
| array<atomic_uint, 10> a; | |
| uint y; | |
| }; | |
| struct tint_module_vars_struct { | |
| threadgroup S* wg; | |
| }; | |
| struct tint_symbol_1 { | |
| S tint_symbol; | |
| }; | |
| void compute_main_inner(uint tint_local_index, tint_module_vars_struct tint_module_vars) { | |
| if ((tint_local_index < 1u)) { | |
| (*tint_module_vars.wg).x = 0; | |
| (*tint_module_vars.wg).y = 0u; | |
| } | |
| { | |
| uint idx = tint_local_index; | |
| while(true) { | |
| uint const v = idx; | |
| if ((v >= 10u)) { | |
| break; | |
| } | |
| (atomic_store_explicit((&(*tint_module_vars.wg).a[v]), 0u, memory_order_relaxed)); | |
| { | |
| idx = (idx + 1u); | |
| } | |
| } | |
| } | |
| (threadgroup_barrier(mem_flags::mem_threadgroup)); | |
| (atomic_store_explicit((&(*tint_module_vars.wg).a[4]), 1u, memory_order_relaxed)); | |
| } | |
| [[max_total_threads_per_threadgroup(1)]] | |
| kernel void compute_main(uint tint_local_index [[thread_index_in_threadgroup]], threadgroup tint_symbol_1* v_1 [[threadgroup(0)]]) { | |
| tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.wg=(&(*v_1).tint_symbol)}; | |
| (compute_main_inner(tint_local_index, tint_module_vars)); | |
| } |