-
Notifications
You must be signed in to change notification settings - Fork 808
[SYCL] Fix possible failure when enqueing only a single host-task #1937
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
bader
merged 5 commits into
intel:sycl
from
s-kanaev:private/s-kanaev/fix-possible-deadlock
Jun 26, 2020
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
463336e
[SYCL] Fix possible failure when enqueing only a single host-task
b42ed15
Merge branch 'sycl' into private/s-kanaev/fix-possible-deadlock
5ea8b72
[SYCL] Remove unneeded includes
b551c2a
Update sycl/source/detail/scheduler/scheduler.cpp
s-kanaev b6f892d
[SYCL] Fix style issue
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
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,60 @@ | ||
| // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out | ||
| // RUN: %CPU_RUN_PLACEHOLDER %t.out | ||
| // RUN: %GPU_RUN_PLACEHOLDER %t.out | ||
| // RUN: %ACC_RUN_PLACEHOLDER %t.out | ||
|
|
||
| #include <CL/sycl.hpp> | ||
| #include <CL/sycl/backend/opencl.hpp> | ||
| #include <CL/sycl/detail/cl.h> | ||
s-kanaev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| using namespace cl::sycl; | ||
| using namespace cl::sycl::access; | ||
|
|
||
| static constexpr size_t BUFFER_SIZE = 1024; | ||
|
|
||
| template <typename T> | ||
| class Modifier; | ||
|
|
||
| template <typename T> | ||
| class Init; | ||
|
|
||
| template <typename DataT> | ||
| void copy(buffer<DataT, 1> &Src, buffer<DataT, 1> &Dst, queue &Q) { | ||
| Q.submit([&](handler &CGH) { | ||
| auto SrcA = Src.template get_access<mode::read>(CGH); | ||
| auto DstA = Dst.template get_access<mode::write>(CGH); | ||
|
|
||
| CGH.codeplay_host_task([=]() { | ||
| for (size_t Idx = 0; Idx < SrcA.get_count(); ++Idx) | ||
| DstA[Idx] = SrcA[Idx]; | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| template <typename DataT> | ||
| void init(buffer<DataT, 1> &B1, buffer<DataT, 1> &B2, queue &Q) { | ||
| Q.submit([&](handler &CGH) { | ||
| auto Acc1 = B1.template get_access<mode::write>(CGH); | ||
| auto Acc2 = B2.template get_access<mode::write>(CGH); | ||
|
|
||
| CGH.parallel_for<Init<DataT>>(BUFFER_SIZE, [=](item<1> Id) { | ||
| Acc1[Id] = -1; | ||
| Acc2[Id] = -2; | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| void test() { | ||
| queue Q; | ||
| buffer<int, 1> Buffer1{BUFFER_SIZE}; | ||
| buffer<int, 1> Buffer2{BUFFER_SIZE}; | ||
|
|
||
| init<int>(Buffer1, Buffer2, Q); | ||
|
|
||
| copy(Buffer1, Buffer2, Q); | ||
| } | ||
|
|
||
| int main() { | ||
| test(); | ||
| return 0; | ||
| } | ||
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.