- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As described in title, if you create buffer, get "write" access, fill memory via the accessor on host side, and then try to get read accessor on host side too, then you will be blocked forever. Looks like, that host side wait realizing some mutex lock, but I suspect, that the mutex should be released also on host side, so deadlock.
I know, that you can use buffer constructor, which receive host memory ptr (which can have needed data, which initialise before buffer construction), but if I am not mistaken, SYCL don't disallow to working with buffer via accessor on host side. And API also allow it, otherwise I couldn't write the code via existed SYCL API.
Minimal reproduce example is attached. File with building instruction, full backtrace and system description is attached too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Nikita,
Moving towards your question, there is no such restriction on working with the buffer via host accessors. You can do that according to your scenario. But there are some important things which you have to follow while using the host accessor which will help you to resolve your problem.
Creating accessor of the access target host_buffer is a blocking operation that defines a requirement on the host and blocks the caller until the requirement is satisfied. So we need to call its destructor in order to stop the blocking operation.
You can put those accessor and there related processes in the scope so that it will automatically call its destructor and will execute the remaining operations without blocking. Below code snippet will help you.
{ //start of scope
auto buf_w = buf2.get_access<access::mode::write>();
for (size_t i = 0; i < ARRAY_SIZE; i++)
<operations>
} //end of scope
I have also attached the modified code with necessary changes you also refer them.
Warm Regards,
Abhishek
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Nikita,
Moving towards your question, there is no such restriction on working with the buffer via host accessors. You can do that according to your scenario. But there are some important things which you have to follow while using the host accessor which will help you to resolve your problem.
Creating accessor of the access target host_buffer is a blocking operation that defines a requirement on the host and blocks the caller until the requirement is satisfied. So we need to call its destructor in order to stop the blocking operation.
You can put those accessor and there related processes in the scope so that it will automatically call its destructor and will execute the remaining operations without blocking. Below code snippet will help you.
{ //start of scope
auto buf_w = buf2.get_access<access::mode::write>();
for (size_t i = 0; i < ARRAY_SIZE; i++)
<operations>
} //end of scope
I have also attached the modified code with necessary changes you also refer them.
Warm Regards,
Abhishek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Nikita,
Happy to know that the provided solution helped you. Please confirm if we can close this thread.
You can always post a new thread if you face any issue.
Warm Regards,
Abhishek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the confirmation we are closing this thread.
Please post a new thread if you have further issues.
Warm Regards,
Abhishek
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page