-
Notifications
You must be signed in to change notification settings - Fork 116
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
[SPEC] Clarify the behaviour of UR warning messages #1055
Closed
fabiomestre
wants to merge
3
commits into
oneapi-src:main
from
fabiomestre:fabio/clarify_ur_warnings
Closed
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -73,12 +73,19 @@ params: | |||||||||||||||||||||||||||
[in] Adapter handle to retain | ||||||||||||||||||||||||||||
--- #-------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
type: function | ||||||||||||||||||||||||||||
desc: "Get the last adapter specific error." | ||||||||||||||||||||||||||||
desc: "Get the last adapter specific warning or error." | ||||||||||||||||||||||||||||
details: | | ||||||||||||||||||||||||||||
To be used after another entry-point has returned | ||||||||||||||||||||||||||||
$X_RESULT_ERROR_ADAPTER_SPECIFIC in order to retrieve a message describing | ||||||||||||||||||||||||||||
the circumstances of the underlying driver error and the error code | ||||||||||||||||||||||||||||
returned by the failed driver entry-point. | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
* If `pError` is $X_RESULT_SUCCESS, $X_RESULT_ERROR_ADAPTER_SPECIFIC | ||||||||||||||||||||||||||||
represents a warning instead. This means that the entry-point call did not | ||||||||||||||||||||||||||||
fail. However it might not have behaved as expected. | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
* Using $X_RESULT_ERROR_ADAPTER_SPECIFIC to emit warnings is an optional | ||||||||||||||||||||||||||||
feature. Its usage is left at the discretion of adapter maintainers. | ||||||||||||||||||||||||||||
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. Indenting the bullet points makes them stand out more to the eye, also matches the surrounding style.
Suggested change
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. Done 👍 |
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
* Implementations *must* store the message and error code in thread-local | ||||||||||||||||||||||||||||
storage prior to returning $X_RESULT_ERROR_ADAPTER_SPECIFIC. | ||||||||||||||||||||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Although I understand it, I wonder if any adapter would add support to return a warning with SUCESS through
urAdapterGetLastError
. Returning a message throughurAdapterGetLastError
has an overhead (strncpy a mesage, keep track of the last message, etc).this of course could be optional, but I'm concerned this would open the door for UR customers to start requesting warnings, given that the spec allows it, and then having pushback from underlying drivers or adapters that dont want to implement such warning because of performance considerations.
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.
For context, this spec change is a follow up to the discussion that happened in #989
At the moment, the UR spec says that UR_RESULT_ERROR_ADAPTER_SPECIFIC can be used to return a warning or error but doesn't specify how. The aim to this PR was to clarify what is the correct way to do it.
There are already adapters using UR_RESULT_ERROR_ADAPTER_SPECIFIC in this way. For example CUDA is doing it for a few entrypoints. In addition, this is the behaviour that SYCL-RT expects.
I understand that there are performance / design implications to returning a warning. The intent was for it to be an optional feature.
I guess that we have to decide whether we want to support warnings on UR or not. If the answer is yes, then that should be documented in the spec (which this PR aims to do). If the answer is no, then we need to update the spec, SYCL-RT and all the adapters that are using UR_RESULT_ERROR_ADAPTER_SPECIFIC in this way.
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 an interface layer between higher level languages and lower level drivers I don't think UR should stand in the way of either users requesting more information about why a feature they want to use isn't working or adapters informing users why performance is suboptimal.
As @fabiomestre says, the spec already supports this but does so in an unclear way. If you are concearned about the performance implecations in an adatper @jandres742 then perhaps we should think about ways of opting in to their use rather than being on by default, perahps with an environment variable.
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 @kbenzie , @fabiomestre . I wouldn't even want this to be with env var, as that implies having branches on several places, even on critical paths.
Dont know if we need to clarify on this PR or in the spec that the warnings are optional, but if that's the intention, then I'm ok with this.
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 think its reasonable to have spec language stating that emitting warnings is optional at the discretion of the adapter maintainers. @fabiomestre if you could update the spec language to clarify 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.
Added a bullet point to clarify that the warnings are optional in the latest commit.