-
Notifications
You must be signed in to change notification settings - Fork 790
[SYCL][Level-Zero] Fixes to ZE_CALL tracing and introduction of internal PI_CALL tracing. #3163
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
Merged
Conversation
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
…or debugging purposes. It also improves error handling by not silently ignoring errors occuring in internally made PI calls. Signed-off-by: Sergey V Maslov <[email protected]>
smaslov-intel
commented
Feb 5, 2021
Comment on lines
+76
to
+115
// Map Level Zero runtime error code to PI error code | ||
static pi_result mapError(ze_result_t ZeResult) { | ||
// TODO: these mapping need to be clarified and synced with the PI API return | ||
// values, which is TBD. | ||
static std::unordered_map<ze_result_t, pi_result> ErrorMapping = { | ||
{ZE_RESULT_SUCCESS, PI_SUCCESS}, | ||
{ZE_RESULT_ERROR_DEVICE_LOST, PI_DEVICE_NOT_FOUND}, | ||
{ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS, PI_INVALID_OPERATION}, | ||
{ZE_RESULT_ERROR_NOT_AVAILABLE, PI_INVALID_OPERATION}, | ||
{ZE_RESULT_ERROR_UNINITIALIZED, PI_INVALID_PLATFORM}, | ||
{ZE_RESULT_ERROR_INVALID_ARGUMENT, PI_INVALID_VALUE}, | ||
{ZE_RESULT_ERROR_INVALID_NULL_POINTER, PI_INVALID_VALUE}, | ||
{ZE_RESULT_ERROR_INVALID_SIZE, PI_INVALID_VALUE}, | ||
{ZE_RESULT_ERROR_UNSUPPORTED_SIZE, PI_INVALID_VALUE}, | ||
{ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT, PI_INVALID_VALUE}, | ||
{ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT, PI_INVALID_EVENT}, | ||
{ZE_RESULT_ERROR_INVALID_ENUMERATION, PI_INVALID_VALUE}, | ||
{ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION, PI_INVALID_VALUE}, | ||
{ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT, PI_INVALID_VALUE}, | ||
{ZE_RESULT_ERROR_INVALID_NATIVE_BINARY, PI_INVALID_BINARY}, | ||
{ZE_RESULT_ERROR_INVALID_KERNEL_NAME, PI_INVALID_KERNEL_NAME}, | ||
{ZE_RESULT_ERROR_INVALID_FUNCTION_NAME, PI_BUILD_PROGRAM_FAILURE}, | ||
{ZE_RESULT_ERROR_OVERLAPPING_REGIONS, PI_INVALID_OPERATION}, | ||
{ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION, | ||
PI_INVALID_WORK_GROUP_SIZE}, | ||
{ZE_RESULT_ERROR_MODULE_BUILD_FAILURE, PI_BUILD_PROGRAM_FAILURE}}; | ||
|
||
auto It = ErrorMapping.find(ZeResult); | ||
if (It == ErrorMapping.end()) { | ||
return PI_ERROR_UNKNOWN; | ||
} | ||
return It->second; | ||
} | ||
|
||
// Trace a call to Level-Zero RT | ||
#define ZE_CALL(Call) \ | ||
if (auto Result = ZeCall().doCall(Call, #Call, true)) \ | ||
return mapError(Result); | ||
#define ZE_CALL_NOCHECK(Call) ZeCall().doCall(Call, #Call, false) | ||
|
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.
This is just moved intact from its current location.
v-klochkov
reviewed
Feb 5, 2021
v-klochkov
reviewed
Feb 5, 2021
Signed-off-by: Sergey V Maslov <[email protected]>
v-klochkov
reviewed
Feb 5, 2021
v-klochkov
previously approved these changes
Feb 5, 2021
bader
reviewed
Feb 6, 2021
@@ -239,12 +239,11 @@ struct _pi_context : _pi_object { | |||
|
|||
// Get index of the free slot in the available pool. If there is no avialble |
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.
Please, remove executable flag from the header file.
Signed-off-by: Sergey V Maslov <[email protected]>
v-klochkov
approved these changes
Feb 7, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
It also improves error handling by not silently ignoring errors occurring in internally made PI calls.
Signed-off-by: Sergey V Maslov [email protected]