-
Notifications
You must be signed in to change notification settings - Fork 6
Implement SYCL_KHR_WORK_ITEM_QUERIES #47
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
base: master
Are you sure you want to change the base?
Conversation
92330e9
to
9342b37
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure about the thread safety around the new g_
globals. We do keep a system lock around every submit
, but the remaining global state in schedule.cc are thread locals (although this was the case before the system lock was introduced). If the code is sound as-is, maybe having the new variables be thread-local is still a bit easier to reason about.
You mean as it relates to threading by the user program? In any case, I see no problem with making them thread local, so I'll do that. Since you're here (😛), in the new unit test introduced in this PR there's this. |
Switched to thread locals now. |
44599fa
to
81e0323
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you're right about the global range, [0]
being zero is not useful.
LGTM!
const auto global_id | ||
= range.get_offset() + (group_id * sycl::id<Dimensions>(local_range)) + local_id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a clang-format change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's how it is formatted for me right now. (I wouldn't write that on purpose ;))
This adds support for the SYCL_KHR_WORK_ITEM_QUERIES extension, as per KhronosGroup/SYCL-Docs#682.
Although SimSYCL is a library-only implementation, due to its single-threaded nature this can be implemented via thread locals that are set every time a kernel function context is scheduled in.
The actual implementation is a bit more convoluted than I'd like, but it does provide decent error messages / developer experience.