2023-01-24 14:55:17 +00:00
|
|
|
alias Arr = array<u32, 10u>;
|
2022-06-24 22:28:23 +00:00
|
|
|
|
|
|
|
struct S_atomic {
|
2022-12-01 17:37:56 +00:00
|
|
|
/* @offset(0) */
|
2022-06-24 22:28:23 +00:00
|
|
|
x : i32,
|
2022-12-01 17:37:56 +00:00
|
|
|
/* @offset(4) */
|
2022-06-24 22:28:23 +00:00
|
|
|
a : array<atomic<u32>, 10u>,
|
2022-12-01 17:37:56 +00:00
|
|
|
/* @offset(44) */
|
2022-06-24 22:28:23 +00:00
|
|
|
y : u32,
|
|
|
|
}
|
|
|
|
|
|
|
|
struct S {
|
2022-12-01 17:37:56 +00:00
|
|
|
/* @offset(0) */
|
2022-06-24 22:28:23 +00:00
|
|
|
x : i32,
|
2022-12-01 17:37:56 +00:00
|
|
|
/* @offset(4) */
|
2022-06-24 22:28:23 +00:00
|
|
|
a : Arr,
|
2022-12-01 17:37:56 +00:00
|
|
|
/* @offset(44) */
|
2022-06-24 22:28:23 +00:00
|
|
|
y : u32,
|
|
|
|
}
|
|
|
|
|
|
|
|
var<private> local_invocation_index_1 : u32;
|
|
|
|
|
|
|
|
var<workgroup> wg : S_atomic;
|
|
|
|
|
2023-02-21 17:33:54 +00:00
|
|
|
fn compute_main_inner(local_invocation_index_2 : u32) {
|
2023-05-23 18:28:44 +00:00
|
|
|
var idx = 0u;
|
2022-06-24 22:28:23 +00:00
|
|
|
wg.x = 0i;
|
|
|
|
wg.y = 0u;
|
2023-02-21 17:33:54 +00:00
|
|
|
idx = local_invocation_index_2;
|
2022-06-24 22:28:23 +00:00
|
|
|
loop {
|
2023-05-23 18:28:44 +00:00
|
|
|
let x_30 = idx;
|
2022-06-24 22:28:23 +00:00
|
|
|
if (!((x_30 < 10u))) {
|
|
|
|
break;
|
|
|
|
}
|
2023-05-23 18:28:44 +00:00
|
|
|
let x_35 = idx;
|
2022-06-24 22:28:23 +00:00
|
|
|
atomicStore(&(wg.a[x_35]), 0u);
|
|
|
|
|
|
|
|
continuing {
|
2023-05-23 18:28:44 +00:00
|
|
|
let x_41 = idx;
|
2022-06-24 22:28:23 +00:00
|
|
|
idx = (x_41 + 1u);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
workgroupBarrier();
|
|
|
|
atomicStore(&(wg.a[4i]), 1u);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn compute_main_1() {
|
2023-05-23 18:28:44 +00:00
|
|
|
let x_53 = local_invocation_index_1;
|
2022-06-24 22:28:23 +00:00
|
|
|
compute_main_inner(x_53);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
@compute @workgroup_size(1i, 1i, 1i)
|
|
|
|
fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) {
|
|
|
|
local_invocation_index_1 = local_invocation_index_1_param;
|
|
|
|
compute_main_1();
|
|
|
|
}
|