diff --git a/.github/workflows/build-hw-reusable.yml b/.github/workflows/build-hw-reusable.yml index 3e332c73fc..06ecd03f49 100644 --- a/.github/workflows/build-hw-reusable.yml +++ b/.github/workflows/build-hw-reusable.yml @@ -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: diff --git a/.github/workflows/multi_device.yml b/.github/workflows/multi_device.yml index 48a804bdf8..226b043215 100644 --- a/.github/workflows/multi_device.yml +++ b/.github/workflows/multi_device.yml @@ -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 diff --git a/source/adapters/cuda/usm.cpp b/source/adapters/cuda/usm.cpp index 8a6ac41b08..44707cbeea 100644 --- a/source/adapters/cuda/usm.cpp +++ b/source/adapters/cuda/usm.cpp @@ -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(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; } diff --git a/source/adapters/hip/usm.cpp b/source/adapters/hip/usm.cpp index 5e28f3592d..3abd787424 100644 --- a/source/adapters/hip/usm.cpp +++ b/source/adapters/hip/usm.cpp @@ -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(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); diff --git a/source/adapters/level_zero/usm.cpp b/source/adapters/level_zero/usm.cpp index 28bdf233e8..47037a021c 100644 --- a/source/adapters/level_zero/usm.cpp +++ b/source/adapters/level_zero/usm.cpp @@ -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(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; } diff --git a/source/adapters/level_zero/v2/usm.cpp b/source/adapters/level_zero/v2/usm.cpp index f31a2b5202..ea3ba53112 100644 --- a/source/adapters/level_zero/v2/usm.cpp +++ b/source/adapters/level_zero/v2/usm.cpp @@ -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(¶ms); + 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 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(), ¶ms); + umf::providerMakeUniqueFromOps(umfLevelZeroMemoryProviderOps(), params); if (ret != UMF_RESULT_SUCCESS) { throw umf::umf2urResult(ret); } @@ -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(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); + } } } diff --git a/source/common/CMakeLists.txt b/source/common/CMakeLists.txt index e24d987567..08a26e5eb0 100644 --- a/source/common/CMakeLists.txt +++ b/source/common/CMakeLists.txt @@ -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 @@ -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}") diff --git a/source/common/umf_pools/disjoint_pool_config_parser.cpp b/source/common/umf_pools/disjoint_pool_config_parser.cpp index 0e82072ae2..ee4fd375c0 100644 --- a/source/common/umf_pools/disjoint_pool_config_parser.cpp +++ b/source/common/umf_pools/disjoint_pool_config_parser.cpp @@ -1,5 +1,7 @@ //===--- disjoint_pool_config_parser.cpp -configuration for USM memory pool-==// // +// Copyright (C) 2023-2024 Intel Corporation +// // Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -7,12 +9,24 @@ //===----------------------------------------------------------------------===// #include "disjoint_pool_config_parser.hpp" +#include "logger/ur_logger.hpp" +#include #include #include #include #include +// Don't expect any failures in setting params; the only 2 reasons for failure +// are not enough memory for allocating 'name' or a NULL params handle. +#define UMF_CALL(RET) \ + if (RET != UMF_RESULT_SUCCESS) { \ + if (RET == UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY) { \ + throw std::runtime_error("DisjointPool name allocation failed"); \ + } \ + throw std::runtime_error("DisjointPool setting params failed"); \ + } + namespace usm { constexpr auto operator""_B(unsigned long long x) -> size_t { return x; } constexpr auto operator""_KB(unsigned long long x) -> size_t { @@ -25,45 +39,82 @@ constexpr auto operator""_GB(unsigned long long x) -> size_t { return x * 1024 * 1024 * 1024; } -DisjointPoolAllConfigs::DisjointPoolAllConfigs(int trace) { +DisjointPoolAllConfigs::~DisjointPoolAllConfigs() { for (auto &Config : Configs) { - Config = umfDisjointPoolParamsDefault(); - Config.PoolTrace = trace; + umfDisjointPoolParamsDestroy(Config); } +} + +DisjointPoolAllConfigs::DisjointPoolAllConfigs(int trace) { + try { + for (auto &Config : Configs) { + umf_disjoint_pool_params_handle_t params = NULL; + if (umfDisjointPoolParamsCreate(¶ms) != UMF_RESULT_SUCCESS) { + logger::error("DisjointPool params create failed"); + assert(0); + } + UMF_CALL(umfDisjointPoolParamsSetTrace(params, trace)); + + Config = params; + } - Configs[DisjointPoolMemType::Host].Name = "Host"; - Configs[DisjointPoolMemType::Device].Name = "Device"; - Configs[DisjointPoolMemType::Shared].Name = "Shared"; - Configs[DisjointPoolMemType::SharedReadOnly].Name = "SharedReadOnly"; + UMF_CALL(umfDisjointPoolParamsSetName( + Configs[DisjointPoolMemType::Host], "Host")); + UMF_CALL(umfDisjointPoolParamsSetName( + Configs[DisjointPoolMemType::Device], "Device")); + UMF_CALL(umfDisjointPoolParamsSetName( + Configs[DisjointPoolMemType::Shared], "Shared")); + UMF_CALL(umfDisjointPoolParamsSetName( + Configs[DisjointPoolMemType::SharedReadOnly], "SharedReadOnly")); - // Buckets for Host use a minimum of the cache line size of 64 bytes. - // This prevents two separate allocations residing in the same cache line. - // Buckets for Device and Shared allocations will use starting size of 512. - // This is because memory compression on newer GPUs makes the - // minimum granularity 512 bytes instead of 64. - Configs[DisjointPoolMemType::Host].MinBucketSize = 64; - Configs[DisjointPoolMemType::Device].MinBucketSize = 512; - Configs[DisjointPoolMemType::Shared].MinBucketSize = 512; - Configs[DisjointPoolMemType::SharedReadOnly].MinBucketSize = 512; + // Buckets for Host use a minimum of the cache line size of 64 bytes. + // This prevents two separate allocations residing in the same cache line. + // Buckets for Device and Shared allocations will use starting size of 512. + // This is because memory compression on newer GPUs makes the + // minimum granularity 512 bytes instead of 64. + UMF_CALL(umfDisjointPoolParamsSetMinBucketSize( + Configs[DisjointPoolMemType::Host], 64)); + UMF_CALL(umfDisjointPoolParamsSetMinBucketSize( + Configs[DisjointPoolMemType::Device], 512)); + UMF_CALL(umfDisjointPoolParamsSetMinBucketSize( + Configs[DisjointPoolMemType::Shared], 512)); + UMF_CALL(umfDisjointPoolParamsSetMinBucketSize( + Configs[DisjointPoolMemType::SharedReadOnly], 512)); - // Initialize default pool settings. - Configs[DisjointPoolMemType::Host].MaxPoolableSize = 2_MB; - Configs[DisjointPoolMemType::Host].Capacity = 4; - Configs[DisjointPoolMemType::Host].SlabMinSize = 64_KB; + // Initialize default pool settings. + UMF_CALL(umfDisjointPoolParamsSetMaxPoolableSize( + Configs[DisjointPoolMemType::Host], 2_MB)); + UMF_CALL(umfDisjointPoolParamsSetCapacity( + Configs[DisjointPoolMemType::Host], 4)); + UMF_CALL(umfDisjointPoolParamsSetSlabMinSize( + Configs[DisjointPoolMemType::Host], 64_KB)); - Configs[DisjointPoolMemType::Device].MaxPoolableSize = 4_MB; - Configs[DisjointPoolMemType::Device].Capacity = 4; - Configs[DisjointPoolMemType::Device].SlabMinSize = 64_KB; + UMF_CALL(umfDisjointPoolParamsSetMaxPoolableSize( + Configs[DisjointPoolMemType::Device], 4_MB)); + UMF_CALL(umfDisjointPoolParamsSetCapacity( + Configs[DisjointPoolMemType::Device], 4)); + UMF_CALL(umfDisjointPoolParamsSetSlabMinSize( + Configs[DisjointPoolMemType::Device], 64_KB)); - // Disable pooling of shared USM allocations. - Configs[DisjointPoolMemType::Shared].MaxPoolableSize = 0; - Configs[DisjointPoolMemType::Shared].Capacity = 0; - Configs[DisjointPoolMemType::Shared].SlabMinSize = 2_MB; + // Disable pooling of shared USM allocations. + UMF_CALL(umfDisjointPoolParamsSetMaxPoolableSize( + Configs[DisjointPoolMemType::Shared], 0)); + UMF_CALL(umfDisjointPoolParamsSetCapacity( + Configs[DisjointPoolMemType::Shared], 0)); + UMF_CALL(umfDisjointPoolParamsSetSlabMinSize( + Configs[DisjointPoolMemType::Shared], 2_MB)); - // Allow pooling of shared allocations that are only modified on host. - Configs[DisjointPoolMemType::SharedReadOnly].MaxPoolableSize = 4_MB; - Configs[DisjointPoolMemType::SharedReadOnly].Capacity = 4; - Configs[DisjointPoolMemType::SharedReadOnly].SlabMinSize = 2_MB; + // Allow pooling of shared allocations that are only modified on host. + UMF_CALL(umfDisjointPoolParamsSetMaxPoolableSize( + Configs[DisjointPoolMemType::SharedReadOnly], 4_MB)); + UMF_CALL(umfDisjointPoolParamsSetCapacity( + Configs[DisjointPoolMemType::SharedReadOnly], 4)); + UMF_CALL(umfDisjointPoolParamsSetSlabMinSize( + Configs[DisjointPoolMemType::SharedReadOnly], 2_MB)); + } catch (const std::runtime_error &e) { + logger::error(e.what()); + assert(0); + } } DisjointPoolAllConfigs parseDisjointPoolConfig(const std::string &config, @@ -118,34 +169,45 @@ DisjointPoolAllConfigs parseDisjointPoolConfig(const std::string &config, DisjointPoolMemType memType = DisjointPoolMemType::All) { bool ParamWasSet; + size_t TmpValue = 0; DisjointPoolMemType LM = memType; if (memType == DisjointPoolMemType::All) { LM = DisjointPoolMemType::Host; } - bool More = ParamParser(Params, AllConfigs.Configs[LM].MaxPoolableSize, - ParamWasSet); + bool More = ParamParser(Params, TmpValue, ParamWasSet); if (ParamWasSet && memType == DisjointPoolMemType::All) { for (auto &Config : AllConfigs.Configs) { - Config.MaxPoolableSize = AllConfigs.Configs[LM].MaxPoolableSize; + UMF_CALL( + umfDisjointPoolParamsSetMaxPoolableSize(Config, TmpValue)); } + } else if (ParamWasSet) { + UMF_CALL(umfDisjointPoolParamsSetMaxPoolableSize( + AllConfigs.Configs[LM], TmpValue)); } + if (More) { - More = ParamParser(Params, AllConfigs.Configs[LM].Capacity, - ParamWasSet); + More = ParamParser(Params, TmpValue, ParamWasSet); if (ParamWasSet && memType == DisjointPoolMemType::All) { for (auto &Config : AllConfigs.Configs) { - Config.Capacity = AllConfigs.Configs[LM].Capacity; + UMF_CALL( + umfDisjointPoolParamsSetCapacity(Config, TmpValue)); } + } else if (ParamWasSet) { + UMF_CALL(umfDisjointPoolParamsSetCapacity( + AllConfigs.Configs[LM], TmpValue)); } } if (More) { - ParamParser(Params, AllConfigs.Configs[LM].SlabMinSize, - ParamWasSet); + ParamParser(Params, TmpValue, ParamWasSet); if (ParamWasSet && memType == DisjointPoolMemType::All) { for (auto &Config : AllConfigs.Configs) { - Config.SlabMinSize = AllConfigs.Configs[LM].SlabMinSize; + UMF_CALL( + umfDisjointPoolParamsSetSlabMinSize(Config, TmpValue)); } + } else if (ParamWasSet) { + UMF_CALL(umfDisjointPoolParamsSetSlabMinSize( + AllConfigs.Configs[LM], TmpValue)); } } }; @@ -191,18 +253,26 @@ DisjointPoolAllConfigs parseDisjointPoolConfig(const std::string &config, } Params.erase(0, Pos + 1); do { - size_t Pos = Params.find(';'); - if (Pos != std::string::npos) { - if (Pos > 0) { - std::string MemParams = Params.substr(0, Pos); - MemTypeParser(MemParams); - } - Params.erase(0, Pos + 1); - if (Params.size() == 0) { + try { + size_t Pos = Params.find(';'); + if (Pos != std::string::npos) { + if (Pos > 0) { + std::string MemParams = Params.substr(0, Pos); + MemTypeParser(MemParams); + } + Params.erase(0, Pos + 1); + if (Params.size() == 0) { + break; + } + } else { + MemTypeParser(Params); break; } - } else { - MemTypeParser(Params); + } catch (const std::runtime_error &e) { + logger::error("Error in parsing DisjointPool config, " + "returning default config values. ", + e.what()); + AllConfigs = DisjointPoolAllConfigs(trace); break; } } while (true); @@ -222,8 +292,9 @@ DisjointPoolAllConfigs parseDisjointPoolConfig(const std::string &config, umfDisjointPoolSharedLimitsDestroy); for (auto &Config : AllConfigs.Configs) { - Config.SharedLimits = AllConfigs.limits.get(); - Config.PoolTrace = trace; + UMF_CALL(umfDisjointPoolParamsSetSharedLimits(Config, + AllConfigs.limits.get())); + UMF_CALL(umfDisjointPoolParamsSetTrace(Config, trace)); } if (!trace) { @@ -234,39 +305,39 @@ DisjointPoolAllConfigs parseDisjointPoolConfig(const std::string &config, "Variable)" << std::endl; - std::cout << std::setw(15) << "Parameter" << std::setw(12) << "Host" - << std::setw(12) << "Device" << std::setw(12) << "Shared RW" - << std::setw(12) << "Shared RO" << std::endl; - std::cout - << std::setw(15) << "SlabMinSize" << std::setw(12) - << AllConfigs.Configs[DisjointPoolMemType::Host].SlabMinSize - << std::setw(12) - << AllConfigs.Configs[DisjointPoolMemType::Device].SlabMinSize - << std::setw(12) - << AllConfigs.Configs[DisjointPoolMemType::Shared].SlabMinSize - << std::setw(12) - << AllConfigs.Configs[DisjointPoolMemType::SharedReadOnly].SlabMinSize - << std::endl; - std::cout << std::setw(15) << "MaxPoolableSize" << std::setw(12) - << AllConfigs.Configs[DisjointPoolMemType::Host].MaxPoolableSize - << std::setw(12) - << AllConfigs.Configs[DisjointPoolMemType::Device].MaxPoolableSize - << std::setw(12) - << AllConfigs.Configs[DisjointPoolMemType::Shared].MaxPoolableSize - << std::setw(12) - << AllConfigs.Configs[DisjointPoolMemType::SharedReadOnly] - .MaxPoolableSize - << std::endl; - std::cout - << std::setw(15) << "Capacity" << std::setw(12) - << AllConfigs.Configs[DisjointPoolMemType::Host].Capacity - << std::setw(12) - << AllConfigs.Configs[DisjointPoolMemType::Device].Capacity - << std::setw(12) - << AllConfigs.Configs[DisjointPoolMemType::Shared].Capacity - << std::setw(12) - << AllConfigs.Configs[DisjointPoolMemType::SharedReadOnly].Capacity - << std::endl; + // TODO: fixme, accessing config values directly is no longer allowed - API's changed + // std::cout << std::setw(15) << "Parameter" << std::setw(12) << "Host" + // << std::setw(12) << "Device" << std::setw(12) << "Shared RW" + // << std::setw(12) << "Shared RO" << std::endl; + // std::cout + // << std::setw(15) << "SlabMinSize" << std::setw(12) + // << umfDisjointPoolParamsGetSlabMinSize(AllConfigs.Configs[DisjointPoolMemType::Host]) + // << std::setw(12) + // << umfDisjointPoolParamsGetSlabMinSize(AllConfigs.Configs[DisjointPoolMemType::Device]) + // << std::setw(12) + // << umfDisjointPoolParamsGetSlabMinSize(AllConfigs.Configs[DisjointPoolMemType::Shared]) + // << std::setw(12) + // << umfDisjointPoolParamsGetSlabMinSize(AllConfigs.Configs[DisjointPoolMemType::SharedReadOnly]) + // << std::endl; + // std::cout << std::setw(15) << "MaxPoolableSize" << std::setw(12) + // << umfDisjointPoolParamsGetMaxPoolableSize(AllConfigs.Configs[DisjointPoolMemType::Host]) + // << std::setw(12) + // << umfDisjointPoolParamsGetMaxPoolableSize(AllConfigs.Configs[DisjointPoolMemType::Device]) + // << std::setw(12) + // << umfDisjointPoolParamsGetMaxPoolableSize(AllConfigs.Configs[DisjointPoolMemType::Shared]) + // << std::setw(12) + // << umfDisjointPoolParamsGetMaxPoolableSize(AllConfigs.Configs[DisjointPoolMemType::SharedReadOnly]) + // << std::endl; + // std::cout + // << std::setw(15) << "Capacity" << std::setw(12) + // << umfDisjointPoolParamsGetCapacity(AllConfigs.Configs[DisjointPoolMemType::Host]) + // << std::setw(12) + // << umfDisjointPoolParamsGetCapacity(AllConfigs.Configs[DisjointPoolMemType::Device]) + // << std::setw(12) + // << umfDisjointPoolParamsGetCapacity(AllConfigs.Configs[DisjointPoolMemType::Shared]) + // << std::setw(12) + // << umfDisjointPoolParamsGetCapacity(AllConfigs.Configs[DisjointPoolMemType::SharedReadOnly]) + // << std::endl; std::cout << std::setw(15) << "MaxPoolSize" << std::setw(12) << MaxSize << std::endl; std::cout << std::setw(15) << "EnableBuffers" << std::setw(12) diff --git a/source/common/umf_pools/disjoint_pool_config_parser.hpp b/source/common/umf_pools/disjoint_pool_config_parser.hpp index 2efb7ddfdc..664ed30d21 100644 --- a/source/common/umf_pools/disjoint_pool_config_parser.hpp +++ b/source/common/umf_pools/disjoint_pool_config_parser.hpp @@ -1,5 +1,7 @@ //===--- disjoint_pool_config_parser.hpp -configuration for USM memory pool-==// // +// Copyright (C) 2023-2024 Intel Corporation +// // Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -23,9 +25,10 @@ class DisjointPoolAllConfigs { public: size_t EnableBuffers = 1; std::shared_ptr limits; - umf_disjoint_pool_params_t Configs[DisjointPoolMemType::All]; + umf_disjoint_pool_params_handle_t Configs[DisjointPoolMemType::All]; DisjointPoolAllConfigs(int trace = 0); + ~DisjointPoolAllConfigs(); }; // Parse optional config parameters of this form: