|
1 | 1 | /*
|
2 |
| - * |
3 | 2 | * Copyright (C) 2023-2024 Intel Corporation
|
4 | 3 | *
|
5 | 4 | * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
|
|
11 | 10 | #include <hwloc.h>
|
12 | 11 | #include <stdlib.h>
|
13 | 12 |
|
14 |
| -#include <umf/pools/pool_disjoint.h> |
| 13 | +#ifdef UMF_BUILD_LIBUMF_POOL_SCALABLE |
| 14 | +#include <umf/pools/pool_scalable.h> |
| 15 | +#endif |
| 16 | + |
| 17 | +#include <umf/pools/pool_proxy.h> |
15 | 18 | #include <umf/providers/provider_os_memory.h>
|
16 | 19 |
|
17 | 20 | #include "../memory_pool_internal.h"
|
@@ -101,12 +104,31 @@ static umf_result_t numa_memory_provider_create_from_memspace(
|
101 | 104 | static umf_result_t numa_pool_create_from_memspace(
|
102 | 105 | umf_memspace_handle_t memspace, void **memTargets, size_t numTargets,
|
103 | 106 | umf_memspace_policy_handle_t policy, umf_memory_pool_handle_t *pool) {
|
104 |
| - (void)memspace; |
105 |
| - (void)memTargets; |
106 |
| - (void)numTargets; |
107 |
| - (void)policy; |
108 |
| - (void)pool; |
109 |
| - return UMF_RESULT_ERROR_NOT_SUPPORTED; |
| 107 | + |
| 108 | + umf_memory_provider_handle_t numa_provider; |
| 109 | + umf_result_t umf_result = numa_memory_provider_create_from_memspace( |
| 110 | + memspace, memTargets, numTargets, policy, &numa_provider); |
| 111 | + if (umf_result != UMF_RESULT_SUCCESS) { |
| 112 | + return umf_result; |
| 113 | + } |
| 114 | + |
| 115 | + umf_memory_pool_handle_t numa_pool; |
| 116 | + |
| 117 | +#ifdef UMF_BUILD_LIBUMF_POOL_SCALABLE |
| 118 | + umf_result = umfPoolCreate(umfScalablePoolOps(), numa_provider, NULL, |
| 119 | + UMF_POOL_CREATE_FLAG_OWN_PROVIDER, &numa_pool); |
| 120 | +#else |
| 121 | + umf_result = UMF_RESULT_ERROR_NOT_SUPPORTED; |
| 122 | +#endif |
| 123 | + |
| 124 | + if (umf_result != UMF_RESULT_SUCCESS) { |
| 125 | + umfMemoryProviderDestroy(numa_provider); |
| 126 | + return umf_result; |
| 127 | + } |
| 128 | + |
| 129 | + *pool = numa_pool; |
| 130 | + |
| 131 | + return umf_result; |
110 | 132 | }
|
111 | 133 |
|
112 | 134 | static umf_result_t numa_clone(void *memTarget, void **outMemTarget) {
|
|
0 commit comments