Skip to content

[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
merged 3 commits into from
Feb 7, 2021

Conversation

smaslov-intel
Copy link
Contributor

It also improves error handling by not silently ignoring errors occurring in internally made PI calls.
Signed-off-by: Sergey V Maslov [email protected]

…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 smaslov-intel requested a review from rbegam February 5, 2021 03:07
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)

Copy link
Contributor Author

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.

Signed-off-by: Sergey V Maslov <[email protected]>
v-klochkov
v-klochkov previously approved these changes Feb 5, 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
Copy link
Contributor

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 v-klochkov merged commit 9bf0e20 into intel:sycl Feb 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants