blob: 1ac0133d9ee86abecad70f892a23f02bc1058028 [file] [log] [blame] [edit]
#include <metal_stdlib>
using namespace metal;
struct tint_module_vars_struct {
device uint* prevent_dce;
threadgroup atomic_uint* arg_0;
};
struct tint_symbol_1 {
atomic_uint tint_symbol;
};
uint atomicSub_0d26c2(tint_module_vars_struct tint_module_vars) {
uint arg_1 = 1u;
uint res = atomic_fetch_sub_explicit(tint_module_vars.arg_0, arg_1, memory_order_relaxed);
return res;
}
void compute_main_inner(uint tint_local_index, tint_module_vars_struct tint_module_vars) {
if ((tint_local_index == 0u)) {
atomic_store_explicit(tint_module_vars.arg_0, 0u, memory_order_relaxed);
}
threadgroup_barrier(mem_flags::mem_threadgroup);
(*tint_module_vars.prevent_dce) = atomicSub_0d26c2(tint_module_vars);
}
kernel void compute_main(uint tint_local_index [[thread_index_in_threadgroup]], device uint* prevent_dce [[buffer(0)]], threadgroup tint_symbol_1* v [[threadgroup(0)]]) {
tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce, .arg_0=(&(*v).tint_symbol)};
compute_main_inner(tint_local_index, tint_module_vars);
}