Skip to content

Commit 0d47510

Browse files
authored
[PTI-LIB] Make PTI_API_GROUP_HYBRID_SYCL_LEVELZERO group report level-zero api name by default (#454)
[PTI-LIB] Make PTI_API_GROUP_HYBRID_SYCL_LEVELZERO group report level-zero api name by default --------- Signed-off-by: jfedorov <[email protected]>
1 parent d6b5633 commit 0d47510

File tree

2 files changed

+29
-22
lines changed

2 files changed

+29
-22
lines changed

sdk/src/pti_view.cc

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -320,27 +320,34 @@ pti_result ptiViewSetTimestampCallback(pti_fptr_get_timestamp fptr_timestampRequ
320320

321321
// Get api function name by api kind (LEVEL_ZERO_CALLS(default), OPENCL_CALLS, etc).
322322
pti_result ptiViewGetApiIdName(pti_api_group_id type, uint32_t unique_id, const char** name) {
323-
try {
324-
switch (type) {
325-
case pti_api_group_id::PTI_API_GROUP_SYCL: {
326-
*name = pti_api_id_runtime_sycl_func_name.at(unique_id);
327-
}; break;
328-
case pti_api_group_id::PTI_API_GROUP_LEVELZERO: {
329-
*name = pti_api_id_driver_levelzero_func_name.at(unique_id);
330-
}; break;
331-
case pti_api_group_id::PTI_API_GROUP_OPENCL: {
332-
return pti_result::PTI_ERROR_NOT_IMPLEMENTED;
333-
}; break;
334-
case pti_api_group_id::PTI_API_GROUP_HYBRID_SYCL_LEVELZERO:
335-
case pti_api_group_id::PTI_API_GROUP_HYBRID_SYCL_OPENCL:
336-
case pti_api_group_id::PTI_API_GROUP_RESERVED: {
337-
return pti_result::PTI_ERROR_BAD_ARGUMENT;
338-
}; break;
323+
pti_result result = pti_result::PTI_SUCCESS;
324+
if (name != nullptr) {
325+
try {
326+
switch (type) {
327+
case pti_api_group_id::PTI_API_GROUP_SYCL:
328+
*name = pti_api_id_runtime_sycl_func_name.at(unique_id);
329+
break;
330+
case pti_api_group_id::PTI_API_GROUP_HYBRID_SYCL_LEVELZERO:
331+
case pti_api_group_id::PTI_API_GROUP_LEVELZERO:
332+
*name = pti_api_id_driver_levelzero_func_name.at(unique_id);
333+
break;
334+
case pti_api_group_id::PTI_API_GROUP_OPENCL:
335+
result = pti_result::PTI_ERROR_NOT_IMPLEMENTED;
336+
break;
337+
case pti_api_group_id::PTI_API_GROUP_RESERVED:
338+
result = pti_result::PTI_ERROR_BAD_ARGUMENT;
339+
break;
340+
default:
341+
result = pti_result::PTI_ERROR_BAD_ARGUMENT;
342+
break;
343+
}
344+
} catch (const std::out_of_range&) {
345+
result = pti_result::PTI_ERROR_BAD_ARGUMENT;
339346
}
340-
} catch (const std::out_of_range&) {
341-
return pti_result::PTI_ERROR_BAD_ARGUMENT;
342-
};
343-
return PTI_SUCCESS;
347+
} else {
348+
result = pti_result::PTI_ERROR_BAD_ARGUMENT;
349+
}
350+
return result;
344351
}
345352

346353
// Enable/Disable driver specific API specified by api_id within the api_group_id.

sdk/test/main_zegemm_fixture.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,8 @@ class MainZeFixtureTest : public ::testing::TestWithParam<std::tuple<bool, bool,
629629
std::cout << "--- Sycl: " << rec->_api_id << "\n";
630630
const char* api_name = nullptr;
631631
if (rec->_api_group == pti_api_group_id::PTI_API_GROUP_HYBRID_SYCL_LEVELZERO) {
632-
pti_result status = ptiViewGetApiIdName(pti_api_group_id::PTI_API_GROUP_LEVELZERO,
633-
rec->_api_id, &api_name);
632+
pti_result status = ptiViewGetApiIdName(
633+
pti_api_group_id::PTI_API_GROUP_HYBRID_SYCL_LEVELZERO, rec->_api_id, &api_name);
634634
PTI_ASSERT(status == PTI_SUCCESS);
635635
std::string function_name(api_name);
636636
std::cout << "--- Record Special Sycl: " << rec->_correlation_id << ": "

0 commit comments

Comments
 (0)