mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
[subgroups][non_uniform_broadcast] Fix broadcasting index generation
The subgroup size may not be greater than `NR_OF_ACTIVE_WORK_ITEMS`. Broadcasting index needs to be reduced in that case. Otherwise, if subgroup size == `NR_OF_ACTIVE_WORK_ITEMS` == 4, then we will encounter "divide-by-zero" error when evaluating `bcast_index % (n - NR_OF_ACTIVE_WORK_ITEMS)`.
This commit is contained in:
@@ -82,7 +82,7 @@ template <typename Ty, SubgroupsBroadcastOp operation> struct BC
|
||||
// broadcasted (one the same value for whole subgroup)
|
||||
if (operation != SubgroupsBroadcastOp::broadcast)
|
||||
{
|
||||
// reduce brodcasting index in case of non_uniform and
|
||||
// reduce broadcasting index in case of non_uniform and
|
||||
// last workgroup last subgroup
|
||||
if (last_subgroup_size && j == nj - 1
|
||||
&& last_subgroup_size < NR_OF_ACTIVE_WORK_ITEMS)
|
||||
@@ -90,6 +90,13 @@ template <typename Ty, SubgroupsBroadcastOp operation> struct BC
|
||||
bcast_if = bcast_index % last_subgroup_size;
|
||||
bcast_elseif = bcast_if;
|
||||
}
|
||||
// reduce broadcasting index in case subgroup size <=
|
||||
// NR_OF_ACTIVE_WORK_ITEMS (i.e. all items are active)
|
||||
else if (n <= NR_OF_ACTIVE_WORK_ITEMS)
|
||||
{
|
||||
bcast_if = bcast_index % n;
|
||||
bcast_elseif = bcast_if;
|
||||
}
|
||||
else
|
||||
{
|
||||
bcast_if = bcast_index % NR_OF_ACTIVE_WORK_ITEMS;
|
||||
|
||||
Reference in New Issue
Block a user