-
Notifications
You must be signed in to change notification settings - Fork 794
[SYCL] Allocate SubmissionInfo completely on stack #18314
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
Changes from all commits
3394a1d
2ccf7e8
9d553e0
0af903f
2010156
c85c9df
5633d3e
294b9b1
62995ce
3ff069a
496105f
b5fd0b5
c174746
46c7b28
910d142
ac58752
aa238c5
c3afb5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,6 +77,7 @@ inline event submitAssertCapture(queue &, event &, queue *, | |
| // event &Event - event after which post processing should be executed | ||
| using SubmitPostProcessF = std::function<void(bool, bool, event &)>; | ||
|
|
||
| #ifndef __INTEL_PREVIEW_BREAKING_CHANGES | ||
| struct SubmissionInfoImpl; | ||
|
|
||
| class __SYCL_EXPORT SubmissionInfo { | ||
|
|
@@ -95,6 +96,60 @@ class __SYCL_EXPORT SubmissionInfo { | |
| private: | ||
| std::shared_ptr<SubmissionInfoImpl> impl = nullptr; | ||
| }; | ||
| #endif | ||
|
|
||
| namespace v1 { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This way one particular data structure claims entire |
||
|
|
||
| // This class is a part of the ABI, so it's moved to a separate namespace to | ||
| // simplify changes. | ||
| // To perform non-ABI breaking changes: | ||
| // * namespace v(N+1) can be added, | ||
| // * functions that use SubmissionInfo and are NOT part of the ABI should be | ||
| // switched to use v(N+1) namespace, | ||
| // * functions that use SubmissionInfo and are part of the ABI should be | ||
| // overloaded with a new variant using v(N+1) namespace, | ||
| // * old namespace vN should be moved under #ifndef | ||
| // __INTEL_PREVIEW_BREAKING_CHANGES guard. | ||
| // TODO: inline namespace can be employed here after SubmissionInfo removed from | ||
| // the enclosing scope. | ||
|
|
||
| class __SYCL_EXPORT SubmissionInfo { | ||
| public: | ||
| SubmissionInfo() {} | ||
|
|
||
| #ifndef __INTEL_PREVIEW_BREAKING_CHANGES | ||
| SubmissionInfo(const detail::SubmissionInfo &SI) | ||
| : MPostProcessorFunc(SI.PostProcessorFunc()), | ||
| MSecondaryQueue(SI.SecondaryQueue()), MEventMode(SI.EventMode()) {} | ||
| #endif | ||
|
|
||
| sycl::detail::optional<SubmitPostProcessF> &PostProcessorFunc() { | ||
| return MPostProcessorFunc; | ||
| } | ||
| const sycl::detail::optional<SubmitPostProcessF> &PostProcessorFunc() const { | ||
| return MPostProcessorFunc; | ||
| } | ||
|
|
||
| std::shared_ptr<detail::queue_impl> &SecondaryQueue() { | ||
| return MSecondaryQueue; | ||
| } | ||
| const std::shared_ptr<detail::queue_impl> &SecondaryQueue() const { | ||
| return MSecondaryQueue; | ||
| } | ||
|
|
||
| ext::oneapi::experimental::event_mode_enum &EventMode() { return MEventMode; } | ||
| const ext::oneapi::experimental::event_mode_enum &EventMode() const { | ||
| return MEventMode; | ||
| } | ||
|
|
||
| private: | ||
| optional<detail::SubmitPostProcessF> MPostProcessorFunc = std::nullopt; | ||
| std::shared_ptr<detail::queue_impl> MSecondaryQueue = nullptr; | ||
| ext::oneapi::experimental::event_mode_enum MEventMode = | ||
| ext::oneapi::experimental::event_mode_enum::none; | ||
| }; | ||
|
|
||
| } // namespace v1 | ||
| } // namespace detail | ||
|
|
||
| namespace ext ::oneapi ::experimental { | ||
|
|
@@ -3534,7 +3589,8 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> { | |
| const sycl::detail::code_location &CodeLoc); | ||
|
|
||
| template <typename PropertiesT> | ||
| void ProcessSubmitProperties(PropertiesT Props, detail::SubmissionInfo &SI) { | ||
| void ProcessSubmitProperties(PropertiesT Props, | ||
| detail::v1::SubmissionInfo &SI) { | ||
| if constexpr (Props.template has_property< | ||
| ext::oneapi::experimental::event_mode_key>()) { | ||
| ext::oneapi::experimental::event_mode EventModeProp = | ||
|
|
@@ -3589,17 +3645,25 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> { | |
| const detail::SubmissionInfo &SubmitInfo, | ||
| const detail::code_location &CodeLoc, | ||
| bool IsTopCodeLoc); | ||
| event submit_with_event_impl(const detail::type_erased_cgfo_ty &CGH, | ||
| const detail::SubmissionInfo &SubmitInfo, | ||
| const detail::code_location &CodeLoc, | ||
| bool IsTopCodeLoc); | ||
| void submit_without_event_impl(const detail::type_erased_cgfo_ty &CGH, | ||
| const detail::SubmissionInfo &SubmitInfo, | ||
| const detail::code_location &CodeLoc, | ||
| bool IsTopCodeLoc); | ||
| #endif // __INTEL_PREVIEW_BREAKING_CHANGES | ||
|
|
||
| /// A template-free versions of submit. | ||
| event submit_with_event_impl(const detail::type_erased_cgfo_ty &CGH, | ||
| const detail::SubmissionInfo &SubmitInfo, | ||
| const detail::v1::SubmissionInfo &SubmitInfo, | ||
| const detail::code_location &CodeLoc, | ||
| bool IsTopCodeLoc); | ||
|
|
||
| /// A template-free version of submit_without_event. | ||
| void submit_without_event_impl(const detail::type_erased_cgfo_ty &CGH, | ||
| const detail::SubmissionInfo &SubmitInfo, | ||
| const detail::v1::SubmissionInfo &SubmitInfo, | ||
| const detail::code_location &CodeLoc, | ||
| bool IsTopCodeLoc); | ||
|
|
||
|
|
@@ -3621,7 +3685,7 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> { | |
| queue *SecondaryQueuePtr, | ||
| const detail::code_location &CodeLoc = detail::code_location::current()) { | ||
| detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); | ||
| detail::SubmissionInfo SI{}; | ||
| detail::v1::SubmissionInfo SI{}; | ||
| ProcessSubmitProperties(Props, SI); | ||
| if (SecondaryQueuePtr) | ||
| SI.SecondaryQueue() = detail::getSyclObjImpl(*SecondaryQueuePtr); | ||
|
|
@@ -3659,7 +3723,7 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> { | |
| PropertiesT Props, const detail::type_erased_cgfo_ty &CGF, | ||
| const detail::code_location &CodeLoc = detail::code_location::current()) { | ||
| detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); | ||
| detail::SubmissionInfo SI{}; | ||
| detail::v1::SubmissionInfo SI{}; | ||
| ProcessSubmitProperties(Props, SI); | ||
| if constexpr (UseFallbackAssert) | ||
| SI.PostProcessorFunc() = [this, &TlsCodeLocCapture](bool IsKernel, | ||
|
|
@@ -3698,7 +3762,7 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> { | |
| submit_with_event<UseFallbackAssert>(Props, CGF, CodeLoc); | ||
| } else { | ||
| detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); | ||
| detail::SubmissionInfo SI{}; | ||
| detail::v1::SubmissionInfo SI{}; | ||
| ProcessSubmitProperties(Props, SI); | ||
| submit_without_event_impl(CGF, SI, TlsCodeLocCapture.query(), | ||
| TlsCodeLocCapture.isToplevel()); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.