Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[subgroups][non_uniform_broadcast] Fix broadcasting index generation #1680

Merged
9 changes: 8 additions & 1 deletion test_conformance/subgroups/subgroup_common_templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,21 @@ 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)
{
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This highlights a problem with the broadcast tests: they currently are not meant to test subgroup sizes <= NR_OF_ACTIVE_WORK_ITEMS (i.e., 4). Your proposed fix causes the test to skip an important aspect of non-uniform subgroup operations, as the else in sub_group_non_uniform_broadcast_source will not be executed. That means the subgroup operation will not be tested properly when the subgroup size is <= 4, so I don't think we should commit this.

Instead, we should probably try to get rid of NR_OF_ACTIVE_WORK_ITEMS and use work-item masks to introduce divergence in the broadcast tests (as done for e.g. sub_group_non_uniform_any).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing. I agree. Will update the PR.

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;
Expand Down