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

[group_functions] Insert barrier after each validation #750

Merged
merged 3 commits into from
Jul 27, 2023
Merged
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
35 changes: 29 additions & 6 deletions tests/group_functions/group_barrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,23 +146,33 @@ TEMPLATE_TEST_CASE_SIG("Group barriers", "[group_func][dim]", ((int D), D), 1,
"fence_scope) is wrong\n");

// test of default barrier
local_acc[llid] = 0;
local_acc[llid] = llid;
sycl::group_barrier(group);

if (local_acc[max_id - llid] != max_id - llid)
std::get<s::test>(group_barriers_acc[0]) = false;
// make sure we check all items before moving on
sycl::group_barrier(group);
bader marked this conversation as resolved.
Show resolved Hide resolved

local_acc[llid] = 1;
sycl::group_barrier(group);

if (local_acc[max_id - llid] != 1)
std::get<s::test>(group_barriers_acc[0]) = false;
sycl::group_barrier(group);
Nuullll marked this conversation as resolved.
Show resolved Hide resolved

// tests for other barriers
for (int i = 1; i < group_barrier_variants; ++i) {
auto& barrier = group_barriers_acc[i];

if (std::get<s::support>(barrier)) {
local_acc[llid] = 0;
global_acc[llid] = 0;
local_acc[llid] = llid;
global_acc[llid] = llid;
sycl::group_barrier(group);

if (local_acc[max_id - llid] != max_id - llid ||
global_acc[max_id - llid] != max_id - llid)
std::get<s::test>(barrier) = false;
sycl::group_barrier(group);

switch (std::get<s::scope>(barrier)) {
Expand All @@ -172,6 +182,7 @@ TEMPLATE_TEST_CASE_SIG("Group barriers", "[group_func][dim]", ((int D), D), 1,

if (local_acc[max_id - llid] != 1)
std::get<s::test>(barrier) = false;
sycl::group_barrier(group);

[[fallthrough]];
default:
Expand All @@ -180,6 +191,7 @@ TEMPLATE_TEST_CASE_SIG("Group barriers", "[group_func][dim]", ((int D), D), 1,

if (global_acc[max_id - llid] != 1)
std::get<s::test>(barrier) = false;
sycl::group_barrier(group);
}
}
}
Expand All @@ -197,24 +209,33 @@ TEMPLATE_TEST_CASE_SIG("Group barriers", "[group_func][dim]", ((int D), D), 1,
"memory_scope fence_scope) is wrong\n");

// test of default barrier
local_acc[llid] = 0;
local_acc[llid] = llid;
sycl::group_barrier(sub_group);

if (local_acc[max_id - llid] != max_id - llid)
std::get<s::test>(sub_group_barriers_acc[0]) = false;
sycl::group_barrier(sub_group);

local_acc[llid] = 1;
sycl::group_barrier(sub_group);

if (local_acc[max_id - llid] != 1)
std::get<s::test>(sub_group_barriers_acc[0]) = false;
sycl::group_barrier(sub_group);

// tests for other barriers
for (int i = 1; i < sub_group_barrier_variants; ++i) {
auto& barrier = sub_group_barriers_acc[i];

if ((sub_group.get_group_linear_id() == 0) &&
std::get<s::support>(barrier)) {
local_acc[llid] = 0;
global_acc[llid] = 0;
local_acc[llid] = llid;
global_acc[llid] = llid;
sycl::group_barrier(sub_group);

if (local_acc[max_id - llid] != max_id - llid ||
global_acc[max_id - llid] != max_id - llid)
std::get<s::test>(barrier) = false;
sycl::group_barrier(sub_group);

switch (std::get<s::scope>(barrier)) {
Expand All @@ -225,6 +246,7 @@ TEMPLATE_TEST_CASE_SIG("Group barriers", "[group_func][dim]", ((int D), D), 1,

if (local_acc[max_id - llid] != 1)
std::get<s::test>(barrier) = false;
sycl::group_barrier(sub_group);

[[fallthrough]];
default:
Expand All @@ -233,6 +255,7 @@ TEMPLATE_TEST_CASE_SIG("Group barriers", "[group_func][dim]", ((int D), D), 1,

if (global_acc[max_id - llid] != 1)
std::get<s::test>(barrier) = false;
sycl::group_barrier(sub_group);
}
}
}
Expand Down