Skip to content

Commit 7228b45

Browse files
committed
fixes
1 parent f02e38c commit 7228b45

File tree

8 files changed

+360
-8
lines changed

8 files changed

+360
-8
lines changed

benchmark/ubench.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ UBENCH_EX(mem_props, disjoint_pool_with_level_zero_provider_use_umf) {
854854
umfLevelZeroMemoryProviderParamsDestroy(level_zero_params);
855855

856856
err_destroy_context:
857-
//utils_ze_destroy_context(context);
857+
utils_ze_destroy_context(context);
858858
}
859859

860860
#endif /* (defined UMF_BUILD_LEVEL_ZERO_PROVIDER && defined UMF_BUILD_GPU_TESTS) */

include/umf/base.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ typedef enum umf_memory_property_id_t {
5959
UMF_MEMORY_PROPERTY_INVALID = -1, ///< Invalid property
6060

6161
// UMF specific
62-
UMF_MEMORY_PROVIDER_HANDLE = 0, ///< Handle to the memory provider
63-
UMF_MEMORY_POOL_HANDLE = 1, ///< Handle to the memory pool
62+
UMF_MEMORY_PROPERTY_PROVIDER_HANDLE = 0, ///< Handle to the memory provider
63+
UMF_MEMORY_PROPERTY_POOL_HANDLE = 1, ///< Handle to the memory pool
6464

6565
// generic pointer properties
6666
UMF_MEMORY_PROPERTY_POINTER_TYPE =

src/memory_props.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ umf_result_t umfGetMemoryProperty(umf_memory_properties_handle_t props_handle,
4747
case UMF_MEMORY_PROPERTY_INVALID:
4848
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
4949

50-
case UMF_MEMORY_POOL_HANDLE:
50+
case UMF_MEMORY_PROPERTY_POOL_HANDLE:
5151
*(umf_memory_pool_handle_t *)value = props_handle->pool;
5252
return UMF_RESULT_SUCCESS;
5353

54-
case UMF_MEMORY_PROVIDER_HANDLE:
54+
case UMF_MEMORY_PROPERTY_PROVIDER_HANDLE:
5555
*(umf_memory_provider_handle_t *)value = provider;
5656
return UMF_RESULT_SUCCESS;
5757

@@ -72,7 +72,8 @@ umf_result_t umfGetMemoryProperty(umf_memory_properties_handle_t props_handle,
7272
case UMF_MEMORY_PROPERTY_CONTEXT:
7373
case UMF_MEMORY_PROPERTY_DEVICE:
7474
return provider->ops.ext_get_allocation_properties(
75-
provider->provider_priv, props_handle, memory_property_id, value);
75+
provider->provider_priv, props_handle->ptr, memory_property_id,
76+
value);
7677

7778
default:
7879
break;

test/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ function(build_umf_test)
5454
if(UMF_CUDA_ENABLED)
5555
set(INC_DIRS ${INC_DIRS} ${CUDA_INCLUDE_DIRS})
5656
set(LIB_DIRS ${LIB_DIRS} ${CUDA_LIBRARY_DIRS})
57+
set(CPL_DEFS ${CPL_DEFS} UMF_CUDA_ENABLED=1)
5758
endif()
5859

5960
if(UMF_LEVEL_ZERO_ENABLED)
6061
set(INC_DIRS ${INC_DIRS} ${LEVEL_ZERO_INCLUDE_DIRS})
6162
set(LIB_DIRS ${LIB_DIRS} ${ZE_LOADER_LIBRARY_DIRS})
63+
set(CPL_DEFS ${CPL_DEFS} UMF_LEVEL_ZERO_ENABLED=1)
6264
endif()
6365

6466
if(NOT UMF_DISABLE_HWLOC)
@@ -350,6 +352,10 @@ if(LINUX AND (NOT UMF_DISABLE_HWLOC)) # OS-specific functions are implemented
350352
NAME provider_fixed_memory
351353
SRCS provider_fixed_memory.cpp
352354
LIBS ${UMF_UTILS_FOR_TEST} ${UMF_BA_FOR_TEST})
355+
add_umf_test(
356+
NAME provider_props
357+
SRCS provider_props.cpp
358+
LIBS ${UMF_UTILS_FOR_TEST} ${UMF_BA_FOR_TEST})
353359
add_umf_test(
354360
NAME provider_tracking
355361
SRCS provider_tracking.cpp

test/common/provider_null.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,16 @@ static umf_result_t nullCloseIpcHandle(void *provider, void *ptr, size_t size) {
133133
return UMF_RESULT_SUCCESS;
134134
}
135135

136+
static umf_result_t
137+
nullGetAllocationProperties(void *provider, const void *ptr,
138+
umf_memory_property_id_t propertyId, void *value) {
139+
(void)provider;
140+
(void)ptr;
141+
(void)propertyId;
142+
(void)value;
143+
return UMF_RESULT_SUCCESS;
144+
}
145+
136146
umf_memory_provider_ops_t UMF_NULL_PROVIDER_OPS = {
137147
.version = UMF_PROVIDER_OPS_VERSION_CURRENT,
138148
.initialize = nullInitialize,
@@ -152,4 +162,5 @@ umf_memory_provider_ops_t UMF_NULL_PROVIDER_OPS = {
152162
.ext_put_ipc_handle = nullPutIpcHandle,
153163
.ext_open_ipc_handle = nullOpenIpcHandle,
154164
.ext_close_ipc_handle = nullCloseIpcHandle,
165+
.ext_get_allocation_properties = nullGetAllocationProperties,
155166
};

test/common/test_helpers.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2023-2024 Intel Corporation
1+
// Copyright (C) 2023-2025 Intel Corporation
22
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
// This file contains helpers for tests for UMF pool API
@@ -9,8 +9,10 @@
99
#include <stdarg.h>
1010
#include <stdio.h>
1111
#include <stdlib.h>
12+
1213
#include <umf/base.h>
1314
#include <umf/memory_pool.h>
15+
#include <umf/memory_props.h>
1416
#include <umf/memory_provider_ops.h>
1517

1618
#include "provider_trace.h"

test/memoryProviderAPI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ TEST_F(test, memoryProviderOpsNullGetAllocationProperties) {
332332
ASSERT_EQ(ret, UMF_RESULT_SUCCESS);
333333

334334
ret = umfMemoryProviderGetAllocationProperties(
335-
hProvider, nullptr, UMF_MEMORY_PROPERTY_INVALID, nullptr);
335+
hProvider, nullptr, UMF_MEMORY_PROPERTY_PROVIDER_HANDLE, nullptr);
336336
ASSERT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT);
337337

338338
umfMemoryProviderDestroy(hProvider);

0 commit comments

Comments
 (0)