- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
While working using sycl I found something weird.
I started by using an unordered_set in my for_parallel() and everything worked perfectly, however I ended up having to ordered my set, so I thought that I would have just to replace all my 'unordered_set' by 'set' but it resulted in a way too hard to understand by me error (cf error.txt).
After fooling around to understand a bit more the problem, I found out that It is impossible (at least for me) to manipulate set in a for_parallel() (ex iteration in a foreach or pass it as a parameter in a function) and I couldn't find anywhere on the internet someone having the same problem as me. The answer might be written in a documentation but I didn't find anything.
The test code I wrote : test_set.cpp, test_unordered_set.cpp. The only difference in those two is that set is replaced by ordered_set.(I had to comment to be able to attach them)
So I only wanted to know why it is possible to use unordered_set in for_parallel() but not a set.
Thank you for your answer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for posting in Intel Communities.
According to SYCL specifications(https://www.khronos.org/registry/SYCL/specs/sycl-1.2.1.pdf)[page no-257], recursion is not allowed in a SYCL kernel or any code called from the kernel.
"set" internally uses a BST(Binary Search Tree) whereas "unordered_set" internally uses a hash table.
Since BST uses recursive calls for traversals, we are getting an error: "SYCL kernel cannot call a recursive function".
As SYCL doesn't allow us to use recursive calls inside a SYCL kernel, we can't use sets inside a SYCL kernel.
Thanks & Regards,
Santosh
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for posting in Intel Communities.
According to SYCL specifications(https://www.khronos.org/registry/SYCL/specs/sycl-1.2.1.pdf)[page no-257], recursion is not allowed in a SYCL kernel or any code called from the kernel.
"set" internally uses a BST(Binary Search Tree) whereas "unordered_set" internally uses a hash table.
Since BST uses recursive calls for traversals, we are getting an error: "SYCL kernel cannot call a recursive function".
As SYCL doesn't allow us to use recursive calls inside a SYCL kernel, we can't use sets inside a SYCL kernel.
Thanks & Regards,
Santosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for accepting our solution. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.
Thanks & Regards,
Santosh
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page