-
Notifications
You must be signed in to change notification settings - Fork 787
[NFC][SYCL] Use plain context_impl *
for func params in scheduler
#19156
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
[NFC][SYCL] Use plain context_impl *
for func params in scheduler
#19156
Conversation
…hpp` Continuation of the refactoring in intel#18795 intel#18877 intel#18966 intel#18979 intel#18980 intel#18981 intel#19007 intel#19030 intel#19123 intel#19126
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.
Few nits, but overall looking good!
@@ -214,6 +213,10 @@ struct MemObjRecord { | |||
|
|||
// The context which has the latest state of the memory object. | |||
std::shared_ptr<context_impl> MCurContext; | |||
context_impl *getCurContext() { return MCurContext.get(); } | |||
void setCurContext(context_impl *Ctx) { | |||
MCurContext = Ctx ? Ctx->shared_from_this() : nullptr; |
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.
My understanding was that the shared_from_this
functionality could be used by the shared_ptr
ctor, so
MCurContext = Ctx ? Ctx->shared_from_this() : nullptr; | |
MCurContext = std::shared_ptr<context_impl>{Ctx}; |
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.
That only works during creation of the very first shared_ptr
that has been done in context_impl::create
/std::make_shared
, AFAIK. https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0033r1.html might be helpful reading on that subject as well.
@@ -214,6 +213,10 @@ struct MemObjRecord { | |||
|
|||
// The context which has the latest state of the memory object. | |||
std::shared_ptr<context_impl> MCurContext; | |||
context_impl *getCurContext() { return MCurContext.get(); } |
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.
Could there be a benefit to having a const overload?
context_impl *getCurContext() { return MCurContext.get(); } | |
context_impl *getCurContext() { return MCurContext.get(); } | |
const context_impl *getCurContext() const { return MCurContext.get(); } |
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.
const-correctness and the choices we have to make (technically, C++ will allow to return non-const from const method) are intentionally left for a future refactoring separate from this activity.
Continuation of the refactoring in
#18795
#18877
#18966
#18979
#18980
#18981
#19007
#19030
#19123
#19126