yes
This commit is contained in:
+84
@@ -0,0 +1,84 @@
|
||||
#!amber
|
||||
|
||||
SHADER vertex vtex_shader GLSL TARGET_ENV spv1.3
|
||||
#version 430
|
||||
layout(location = 0) in vec3 position;
|
||||
void main() {
|
||||
gl_Position = vec4(position, 1.0);
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment compare_shader GLSL TARGET_ENV spv1.3
|
||||
#version 430
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_vote : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
|
||||
layout(location = 0) out int compare;
|
||||
layout(location = 1) out vec4 out1;
|
||||
layout(location = 2) out vec4 out2;
|
||||
void main() [[subgroup_uniform_control_flow]] {
|
||||
bool inbounds = (gl_FragCoord.x < 128 || gl_FragCoord.y < 128);
|
||||
bool elect = subgroupElect();
|
||||
if (elect) {
|
||||
out1 = vec4(1.0, 0, 0, 1.0);
|
||||
} else if (inbounds) {
|
||||
out2 = vec4(0, 1.0, 0, 1.0);
|
||||
} else {
|
||||
discard;
|
||||
}
|
||||
|
||||
bool a = (!inbounds && elect);
|
||||
bool b = subgroupElect() == elect;
|
||||
compare = (b && !a) ? 1 : -1;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment expect_shader GLSL TARGET_ENV spv1.3
|
||||
#version 430
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_vote : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
|
||||
layout(location = 0) out int expect;
|
||||
void main() {
|
||||
bool inbounds = (gl_FragCoord.x < 128 || gl_FragCoord.y < 128);
|
||||
expect = inbounds ? 1 : -1;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER position_buf DATA_TYPE vec3<float> DATA
|
||||
-1 -1 0
|
||||
-1 1 0
|
||||
1 -1 0
|
||||
END
|
||||
|
||||
BUFFER expect DATA_TYPE int32 SIZE 65536 FILL -1
|
||||
BUFFER compare DATA_TYPE int32 SIZE 65536 FILL -1
|
||||
BUFFER out1 DATA_TYPE vec4<float> SIZE 65536 FILL -1
|
||||
BUFFER out2 DATA_TYPE vec4<float> SIZE 65536 FILL -1
|
||||
|
||||
PIPELINE graphics compare_pipe
|
||||
ATTACH vtex_shader
|
||||
ATTACH compare_shader
|
||||
|
||||
VERTEX_DATA position_buf LOCATION 0
|
||||
BIND BUFFER compare AS color LOCATION 0
|
||||
BIND BUFFER out1 AS color LOCATION 1
|
||||
BIND BUFFER out2 AS color LOCATION 2
|
||||
FRAMEBUFFER_SIZE 256 256
|
||||
END
|
||||
|
||||
PIPELINE graphics expect_pipe
|
||||
ATTACH vtex_shader
|
||||
ATTACH expect_shader
|
||||
|
||||
VERTEX_DATA position_buf LOCATION 0
|
||||
BIND BUFFER expect AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 256 256
|
||||
END
|
||||
|
||||
RUN expect_pipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 3
|
||||
RUN compare_pipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 3
|
||||
EXPECT compare EQ_BUFFER expect
|
||||
@@ -0,0 +1,76 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
@@ -0,0 +1,75 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
do {
|
||||
c.c[idx] = d.d[idx];
|
||||
} while (!subgroupElect());
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
while (true) {
|
||||
atomicAdd(c.c[0], 1);
|
||||
if (subgroupElect())
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) volatile buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
d.d[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) volatile buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (c.c[idx] > 5)
|
||||
return;
|
||||
|
||||
while (true) {
|
||||
if (d.d[idx]++ > idx)
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 1
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
while (true) {
|
||||
if (c.c[idx] > 5)
|
||||
return;
|
||||
if (d.d[idx]++ > idx)
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 1
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (uint i = 0; i < c.c[idx]; ++i) {
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (i == gl_SubgroupID % 4)
|
||||
break;
|
||||
}
|
||||
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] < 10) {
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] >= 10)
|
||||
break;
|
||||
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
@@ -0,0 +1,87 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] >= 10)
|
||||
continue;
|
||||
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
|
||||
switch (c.c[idx]) {
|
||||
case 0:
|
||||
case 1:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
case 2:
|
||||
d.d[idx] = gl_SubgroupID;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
c.c[idx] = gl_SubgroupID % 4;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[idx] % 2 != 0)
|
||||
return;
|
||||
|
||||
switch (c.c[idx]) {
|
||||
case 0:
|
||||
case 1:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
default:
|
||||
d.d[idx] = gl_SubgroupID;
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
a.a[idx] = gl_SubgroupID;
|
||||
|
||||
c.c[idx] = gl_SubgroupID % 4;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
switch (a.a[idx]) {
|
||||
case 1:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
// fallthrough...
|
||||
case 3:
|
||||
return;
|
||||
default:
|
||||
atomicExchange(d.d[0], gl_SubgroupID);
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
a.a[idx] = gl_SubgroupID % 4;
|
||||
|
||||
c.c[idx] = gl_SubgroupID;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
switch (a.a[idx]) {
|
||||
case 1:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
case 3:
|
||||
return;
|
||||
default:
|
||||
switch (c.c[idx]) {
|
||||
case 0:
|
||||
case 1:
|
||||
atomicExchange(d.d[0], gl_SubgroupID);
|
||||
break;
|
||||
case 2:
|
||||
c.c[idx]++;
|
||||
break;
|
||||
default:
|
||||
atomicAdd(d.d[1], 32);
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
a.a[idx] = gl_SubgroupID % 4;
|
||||
|
||||
c.c[idx] = gl_SubgroupID;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] < 10) {
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[256 * i + idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[256 * 0 + idx] = cmp_val;
|
||||
compare.x[256 * 1 + idx] = cmp_val;
|
||||
compare.x[256 * 2 + idx] = cmp_val;
|
||||
compare.x[256 * 3 + idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 1024 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 1024 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) volatile buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_vote : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint c_val = c.c[idx];
|
||||
if (!subgroupAllEqual(c_val)) {
|
||||
atomicAdd(d.d[0], 1);
|
||||
if (c_val % 2 == 0) {
|
||||
atomicAdd(d.d[idx], gl_SubgroupID);
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = c.c[idx];
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_vote : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint c_val = c.c[idx];
|
||||
bool test = (c_val % 2) == 0;
|
||||
if (subgroupAny(test)) {
|
||||
atomicAdd(d.d[0], 1);
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
|
||||
if (c_val % 2 == 0) {
|
||||
atomicAdd(d.d[idx], gl_SubgroupID);
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = c.c[idx];
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_vote : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = a.a[idx];
|
||||
if (a_val < 128) {
|
||||
uint c_val = c.c[idx];
|
||||
switch (c_val) {
|
||||
case 0:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
if (a_val > 4) {
|
||||
uint val = a_val;
|
||||
for (uint i = 0; i < 4; ++i) {
|
||||
val = atomicExchange(d.d[0], val);
|
||||
if (c_val == 1) return;
|
||||
}
|
||||
} else if (a_val == 3) {
|
||||
atomicAdd(d.d[1], gl_SubgroupID);
|
||||
} else {
|
||||
atomicAdd(d.d[2], gl_SubgroupInvocationID);
|
||||
if (c_val == 1) return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) return;
|
||||
atomicExchange(d.d[idx], c_val);
|
||||
break;
|
||||
}
|
||||
} else if (a_val < 192) {
|
||||
atomicExchange(d.d[idx], a_val);
|
||||
uint c_val = c.c[idx];
|
||||
if (subgroupAny(c_val == 0)) {
|
||||
return;
|
||||
} else {
|
||||
uint val = atomicAdd(d.d[idx], gl_SubgroupInvocationID);
|
||||
while (!subgroupElect()) {
|
||||
val = atomicExchange(d.d[0], val);
|
||||
}
|
||||
if (val > 10) {
|
||||
atomicAnd(d.d[idx], 0xff00ff00);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) return;
|
||||
}
|
||||
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
uint c_val = c.c[idx];
|
||||
if (a.a[idx] < 128) {
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
c_val = 1;
|
||||
} else {
|
||||
c_val = gl_SubgroupInvocationID % 4;
|
||||
if (c_val == 1) c_val += 4;
|
||||
}
|
||||
} else if (a.a[idx] < 192) {
|
||||
if (gl_SubgroupInvocationID == 0 && gl_SubgroupID % 2 != 0) {
|
||||
c_val = 0;
|
||||
} else {
|
||||
c_val = c_val + 1;
|
||||
}
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
do {
|
||||
c.c[idx] = d.d[idx];
|
||||
} while (!subgroupElect());
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
while (true) {
|
||||
atomicAdd(c.c[0], 1);
|
||||
if (subgroupElect())
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) volatile buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
d.d[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0)
|
||||
return;
|
||||
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) volatile buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0)
|
||||
return;
|
||||
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (c.c[idx] > 5)
|
||||
return;
|
||||
|
||||
while (true) {
|
||||
if (d.d[idx]++ > idx)
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 1
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
while (true) {
|
||||
if (c.c[idx] > 5)
|
||||
return;
|
||||
if (d.d[idx]++ > idx)
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 1
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (uint i = 0; i < c.c[idx]; ++i) {
|
||||
if (a.a[gl_SubgroupID] % 2 == 0)
|
||||
return;
|
||||
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (i == gl_SubgroupID % 4)
|
||||
break;
|
||||
}
|
||||
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] < 10) {
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] >= 10)
|
||||
break;
|
||||
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] >= 10)
|
||||
continue;
|
||||
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0)
|
||||
return;
|
||||
|
||||
switch (c.c[idx]) {
|
||||
case 0:
|
||||
case 1:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
case 2:
|
||||
d.d[idx] = gl_SubgroupID;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
c.c[idx] = gl_SubgroupID % 4;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[idx] % 2 == 0)
|
||||
return;
|
||||
|
||||
switch (c.c[idx]) {
|
||||
case 0:
|
||||
case 1:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
default:
|
||||
d.d[idx] = gl_SubgroupID;
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
a.a[idx] = gl_SubgroupID;
|
||||
|
||||
c.c[idx] = gl_SubgroupID % 4;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
switch (a.a[idx]) {
|
||||
case 0:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
// fallthrough...
|
||||
case 2:
|
||||
return;
|
||||
default:
|
||||
atomicExchange(d.d[0], gl_SubgroupID);
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
a.a[idx] = gl_SubgroupID % 4;
|
||||
|
||||
c.c[idx] = gl_SubgroupID;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
switch (a.a[idx]) {
|
||||
case 0:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
case 2:
|
||||
return;
|
||||
default:
|
||||
switch (c.c[idx]) {
|
||||
case 0:
|
||||
case 1:
|
||||
atomicExchange(d.d[0], gl_SubgroupID);
|
||||
break;
|
||||
case 2:
|
||||
c.c[idx]++;
|
||||
break;
|
||||
default:
|
||||
atomicAdd(d.d[1], 32);
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
a.a[idx] = gl_SubgroupID % 4;
|
||||
|
||||
c.c[idx] = gl_SubgroupID;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] < 10) {
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[238 * i + idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[238 * 0 + idx] = cmp_val;
|
||||
compare.x[238 * 1 + idx] = cmp_val;
|
||||
compare.x[238 * 2 + idx] = cmp_val;
|
||||
compare.x[238 * 3 + idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 952 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 952 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) volatile buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0)
|
||||
return;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0)
|
||||
return;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_vote : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint c_val = c.c[idx];
|
||||
if (!subgroupAllEqual(c_val)) {
|
||||
atomicAdd(d.d[0], 1);
|
||||
if (c_val % 2 != 0) {
|
||||
atomicAdd(d.d[idx], gl_SubgroupID);
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = c.c[idx];
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_vote : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint c_val = c.c[idx];
|
||||
bool test = (c_val % 2) != 0;
|
||||
if (subgroupAny(test)) {
|
||||
atomicAdd(d.d[0], 1);
|
||||
if (a.a[gl_SubgroupID] % 2 == 0)
|
||||
return;
|
||||
|
||||
if (c_val % 2 != 0) {
|
||||
atomicAdd(d.d[idx], gl_SubgroupID);
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = c.c[idx];
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_vote : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = a.a[idx];
|
||||
if (a_val < 128) {
|
||||
uint c_val = c.c[idx];
|
||||
switch (c_val) {
|
||||
case 0:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
if (a_val > 4) {
|
||||
uint val = a_val;
|
||||
for (uint i = 0; i < 4; ++i) {
|
||||
val = atomicExchange(d.d[0], val);
|
||||
}
|
||||
} else if (a_val == 3) {
|
||||
atomicAdd(d.d[1], gl_SubgroupID);
|
||||
} else {
|
||||
atomicAdd(d.d[2], gl_SubgroupInvocationID);
|
||||
}
|
||||
if (c_val == 1) return;
|
||||
break;
|
||||
default:
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) return;
|
||||
atomicExchange(d.d[idx], c_val);
|
||||
break;
|
||||
}
|
||||
} else if (a_val < 192) {
|
||||
atomicExchange(d.d[idx], a_val);
|
||||
uint c_val = c.c[idx];
|
||||
if (subgroupAny(c_val == 0)) {
|
||||
return;
|
||||
} else {
|
||||
uint val = atomicAdd(d.d[idx], gl_SubgroupInvocationID);
|
||||
while (!subgroupElect()) {
|
||||
val = atomicExchange(d.d[0], val);
|
||||
}
|
||||
if (val > 10) {
|
||||
atomicAnd(d.d[idx], 0xff00ff00);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) return;
|
||||
}
|
||||
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
uint c_val = c.c[idx];
|
||||
if (a.a[idx] < 128) {
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
c_val = 1;
|
||||
} else {
|
||||
c_val = gl_SubgroupInvocationID % 4;
|
||||
if (c_val == 1) c_val += 4;
|
||||
}
|
||||
} else if (a.a[idx] < 192) {
|
||||
if (gl_SubgroupInvocationID == 0 && gl_SubgroupID % 2 == 0) {
|
||||
c_val = 0;
|
||||
} else {
|
||||
c_val = c_val + 1;
|
||||
}
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
@@ -0,0 +1,86 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
do {
|
||||
c.c[idx] = d.d[idx];
|
||||
} while (!subgroupElect());
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
while (true) {
|
||||
atomicAdd(c.c[0], 1);
|
||||
if (subgroupElect())
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) volatile buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
d.d[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) volatile buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (c.c[idx] > 5)
|
||||
return;
|
||||
|
||||
while (true) {
|
||||
if (d.d[idx]++ > idx)
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 1
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
while (true) {
|
||||
if (c.c[idx] > 5)
|
||||
return;
|
||||
if (d.d[idx]++ > idx)
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 1
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (uint i = 0; i < c.c[idx]; ++i) {
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (i == gl_SubgroupID % 4)
|
||||
break;
|
||||
}
|
||||
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] < 10) {
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] >= 10)
|
||||
break;
|
||||
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
@@ -0,0 +1,98 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] >= 10)
|
||||
continue;
|
||||
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
|
||||
switch (c.c[idx]) {
|
||||
case 0:
|
||||
case 1:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
case 2:
|
||||
d.d[idx] = gl_SubgroupID;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
c.c[idx] = gl_SubgroupID % 4;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[idx] % 2 != 0)
|
||||
return;
|
||||
|
||||
switch (c.c[idx]) {
|
||||
case 0:
|
||||
case 1:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
default:
|
||||
d.d[idx] = gl_SubgroupID;
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
a.a[idx] = gl_SubgroupID;
|
||||
|
||||
c.c[idx] = gl_SubgroupID % 4;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
switch (a.a[idx]) {
|
||||
case 1:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
// fallthrough...
|
||||
case 3:
|
||||
return;
|
||||
default:
|
||||
atomicExchange(d.d[0], gl_SubgroupID);
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
a.a[idx] = gl_SubgroupID % 4;
|
||||
|
||||
c.c[idx] = gl_SubgroupID;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
switch (a.a[idx]) {
|
||||
case 1:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
case 3:
|
||||
return;
|
||||
default:
|
||||
switch (c.c[idx]) {
|
||||
case 0:
|
||||
case 1:
|
||||
atomicExchange(d.d[0], gl_SubgroupID);
|
||||
break;
|
||||
case 2:
|
||||
c.c[idx]++;
|
||||
break;
|
||||
default:
|
||||
atomicAdd(d.d[1], 32);
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
a.a[idx] = gl_SubgroupID % 4;
|
||||
|
||||
c.c[idx] = gl_SubgroupID;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] < 10) {
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[256 * i + idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[256 * 0 + idx] = cmp_val;
|
||||
compare.x[256 * 1 + idx] = cmp_val;
|
||||
compare.x[256 * 2 + idx] = cmp_val;
|
||||
compare.x[256 * 3 + idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 1024 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 1024 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) volatile buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_vote : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint c_val = c.c[idx];
|
||||
if (!subgroupAllEqual(c_val)) {
|
||||
atomicAdd(d.d[0], 1);
|
||||
if (c_val % 2 == 0) {
|
||||
atomicAdd(d.d[idx], gl_SubgroupID);
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = c.c[idx];
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_vote : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint c_val = c.c[idx];
|
||||
bool test = (c_val % 2) == 0;
|
||||
if (subgroupAny(test)) {
|
||||
atomicAdd(d.d[0], 1);
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
|
||||
if (c_val % 2 == 0) {
|
||||
atomicAdd(d.d[idx], gl_SubgroupID);
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = c.c[idx];
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_vote : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = a.a[idx];
|
||||
if (a_val < 128) {
|
||||
uint c_val = c.c[idx];
|
||||
switch (c_val) {
|
||||
case 0:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
if (a_val > 4) {
|
||||
uint val = a_val;
|
||||
for (uint i = 0; i < 4; ++i) {
|
||||
val = atomicExchange(d.d[0], val);
|
||||
if (c_val == 1) return;
|
||||
}
|
||||
} else if (a_val == 3) {
|
||||
atomicAdd(d.d[1], gl_SubgroupID);
|
||||
} else {
|
||||
atomicAdd(d.d[2], gl_SubgroupInvocationID);
|
||||
if (c_val == 1) return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) return;
|
||||
atomicExchange(d.d[idx], c_val);
|
||||
break;
|
||||
}
|
||||
} else if (a_val < 192) {
|
||||
atomicExchange(d.d[idx], a_val);
|
||||
uint c_val = c.c[idx];
|
||||
if (subgroupAny(c_val == 0)) {
|
||||
return;
|
||||
} else {
|
||||
uint val = atomicAdd(d.d[idx], gl_SubgroupInvocationID);
|
||||
while (!subgroupElect()) {
|
||||
val = atomicExchange(d.d[0], val);
|
||||
}
|
||||
if (val > 10) {
|
||||
atomicAnd(d.d[idx], 0xff00ff00);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) return;
|
||||
}
|
||||
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
uint c_val = c.c[idx];
|
||||
if (a.a[idx] < 128) {
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
c_val = 1;
|
||||
} else {
|
||||
c_val = gl_SubgroupInvocationID % 4;
|
||||
if (c_val == 1) c_val += 4;
|
||||
}
|
||||
} else if (a.a[idx] < 192) {
|
||||
if (gl_SubgroupInvocationID == 0 && gl_SubgroupID % 2 != 0) {
|
||||
c_val = 0;
|
||||
} else {
|
||||
c_val = c_val + 1;
|
||||
}
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
do {
|
||||
c.c[idx] = d.d[idx];
|
||||
} while (!subgroupElect());
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
while (true) {
|
||||
atomicAdd(c.c[0], 1);
|
||||
if (subgroupElect())
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) volatile buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
d.d[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0)
|
||||
return;
|
||||
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) volatile buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0)
|
||||
return;
|
||||
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (c.c[idx] > 5)
|
||||
return;
|
||||
|
||||
while (true) {
|
||||
if (d.d[idx]++ > idx)
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 1
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
while (true) {
|
||||
if (c.c[idx] > 5)
|
||||
return;
|
||||
if (d.d[idx]++ > idx)
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 1
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (uint i = 0; i < c.c[idx]; ++i) {
|
||||
if (a.a[gl_SubgroupID] % 2 == 0)
|
||||
return;
|
||||
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (i == gl_SubgroupID % 4)
|
||||
break;
|
||||
}
|
||||
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] < 10) {
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] >= 10)
|
||||
break;
|
||||
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] >= 10)
|
||||
continue;
|
||||
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0)
|
||||
return;
|
||||
|
||||
switch (c.c[idx]) {
|
||||
case 0:
|
||||
case 1:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
case 2:
|
||||
d.d[idx] = gl_SubgroupID;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
c.c[idx] = gl_SubgroupID % 4;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[idx] % 2 == 0)
|
||||
return;
|
||||
|
||||
switch (c.c[idx]) {
|
||||
case 0:
|
||||
case 1:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
default:
|
||||
d.d[idx] = gl_SubgroupID;
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
a.a[idx] = gl_SubgroupID;
|
||||
|
||||
c.c[idx] = gl_SubgroupID % 4;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
switch (a.a[idx]) {
|
||||
case 0:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
// fallthrough...
|
||||
case 2:
|
||||
return;
|
||||
default:
|
||||
atomicExchange(d.d[0], gl_SubgroupID);
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
a.a[idx] = gl_SubgroupID % 4;
|
||||
|
||||
c.c[idx] = gl_SubgroupID;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
switch (a.a[idx]) {
|
||||
case 0:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
case 2:
|
||||
return;
|
||||
default:
|
||||
switch (c.c[idx]) {
|
||||
case 0:
|
||||
case 1:
|
||||
atomicExchange(d.d[0], gl_SubgroupID);
|
||||
break;
|
||||
case 2:
|
||||
c.c[idx]++;
|
||||
break;
|
||||
default:
|
||||
atomicAdd(d.d[1], 32);
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
a.a[idx] = gl_SubgroupID % 4;
|
||||
|
||||
c.c[idx] = gl_SubgroupID;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] < 10) {
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[238 * i + idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[238 * 0 + idx] = cmp_val;
|
||||
compare.x[238 * 1 + idx] = cmp_val;
|
||||
compare.x[238 * 2 + idx] = cmp_val;
|
||||
compare.x[238 * 3 + idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 952 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 952 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) volatile buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0)
|
||||
return;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0)
|
||||
return;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_vote : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint c_val = c.c[idx];
|
||||
if (!subgroupAllEqual(c_val)) {
|
||||
atomicAdd(d.d[0], 1);
|
||||
if (c_val % 2 != 0) {
|
||||
atomicAdd(d.d[idx], gl_SubgroupID);
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = c.c[idx];
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_vote : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint c_val = c.c[idx];
|
||||
bool test = (c_val % 2) != 0;
|
||||
if (subgroupAny(test)) {
|
||||
atomicAdd(d.d[0], 1);
|
||||
if (a.a[gl_SubgroupID] % 2 == 0)
|
||||
return;
|
||||
|
||||
if (c_val % 2 != 0) {
|
||||
atomicAdd(d.d[idx], gl_SubgroupID);
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = c.c[idx];
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl
|
||||
DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_vote : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = a.a[idx];
|
||||
if (a_val < 128) {
|
||||
uint c_val = c.c[idx];
|
||||
switch (c_val) {
|
||||
case 0:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
if (a_val > 4) {
|
||||
uint val = a_val;
|
||||
for (uint i = 0; i < 4; ++i) {
|
||||
val = atomicExchange(d.d[0], val);
|
||||
}
|
||||
} else if (a_val == 3) {
|
||||
atomicAdd(d.d[1], gl_SubgroupID);
|
||||
} else {
|
||||
atomicAdd(d.d[2], gl_SubgroupInvocationID);
|
||||
}
|
||||
if (c_val == 1) return;
|
||||
break;
|
||||
default:
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) return;
|
||||
atomicExchange(d.d[idx], c_val);
|
||||
break;
|
||||
}
|
||||
} else if (a_val < 192) {
|
||||
atomicExchange(d.d[idx], a_val);
|
||||
uint c_val = c.c[idx];
|
||||
if (subgroupAny(c_val == 0)) {
|
||||
return;
|
||||
} else {
|
||||
uint val = atomicAdd(d.d[idx], gl_SubgroupInvocationID);
|
||||
while (!subgroupElect()) {
|
||||
val = atomicExchange(d.d[0], val);
|
||||
}
|
||||
if (val > 10) {
|
||||
atomicAnd(d.d[idx], 0xff00ff00);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) return;
|
||||
}
|
||||
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
uint c_val = c.c[idx];
|
||||
if (a.a[idx] < 128) {
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
c_val = 1;
|
||||
} else {
|
||||
c_val = gl_SubgroupInvocationID % 4;
|
||||
if (c_val == 1) c_val += 4;
|
||||
}
|
||||
} else if (a.a[idx] < 192) {
|
||||
if (gl_SubgroupInvocationID == 0 && gl_SubgroupID % 2 == 0) {
|
||||
c_val = 0;
|
||||
} else {
|
||||
c_val = c_val + 1;
|
||||
}
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
SUBGROUP fill
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
SUBGROUP test
|
||||
FULLY_POPULATED on
|
||||
END
|
||||
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 4 4 4 4
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
do {
|
||||
c.c[idx] = d.d[idx];
|
||||
} while (!subgroupElect());
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
while (true) {
|
||||
atomicAdd(c.c[0], 1);
|
||||
if (subgroupElect())
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) volatile buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
d.d[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) volatile buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) coherent buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
|
||||
if (gl_SubgroupInvocationID == 0) {
|
||||
c.c[idx] += 4;
|
||||
} else {
|
||||
c.c[idx]++;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (c.c[idx] > 5)
|
||||
return;
|
||||
|
||||
while (true) {
|
||||
if (d.d[idx]++ > idx)
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 128 FILL 1
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
while (true) {
|
||||
if (c.c[idx] > 5)
|
||||
return;
|
||||
if (d.d[idx]++ > idx)
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
|
||||
uint c_val = 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
c_val = 10;
|
||||
}
|
||||
c.c[idx] = c_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 128 FILL 1
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (uint i = 0; i < c.c[idx]; ++i) {
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (i == gl_SubgroupID % 4)
|
||||
break;
|
||||
}
|
||||
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
a_val = 4;
|
||||
}
|
||||
compare.x[idx] = a_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] < 10) {
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 128 FILL 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] >= 10)
|
||||
break;
|
||||
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 128 FILL 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
@@ -0,0 +1,87 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
for (int i = 0; i < c.c[0]; ++i) {
|
||||
atomicAdd(d.d[idx], 1);
|
||||
if (a.a[idx] >= 10)
|
||||
continue;
|
||||
|
||||
if (a.a[idx] == 0)
|
||||
atomicAdd(d.d[idx], 2);
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint a_val = 50;
|
||||
if (gl_SubgroupID % 2 == 0) {
|
||||
if (gl_SubgroupInvocationID == 0)
|
||||
a_val = 0;
|
||||
else
|
||||
a_val = 5;
|
||||
}
|
||||
a.a[idx] = a_val;
|
||||
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 128 FILL 1
|
||||
BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0)
|
||||
return;
|
||||
|
||||
switch (c.c[idx]) {
|
||||
case 0:
|
||||
case 1:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
case 2:
|
||||
d.d[idx] = gl_SubgroupID;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (a.a[gl_SubgroupID] % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
c.c[idx] = gl_SubgroupID % 4;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1
|
||||
BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
@@ -0,0 +1,86 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
if (a.a[idx] % 2 != 0)
|
||||
return;
|
||||
|
||||
switch (c.c[idx]) {
|
||||
case 0:
|
||||
case 1:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
break;
|
||||
default:
|
||||
d.d[idx] = gl_SubgroupID;
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
a.a[idx] = gl_SubgroupID;
|
||||
|
||||
c.c[idx] = gl_SubgroupID % 4;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
#!amber
|
||||
|
||||
SHADER compute test GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_EXT_subgroup_uniform_control_flow : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer B { uint b[]; } b;
|
||||
layout(set=0, binding=2) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=3) volatile buffer D { uint d[]; } d;
|
||||
|
||||
void main()
|
||||
[[subgroup_uniform_control_flow]]
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
switch (a.a[idx]) {
|
||||
case 1:
|
||||
atomicAdd(d.d[idx], 1);
|
||||
// fallthrough...
|
||||
case 3:
|
||||
return;
|
||||
default:
|
||||
atomicExchange(d.d[0], gl_SubgroupID);
|
||||
break;
|
||||
}
|
||||
b.b[idx] = subgroupElect() ? 1 : 0;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute fill GLSL TARGET_ENV spv1.3
|
||||
#version 450 core
|
||||
#extension GL_KHR_shader_subgroup_basic : enable
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=0) coherent buffer A { uint a[]; } a;
|
||||
layout(set=0, binding=1) coherent buffer C { uint c[]; } c;
|
||||
layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID;
|
||||
uint cmp_val = subgroupElect() ? 1 : 0;
|
||||
if (gl_SubgroupID % 2 != 0) {
|
||||
cmp_val = 4;
|
||||
}
|
||||
compare.x[idx] = cmp_val;
|
||||
|
||||
a.a[idx] = gl_SubgroupID % 4;
|
||||
|
||||
c.c[idx] = gl_SubgroupID;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0
|
||||
BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4
|
||||
|
||||
PIPELINE compute fill_pipe
|
||||
ATTACH fill
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
PIPELINE compute test_pipe
|
||||
ATTACH test
|
||||
BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN fill_pipe 1 1 1
|
||||
RUN test_pipe 1 1 1
|
||||
|
||||
EXPECT compare IDX 0 EQ 1 0 0 0
|
||||
EXPECT b EQ_BUFFER compare
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user