-
Notifications
You must be signed in to change notification settings - Fork 789
[SYCL][UR][L0] Implement urAdapterGetLastError #10784
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
Closed
Closed
Changes from all 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 hidden or 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 hidden or 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.
Is this how
urAdapterGetLastError
is defined to always return success?In a matching PI API we need to return error if SYCL RT needs to abort, or success if this is rather a warning. Is this happening?
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.
urAdapterGetLastError
doesnt return an error depending on the message. It may return an error if the call tourAdapterGetLastError
fails, but not because of the error it is interpreting.See here https://oneapi-src.github.io/unified-runtime/core/api.html?highlight=uradaptergetlasterror#uradaptergetlasterror
Another call may have returned
UR_RESULT_ERROR_ADAPTER_SPECIFIC
. Then application (in this case SYCL RT) would callurAdapterGetLastError
to get the description of the message for the call that previously failed (*Message
) and the error code (*Error
).This is the same implementation we have in other adapters, for instance CU:
llvm/sycl/plugins/unified_runtime/ur/adapters/cuda/adapter.cpp
Line 65 in d778e56
It is up to the application to parse this info and determining the level of severity.
@callumfare , @kbenzie : is my understanding correct?
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.
The original idea was that adapters that raise the error decide on the severity (not the SYCL RT), see here
llvm/sycl/include/sycl/detail/pi.h
Line 2222 in d778e56
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.
@smaslov-intel : so something like 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.
Perhaps just
return ErrorMessageCode
?Then I don't see why we need the
Error
argument.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.
The
Error
argument is intended for returning the adapter specific error code, in this case aze_result_t
.The
ur_result_t
returned fromurAdapterGetLastError
should beUR_RESULT_SUCCESS
if the error is non-fatal/warning, andUR_RESULT_ERROR_ADAPTER_SPECIFIC
if it is an unrecoverable/hard error.Currently
Error
isn't hooked up topiPluginGetLastError
because it doesn't have an equivelent argument. This should be resolved as part of the work to replace PI with UR in the SYCL RT.As for what to do with
ErrorMessageCode
, if depends how its being set when an adapter specific error occurs. If its being set to eitherUR_RESULT_SUCCESS
orUR_RESULT_ERROR_ADAPTER_SPECIFIC
it should be returned fromurAdapterGetLastError
. If it contains aze_result_t
then it should be used to set*Error
.Here's a recent change to the CUDA adapter that's addressing a similar issue https://github.com/intel/llvm/pull/10626/files#diff-1efcd510b7db74f7166a4a06ccd048867c04911e8809ef7c39b9821aa66583e5
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.
We discovered a while ago that the implementation of
piPluginGetLastError
in pi2ur was incorrect, and the cuda adapter was doing the wrong thing - it was fixed in #10626To match PI the return code is used to signify whether the result is treated as a warning (
UR_RESULT_SUCCESS
) or an error (any other return code).The purpose of the Error argument is to return native error codes (e.g. CUresult) from the adapter, but the cuda adapter doesn't implement this yet.