Skip to content

Commit

Permalink
[SYCL][UR][L0] Add failure logs for UMF pools
Browse files Browse the repository at this point in the history
  • Loading branch information
kswiecicki committed Nov 22, 2023
1 parent 3fc93d5 commit 71cac2c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
21 changes: 15 additions & 6 deletions source/adapters/level_zero/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,19 +239,25 @@ ur_result_t ur_context_handle_t_::initialize() {
// Initialize pool managers.
std::tie(Ret, PoolManager) =
usm::pool_manager<usm::pool_descriptor>::create();
if (Ret)
if (Ret) {
urPrint("urContextCreate: unexpected internal error\n");
return Ret;
}

std::tie(Ret, ProxyPoolManager) =
usm::pool_manager<usm::pool_descriptor>::create();
if (Ret)
if (Ret) {
urPrint("urContextCreate: unexpected internal error\n");
return Ret;
}

std::vector<usm::pool_descriptor> Descs;
// Create pool descriptor for every device and subdevice.
std::tie(Ret, Descs) = usm::pool_descriptor::create(nullptr, Context);
if (Ret)
if (Ret) {
urPrint("urContextCreate: unexpected internal error\n");
return Ret;
}

auto descTypeToDisjointPoolType =
[](usm::pool_descriptor &Desc) -> usm::DisjointPoolMemType {
Expand All @@ -264,7 +270,6 @@ ur_result_t ur_context_handle_t_::initialize() {
return (Desc.deviceReadOnly) ? usm::DisjointPoolMemType::SharedReadOnly
: usm::DisjointPoolMemType::Shared;
default:
assert(0 && "Invalid pool descriptor type!");
// Added to suppress 'not all control paths return a value' warning.
return usm::DisjointPoolMemType::All;
}
Expand All @@ -277,15 +282,19 @@ ur_result_t ur_context_handle_t_::initialize() {

std::tie(Ret, Pool) = createUMFPoolForDesc<usm::DisjointPool>(
Desc, DisjointPoolConfigInstance.Configs[PoolType]);
if (Ret)
if (Ret) {
urPrint("urContextCreate: unexpected internal error\n");
return Ret;
}

PoolManager.addPool(Desc, Pool);

umf::pool_unique_handle_t ProxyPool = nullptr;
std::tie(Ret, ProxyPool) = createUMFPoolForDesc<USMProxyPool>(Desc);
if (Ret)
if (Ret) {
urPrint("urContextCreate: unexpected internal error\n");
return Ret;
}

ProxyPoolManager.addPool(Desc, ProxyPool);
}
Expand Down
4 changes: 4 additions & 0 deletions source/adapters/level_zero/usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <climits>
#include <string.h>

#include "common.hpp"
#include "context.hpp"
#include "event.hpp"
#include "usm.hpp"
Expand Down Expand Up @@ -304,6 +305,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMHostAlloc(
if (!hPoolInternalOpt.has_value()) {
// Internal error, every L0 context and usm pool should have Host, Device,
// Shared and SharedReadOnly UMF pools.
urPrint("urUSMHostAlloc: unexpected internal error\n");
return UR_RESULT_ERROR_UNKNOWN;
}

Expand Down Expand Up @@ -386,6 +388,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMDeviceAlloc(
if (!hPoolInternalOpt.has_value()) {
// Internal error, every L0 context and usm pool should have Host, Device,
// Shared and SharedReadOnly UMF pools.
urPrint("urUSMDeviceAlloc: unexpected internal error\n");
return UR_RESULT_ERROR_UNKNOWN;
}

Expand Down Expand Up @@ -489,6 +492,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMSharedAlloc(
if (!hPoolInternalOpt.has_value()) {
// Internal error, every L0 context and usm pool should have Host, Device,
// Shared and SharedReadOnly UMF pools.
urPrint("urUSMSharedAlloc: unexpected internal error\n");
return UR_RESULT_ERROR_UNKNOWN;
}

Expand Down

0 comments on commit 71cac2c

Please sign in to comment.