-
Notifications
You must be signed in to change notification settings - Fork 790
Handler-less kernel submit API #19294
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: sycl
Are you sure you want to change the base?
Conversation
sycl/include/sycl/queue.hpp
Outdated
@@ -149,6 +149,37 @@ class __SYCL_EXPORT SubmissionInfo { | |||
ext::oneapi::experimental::event_mode_enum::none; | |||
}; | |||
|
|||
using KernelParamDescGetterFuncPtr = detail::kernel_param_desc_t (*)(int); | |||
|
|||
class __SYCL_EXPORT ExtendedSubmissionInfo : public SubmissionInfo { |
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.
While technically it might work, I am not sure that logically it should be part of the SubmissionInfo
. I would say it should be a separate class called KernelInfo
or something like that.
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.
Actually, I've considered both: KernelInfo or extended SubmissionInfo, and since we already have the KernelInfo type, I've combined all of it into the ExtendedSubmissionInfo, but I think your suggestion makes sense - these are more like attributes of the kernel and not the submission. I will change this to something similar to KernelInfo.
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.
Yeah, choosing the right name is the hardest task :)
@@ -3680,6 +3743,21 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> { | |||
const detail::code_location &CodeLoc, | |||
bool IsTopCodeLoc) const; | |||
|
|||
event submit_with_event_impl( |
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.
What about eventless? It is not done yet, right?
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, I think it would be similar, so I've skipped it for now.
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.
What is the disadvantage of returning optional<event>
and having somewhere (probably, in SubmissionInfo
, as this is mode of submission) a flag, pointing out is it event or eventless mode? I think about bunch of functions that pass arguments by chain and about duplicating them (for event and for eventless) and this is not looks good. What do you think?
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 am not sure if returning std::optional<event>
is a good idea because of ABI concerns. It might not have a stable ABI across compiler versions or even different standard libraries (libstdc++ vs libc++).
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 am not sure if returning
std::optional<event>
is a good idea because of ABI concerns. It might not have a stable ABI across compiler versions or even different standard libraries (libstdc++ vs libc++).
Yes, good point.
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.
Probably, sycl::detail::optional
might be considered.
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.
sycl::detail::optional might work, good idea
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.
But still we need to care about the stable layout of the sycl::detail::optional
. I am not sure that we are doing it today.
I think having two versions (that return sycl::event
and return void
) might be a good alternative.
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.
In this PR, I would like to see at least one public interface implementation that utilizes this approach, just to ensure it works.
sycl/include/sycl/queue.hpp
Outdated
|
||
// TODO UseFallbackAssert | ||
|
||
return submit_with_event_impl(Range, SI, TlsCodeLocCapture.query(), |
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.
This call library interface that performs submit without internal handler creation and calling user callback, right? How can it be named, to differentiate from generic submit()
? Probably _no_handler
from your POC is not the best name, as it describe what the function not do, not what it do.
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 was thinking about overloading the submit_with_event and submit_without_event private functions, and then calling them in the Enqueue Functions extension. We can also change the internal implementation of the queue shortcut functions. This way, we don't expose any new public functions in the queue.
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 had a similar concern about naming of "no_handler" path APIs. I don't think simply overloading functions from handler and no_handler path is a good idea as they follow completely different submission paths (and design philosophy) and have significant performance differences. Since the USP of no-handler path is an eager submission, how about we use eager
in the API name, like submit_eager_with_event
/submit_eager_eventless
(something like that)?
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.
as they follow completely different submission paths
But it is implementation details, right? If so, why should we expose implementation details in the API name?
In the latest update, there are two public interfaces: The enqueue functions extension, and queue.parallel_for. Both are enabled only if __DPCPP_ENABLE_UNFINISHED_NO_CGH_SUBMIT is defined. |
expose the new APIs as public under a new define
KernelRuntimeInfo() {} | ||
|
||
std::string_view &KernelName() { return MKernelName; } | ||
std::unique_ptr<detail::HostKernelBase> &HostKernel() { return MHostKernel; } |
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.
Should it be a raw pointer as a return type?
|
||
// This class is intended to store the kernel runtime information, | ||
// extracted from the compile time kernel structures. | ||
class __SYCL_EXPORT KernelRuntimeInfo { |
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.
please define copy/move ctor and assignment operator. I guess they can be declared as deleted, right?
No description provided.