-
Notifications
You must be signed in to change notification settings - Fork 798
[E2E][SYCL] Test for empty command group behavior #16166
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8d247bb
[E2E][SYCL] Test for empty command group behavior
aelovikov-intel a6e672a
Update sycl/test-e2e/Basic/empty_command.cpp
aelovikov-intel e10e6de
clang-format and usm include
aelovikov-intel f3add79
Simplify accessor/remove TODO
aelovikov-intel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| // RUN: %{build} -o %t.out %cxx_std_optionc++20 | ||
| // RUN: %{run} %t.out | ||
|
|
||
| #include <sycl/detail/core.hpp> | ||
|
|
||
| #include <latch> | ||
| #include <thread> | ||
|
|
||
| using namespace sycl; | ||
|
|
||
| void test_host_task_dep() { | ||
| queue q; | ||
|
|
||
| std::latch start_execution{1}; | ||
|
|
||
| int x = 0; | ||
|
|
||
| auto host_event = q.submit([&](handler &cgh) { | ||
| cgh.host_task([&]() { | ||
| start_execution.wait(); | ||
| x = 42; | ||
| }); | ||
| }); | ||
|
|
||
| auto empty_cg_event = | ||
| q.submit([&](handler &cgh) { cgh.depends_on(host_event); }); | ||
|
|
||
| // FIXME: This should deadlock, but the dependency is ignored currently. | ||
| empty_cg_event.wait(); | ||
|
|
||
| assert(x == 0); | ||
| start_execution.count_down(); | ||
|
|
||
| empty_cg_event.wait(); | ||
| // FIXME: uncomment once the bug mentioned above is fixed. | ||
| // assert(x == 42); | ||
|
|
||
| // I'm seeing some weird hang without this: | ||
| host_event.wait(); | ||
| } | ||
|
|
||
| void test_device_event_dep() { | ||
| queue q; | ||
|
|
||
| std::latch start_execution{1}; | ||
| auto *p = sycl::malloc_shared<int>(1, q); | ||
| *p = 0; | ||
|
|
||
| auto host_event = q.submit([&](handler &cgh) { | ||
| cgh.host_task([&]() { | ||
| start_execution.wait(); | ||
| }); | ||
| }); | ||
| auto device_event = q.single_task(host_event, [=]() { *p = 42; }); | ||
| auto empty_cg_event = | ||
| q.submit([&](handler &cgh) { cgh.depends_on(device_event); }); | ||
|
|
||
| // FIXME: This should deadlock, but the dependency is ignored currently. | ||
| empty_cg_event.wait(); | ||
|
|
||
| assert(*p == 0); | ||
| start_execution.count_down(); | ||
|
|
||
| empty_cg_event.wait(); | ||
| // FIXME: uncomment once the bug mentioned above is fixed. | ||
| // assert(*p == 42); | ||
|
|
||
| q.wait(); | ||
| sycl::free(p, q); | ||
| } | ||
|
|
||
| void test_accessor_dep() { | ||
| queue q; | ||
|
|
||
| std::latch start_execution{1}; | ||
| auto *p = sycl::malloc_shared<int>(1, q); | ||
| *p = 0; | ||
|
|
||
| auto host_event = q.submit([&](handler &cgh) { | ||
| cgh.host_task([&]() { | ||
| start_execution.wait(); | ||
| }); | ||
| }); | ||
|
|
||
| sycl::buffer<int, 1> b{1}; | ||
| auto device_event = q.submit([&](auto &cgh) { | ||
| cgh.depends_on(host_event); | ||
| sycl::accessor a{b, cgh}; | ||
|
|
||
| cgh.single_task([=]() { | ||
| *p = 42; | ||
| a[0] = 42; | ||
| }); | ||
| }); | ||
| auto empty_cg_event = q.submit([&](handler &cgh) { | ||
| sycl::accessor a{b}; | ||
| // TODO: Clarify with spec people that it should create a dependency indeed. | ||
| cgh.require(a); | ||
| }); | ||
|
|
||
| // FIXME: This should deadlock, but the dependency is ignored currently. | ||
| empty_cg_event.wait(); | ||
|
|
||
| assert(*p == 0); | ||
| start_execution.count_down(); | ||
|
|
||
| empty_cg_event.wait(); | ||
| // FIXME: uncomment once the bug mentioned above is fixed. | ||
| // assert(*p == 42); | ||
maarquitos14 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| q.wait(); | ||
| sycl::free(p, q); | ||
| } | ||
|
|
||
| int main() { | ||
| test_host_task_dep(); | ||
| test_device_event_dep(); | ||
| test_accessor_dep(); | ||
| return 0; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.