-
Notifications
You must be signed in to change notification settings - Fork 68
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
Clarify default context behavior #623
base: main
Are you sure you want to change the base?
Conversation
Potential rephrasing (which was a little simpler to read for me)
And move
We repeat the So IMO we can remove the Or is this a tradeoff between duplicating the information and convenience/clarity for reader of the spec? |
OK. How about this:
|
I like it! |
b3c1691
to
75188bb
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.
Thanks.
Clarify that the `queue` constructors that do not take a `context` parameter use the platform's default context. The WG decided to make this as a clarification to the SYCL 2020 specification because: * DPC++ has always behaved this way, and AdaptiveCpp mostly behaves this way now. * It would be difficult to enable this as an extension because it doesn't add any new API. Therefore, an application could end up relying on the "default context" behavior without the author of the application even being aware that the application is using extended behavior.
75188bb
to
9075baa
Compare
@@ -969,6 +969,9 @@ The [code]#platform# class also provides constructors, but constructing a new | |||
[code]#platform# instance merely creates a new object that is a copy of one of | |||
the objects returned by [api]#platform::get_platforms#. | |||
|
|||
Each platform has a single context object which is used as its default context. |
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.
@illuhad Can you confirm if a single object is OK? Intent should be compare equal.
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.
@gmlueck to update!
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 updated the wording in 2d63525.
Note that I also changed the wording to say that the default context has no async error handler. I presume that is our intent.
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 don't like the Each platform has a single context
. A platform has no context; a context has a platform, not the other way around.
I would prefer the term "is associated to".
Applications can retrieve a copy of this default
context
object, for example,
by constructing aqueue
.
Maybe something like "A copy of 'default context' will be used when a context is implicitly created (for example by a the queue constructor (1))." ?
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 don't like the
Each platform has a single context
. A platform has no context; a context has a platform, not the other way around.
The text you quote was removed in 2d63525. The new text is:
Each platform has a default context which contains all of the devices in the platform and has no associated asynchronous error handler.
Do you object to that text?
Maybe something like "A copy of 'default context' will be used when a context is implicitly created (for example by a the queue constructor (1))." ?
How about this:
Certain operations require the platform's default context to be created. For example, this happens for some of the
queue
constructors. When a platform's default context is created, it behaves as though it is a copy of a single internalcontext
object that is associated with each platform.
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.
Sorry, my bad.
Do you object to that text?
Yes, I don't like the has
. It sounds like an implementation leak to my ear. For me as
== member variable
It's not like each platform has a default context.
It's more that when a queue
is created, we will deduce a platform
(following the rule in the table). Then, from this platform, we instantiate a context.
This context is (copy?) an the instance of a singleton who have all the device of the platform.
So I will prefer is associated with
.
When a platform's default context is created, it behaves as though it is a copy of a single internal context object that is associated with each platform.
What about:
Certain operations require a context to the implicitly created. For example, this happens for some of the queue constructors. The
context
associated with this queue is a copy of thedefault context
associated with the platform of this queue.
Sorry for so much nitpicking... If I'm still not clear,I can accept your change, no problem. It's already better than before!
Reword to address comments from WG. I also noticed that we never state anything about the async error handler of the default context object. I'm pretty sure our intent is that the default `context` object has no async error handler, so I added words to this effect.
Note to reviewers: I made a slight change in 3a69290 to clarify that the default context contains only the platform's root devices. I think this is what we intended all along, but we should say that explicitly. |
Clarify that the
queue
constructors that do not take acontext
parameter use the platform's default context.The WG decided to make this as a clarification to the SYCL 2020 specification because:
DPC++ has always behaved this way, and AdaptiveCpp mostly behaves this way now.
It would be difficult to enable this as an extension because it doesn't add any new API. Therefore, an application could end up relying on the "default context" behavior without the author of the application even being aware that the application is using extended behavior.