Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion test_conformance/subgroups/subhelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,10 @@ void set_last_workgroup_params(int non_uniform_size, int &number_of_subgroups,
int subgroup_size, int &workgroup_size,
int &last_subgroup_size)
{
number_of_subgroups = 1 + non_uniform_size / subgroup_size;
number_of_subgroups =
(subgroup_size + non_uniform_size - 1) / subgroup_size;
last_subgroup_size = non_uniform_size % subgroup_size;
if (last_subgroup_size == 0) last_subgroup_size = subgroup_size;
workgroup_size = non_uniform_size;
}

Expand Down
22 changes: 20 additions & 2 deletions test_conformance/subgroups/test_subgroup_ballot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,16 @@ __kernel void test_sub_group_non_uniform_broadcast(const __global Type *in, __gl
int gid = get_global_id(0);
XY(xy,gid);
Type x = in[gid];
if (xy[gid].x < (get_sub_group_size() >> 1)) {

uint sub_group_size = get_sub_group_size();
// If we are at the edge, calculate our own sub_group_size as it's implementation defined otherwise.
if (get_local_size(0) != get_enqueued_local_size(0) && get_sub_group_id() == get_num_sub_groups() - 1) {
uint new_sub_group_size = get_local_size(0) % sub_group_size;
if (new_sub_group_size != 0)
sub_group_size = new_sub_group_size;
}

if (xy[gid].x < (sub_group_size >> 1)) {
out[gid] = sub_group_non_uniform_broadcast(x, xy[gid].z);
} else {
out[gid] = sub_group_non_uniform_broadcast(x, xy[gid].w);
Expand All @@ -778,7 +787,16 @@ __kernel void test_sub_group_broadcast_first(const __global Type *in, __global i
int gid = get_global_id(0);
XY(xy,gid);
Type x = in[gid];
if (xy[gid].x < (get_sub_group_size() >> 1)) {

uint sub_group_size = get_sub_group_size();
// If we are at the edge, calculate our own sub_group_size as it's implementation defined otherwise.
if (get_local_size(0) != get_enqueued_local_size(0) && get_sub_group_id() == get_num_sub_groups() - 1) {
uint new_sub_group_size = get_local_size(0) % sub_group_size;
if (new_sub_group_size != 0)
sub_group_size = new_sub_group_size;
}

if (xy[gid].x < (sub_group_size >> 1)) {
out[gid] = sub_group_broadcast_first(x);;
} else {
out[gid] = sub_group_broadcast_first(x);;
Expand Down
Loading