Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/build-hw-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ permissions:
contents: read

env:
UR_LOG_CUDA: "level:error;flush:error"
UR_LOG_CUDA: "level:debug;flush:debug"
UR_LOG_HIP: "level:error;flush:error"
UR_LOG_LEVEL_ZERO: "level:error;flush:error"
UR_LOG_NATIVE_CPU: "level:error;flush:error"
UR_LOG_OPENCL: "level:error;flush:error"
UR_LOG_LEVEL_ZERO: "level:debug;flush:debug"
UMF_LOG: "level:debug;flush:debug;output:stdout"

jobs:
adapter-build-hw:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/multi_device.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ concurrency:
permissions:
contents: read

env:
UR_LOG_LEVEL_ZERO: "level:debug;flush:debug"
UMF_LOG: "level:debug;flush:debug;output:stdout"

jobs:
examples:
name: Multi Device testing
Expand Down
16 changes: 14 additions & 2 deletions source/adapters/cuda/usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,20 @@ ur_usm_pool_handle_t_::ur_usm_pool_handle_t_(ur_context_handle_t Context,
const ur_usm_pool_limits_desc_t *Limits =
reinterpret_cast<const ur_usm_pool_limits_desc_t *>(BaseDesc);
for (auto &config : DisjointPoolConfigs.Configs) {
config.MaxPoolableSize = Limits->maxPoolableSize;
config.SlabMinSize = Limits->minDriverAllocSize;
umf_result_t umf_ret = umfDisjointPoolParamsSetMaxPoolableSize(
config, Limits->maxPoolableSize);
if (umf_ret != UMF_RESULT_SUCCESS) {
logger::error("urUSMPoolHandle: setting maxPoolableSize in "
"DisjointPool params failed");
throw umf::umf2urResult(umf_ret);
}
umf_ret = umfDisjointPoolParamsSetSlabMinSize(
config, Limits->minDriverAllocSize);
if (umf_ret != UMF_RESULT_SUCCESS) {
logger::error("urUSMPoolHandle: setting slabMinSize in DisjointPool "
"params failed");
throw umf::umf2urResult(umf_ret);
}
}
break;
}
Expand Down
16 changes: 14 additions & 2 deletions source/adapters/hip/usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,20 @@ ur_usm_pool_handle_t_::ur_usm_pool_handle_t_(ur_context_handle_t Context,
if (PoolDesc) {
if (auto *Limits = find_stype_node<ur_usm_pool_limits_desc_t>(PoolDesc)) {
for (auto &config : DisjointPoolConfigs.Configs) {
config.MaxPoolableSize = Limits->maxPoolableSize;
config.SlabMinSize = Limits->minDriverAllocSize;
umf_result_t umf_ret = umfDisjointPoolParamsSetMaxPoolableSize(
config, Limits->maxPoolableSize);
if (umf_ret != UMF_RESULT_SUCCESS) {
logger::error("urUSMPoolHandle: setting maxPoolableSize in "
"DisjointPool params failed");
throw umf::umf2urResult(umf_ret);
}
umf_ret = umfDisjointPoolParamsSetSlabMinSize(
config, Limits->minDriverAllocSize);
if (umf_ret != UMF_RESULT_SUCCESS) {
logger::error("urUSMPoolHandle: setting slabMinSize in DisjointPool "
"params failed");
throw umf::umf2urResult(umf_ret);
}
}
} else {
throw UsmAllocationException(UR_RESULT_ERROR_INVALID_ARGUMENT);
Expand Down
14 changes: 12 additions & 2 deletions source/adapters/level_zero/usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1034,8 +1034,18 @@ ur_usm_pool_handle_t_::ur_usm_pool_handle_t_(ur_context_handle_t Context,
const ur_usm_pool_limits_desc_t *Limits =
reinterpret_cast<const ur_usm_pool_limits_desc_t *>(BaseDesc);
for (auto &config : DisjointPoolConfigs.Configs) {
config.MaxPoolableSize = Limits->maxPoolableSize;
config.SlabMinSize = Limits->minDriverAllocSize;
if (umfDisjointPoolParamsSetMaxPoolableSize(
config, Limits->maxPoolableSize) != UMF_RESULT_SUCCESS) {
logger::error("urUSMPoolCreate: setting maxPoolableSize in "
"DisjointPool params failed");
throw UsmAllocationException(UR_RESULT_ERROR_UNKNOWN);
}
if (umfDisjointPoolParamsSetSlabMinSize(
config, Limits->minDriverAllocSize) != UMF_RESULT_SUCCESS) {
logger::error("urUSMPoolCreate: setting slabMinSize in DisjointPool "
"params failed");
throw UsmAllocationException(UR_RESULT_ERROR_UNKNOWN);
}
}
break;
}
Expand Down
59 changes: 47 additions & 12 deletions source/adapters/level_zero/v2/usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,31 +82,54 @@ descToDisjoinPoolMemType(const usm::pool_descriptor &desc) {
}

static umf::pool_unique_handle_t
makePool(umf_disjoint_pool_params_t *poolParams,
makePool(umf_disjoint_pool_params_handle_t *poolParams,
usm::pool_descriptor poolDescriptor) {
level_zero_memory_provider_params_t params = {};
params.level_zero_context_handle = poolDescriptor.hContext->getZeHandle();
params.level_zero_device_handle =
umf_level_zero_memory_provider_params_handle_t params = NULL;
umf_result_t umf_ret = umfLevelZeroMemoryProviderParamsCreate(&params);
if (umf_ret != UMF_RESULT_SUCCESS) {
throw umf::umf2urResult(umf_ret);
}

umf_ret = umfLevelZeroMemoryProviderParamsSetContext(
params, poolDescriptor.hContext->getZeHandle());
if (umf_ret != UMF_RESULT_SUCCESS) {
throw umf::umf2urResult(umf_ret);
}

ze_device_handle_t level_zero_device_handle =
poolDescriptor.hDevice ? poolDescriptor.hDevice->ZeDevice : nullptr;
params.memory_type = urToUmfMemoryType(poolDescriptor.type);
umf_ret = umfLevelZeroMemoryProviderParamsSetDevice(params,
level_zero_device_handle);
if (umf_ret != UMF_RESULT_SUCCESS) {
throw umf::umf2urResult(umf_ret);
}

umf_ret = umfLevelZeroMemoryProviderParamsSetMemoryType(
params, urToUmfMemoryType(poolDescriptor.type));
if (umf_ret != UMF_RESULT_SUCCESS) {
throw umf::umf2urResult(umf_ret);
}

std::vector<ze_device_handle_t> residentZeHandles;

if (poolDescriptor.type == UR_USM_TYPE_DEVICE) {
assert(params.level_zero_device_handle);
assert(level_zero_device_handle);
auto residentHandles =
poolDescriptor.hContext->getP2PDevices(poolDescriptor.hDevice);
residentZeHandles.push_back(params.level_zero_device_handle);
residentZeHandles.push_back(level_zero_device_handle);
for (auto &device : residentHandles) {
residentZeHandles.push_back(device->ZeDevice);
}

params.resident_device_handles = residentZeHandles.data();
params.resident_device_count = residentZeHandles.size();
umf_ret = umfLevelZeroMemoryProviderParamsSetResidentDevices(
params, residentZeHandles.data(), residentZeHandles.size());
if (umf_ret != UMF_RESULT_SUCCESS) {
throw umf::umf2urResult(umf_ret);
}
}

auto [ret, provider] =
umf::providerMakeUniqueFromOps(umfLevelZeroMemoryProviderOps(), &params);
umf::providerMakeUniqueFromOps(umfLevelZeroMemoryProviderOps(), params);
if (ret != UMF_RESULT_SUCCESS) {
throw umf::umf2urResult(ret);
}
Expand Down Expand Up @@ -134,8 +157,20 @@ ur_usm_pool_handle_t_::ur_usm_pool_handle_t_(ur_context_handle_t hContext,
auto disjointPoolConfigs = initializeDisjointPoolConfig();
if (auto limits = find_stype_node<ur_usm_pool_limits_desc_t>(pPoolDesc)) {
for (auto &config : disjointPoolConfigs.Configs) {
config.MaxPoolableSize = limits->maxPoolableSize;
config.SlabMinSize = limits->minDriverAllocSize;
umf_result_t umf_ret = umfDisjointPoolParamsSetMaxPoolableSize(
config, limits->maxPoolableSize);
if (umf_ret != UMF_RESULT_SUCCESS) {
logger::error("urUSMPoolHandle: setting maxPoolableSize in "
"DisjointPool params failed");
throw umf::umf2urResult(umf_ret);
}
umf_ret = umfDisjointPoolParamsSetSlabMinSize(config,
limits->minDriverAllocSize);
if (umf_ret != UMF_RESULT_SUCCESS) {
logger::error("urUSMPoolHandle: setting slabMinSize in DisjointPool "
"params failed");
throw umf::umf2urResult(umf_ret);
}
}
}

Expand Down
11 changes: 5 additions & 6 deletions source/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022-2023 Intel Corporation
# Copyright (C) 2022-2024 Intel Corporation
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
# See LICENSE.TXT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Expand Down Expand Up @@ -32,11 +32,10 @@ if (NOT DEFINED UMF_REPO)
endif()

if (NOT DEFINED UMF_TAG)
# special branch with cherry-picks for incoming pulldown
# contains UMF PRs: #866, #924, and #930
# branch was based on commit: 3bae087c9a8c0cbed5bde40f0d5a2
# umf-fixes-nov-pulldown: 25.11.2024: Disable libudev in hwloc builds
set(UMF_TAG a7b6152b7b095c88ddf34bc7d442eb4c2b3f74d6)
# v0.10.x: stable UMF branch for upcoming 0.11 UR release
# Date: Thu Dec 5 17:17:35 2024 +0100
# Merge pull request #960 from vinser52/svinogra_ipc_api
set(UMF_TAG 66b161a185b7c0babd63ce6605864d5614876677)
endif()

message(STATUS "Will fetch Unified Memory Framework from ${UMF_REPO}")
Expand Down
Loading
Loading