Skip to content

Commit de5f8c0

Browse files
authored
Merge pull request #1188 from KFilipek/fix-to-utils
Move C++ helper header to utils
2 parents 7cf5ec5 + 52d1f59 commit de5f8c0

22 files changed

+93
-94
lines changed

.github/workflows/reusable_gpu.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ jobs:
9999
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
100100
-DUMF_BUILD_${{inputs.name}}_PROVIDER=ON
101101
-DUMF_TESTS_FAIL_ON_SKIP=ON
102-
${{ matrix.os == 'Ubuntu' && matrix.build_type == 'Debug' && '-DUMF_USE_COVERAGE=ON' || '' }}
103-
${{ matrix.os == 'Windows' && '-DCMAKE_SUPPRESS_REGENERATION=ON' || '' }}
102+
${{ matrix.os == 'Ubuntu' && matrix.build_type == 'Debug' && '-DUMF_USE_COVERAGE=ON' || '' }}
103+
${{ matrix.os == 'Windows' && '-DCMAKE_SUPPRESS_REGENERATION=ON' || '' }}
104104
105105
- name: Build UMF
106106
run: cmake --build ${{env.BUILD_DIR}} --config ${{matrix.build_type}} -j ${{matrix.number_of_processors}}

scripts/qemu/configs/default.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,12 @@ Cell 2 | 0 | 1200MiB | 17, 28, 10 |
5050
<interconnects>
5151
<latency initiator='0' target='0' type='access' value='10'/>
5252
<bandwidth initiator='0' target='0' type='access' value='10485760' unit='B'/>
53-
5453
<latency initiator='0' target='1' type='access' value='20'/>
5554
<bandwidth initiator='0' target='1' type='access' value='5242880' unit='B'/>
56-
5755
<latency initiator='0' target='2' type='access' value='16'/>
5856
<bandwidth initiator='0' target='2' type='access' value='1048576' unit='B'/>
59-
6057
<latency initiator='1' target='1' type='access' value='10'/>
6158
<bandwidth initiator='1' target='1' type='access' value='10485760' unit='B'/>
62-
6359
<latency initiator='1' target='2' type='access' value='27'/>
6460
<bandwidth initiator='1' target='2' type='access' value='1048576' unit='B'/>
6561
</interconnects>

test/c_api/test_ut_asserts.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2023-2024 Intel Corporation
3+
* Copyright (C) 2023-2025 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
@@ -9,7 +9,7 @@
99

1010
/*
1111
The project uses GTEST framework for testing, which is not supported in C
12-
These asserts should NOT be used in other purposes than for testing C API
12+
These asserts should NOT be used in other purposes than for testing C API
1313
*/
1414

1515
#ifndef UMF_TEST_UT_ASSERTS_H

test/coarse_lib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static void coarse_params_set_default(coarse_params_t *coarse_params,
9999
}
100100

101101
umf_memory_provider_ops_t UMF_MALLOC_MEMORY_PROVIDER_OPS =
102-
umf::providerMakeCOps<umf_test::provider_ba_global, void>();
102+
umf_test::providerMakeCOps<umf_test::provider_ba_global, void>();
103103

104104
struct CoarseWithMemoryStrategyTest
105105
: umf_test::test,

test/common/pool.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#include <umf/pools/pool_disjoint.h>
2323

2424
#include "base.hpp"
25-
#include "cpp_helpers.hpp"
2625
#include "provider.hpp"
26+
#include "utils/cpp_helpers.hpp"
2727

2828
namespace umf_test {
2929

@@ -38,7 +38,7 @@ createPoolChecked(umf_memory_pool_ops_t *ops,
3838
}
3939

4040
auto wrapPoolUnique(umf_memory_pool_handle_t hPool) {
41-
return umf::pool_unique_handle_t(hPool, &umfPoolDestroy);
41+
return umf_test::pool_unique_handle_t(hPool, &umfPoolDestroy);
4242
}
4343

4444
bool isReallocSupported(umf_memory_pool_handle_t hPool) {
@@ -149,7 +149,7 @@ struct malloc_pool : public pool_base_t {
149149
};
150150

151151
umf_memory_pool_ops_t MALLOC_POOL_OPS =
152-
umf::poolMakeCOps<umf_test::malloc_pool, void>();
152+
umf_test::poolMakeCOps<umf_test::malloc_pool, void>();
153153

154154
static constexpr size_t DEFAULT_DISJOINT_SLAB_MIN_SIZE = 4096;
155155
static constexpr size_t DEFAULT_DISJOINT_MAX_POOLABLE_SIZE = 4096;

test/common/provider.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2023-2024 Intel Corporation
3+
* Copyright (C) 2023-2025 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
@@ -15,8 +15,8 @@
1515

1616
#include "base.hpp"
1717
#include "base_alloc_global.h"
18-
#include "cpp_helpers.hpp"
1918
#include "test_helpers.h"
19+
#include "utils/cpp_helpers.hpp"
2020

2121
namespace umf_test {
2222

@@ -29,7 +29,8 @@ createProviderChecked(umf_memory_provider_ops_t *ops, void *params) {
2929
}
3030

3131
auto wrapProviderUnique(umf_memory_provider_handle_t hProvider) {
32-
return umf::provider_unique_handle_t(hProvider, &umfMemoryProviderDestroy);
32+
return umf_test::provider_unique_handle_t(hProvider,
33+
&umfMemoryProviderDestroy);
3334
}
3435

3536
typedef struct provider_base_t {
@@ -97,7 +98,7 @@ typedef struct provider_base_t {
9798
} provider_base_t;
9899

99100
umf_memory_provider_ops_t BASE_PROVIDER_OPS =
100-
umf::providerMakeCOps<provider_base_t, void>();
101+
umf_test::providerMakeCOps<provider_base_t, void>();
101102

102103
struct provider_ba_global : public provider_base_t {
103104
umf_result_t alloc(size_t size, size_t align, void **ptr) noexcept {
@@ -127,7 +128,7 @@ struct provider_ba_global : public provider_base_t {
127128
};
128129

129130
umf_memory_provider_ops_t BA_GLOBAL_PROVIDER_OPS =
130-
umf::providerMakeCOps<provider_ba_global, void>();
131+
umf_test::providerMakeCOps<provider_ba_global, void>();
131132

132133
struct provider_mock_out_of_mem : public provider_base_t {
133134
provider_ba_global helper_prov;
@@ -152,7 +153,7 @@ struct provider_mock_out_of_mem : public provider_base_t {
152153
};
153154

154155
umf_memory_provider_ops_t MOCK_OUT_OF_MEM_PROVIDER_OPS =
155-
umf::providerMakeCOps<provider_mock_out_of_mem, int>();
156+
umf_test::providerMakeCOps<provider_mock_out_of_mem, int>();
156157

157158
} // namespace umf_test
158159

test/disjoint_pool_file_prov.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ using umf_test::test;
2020
#define FILE_PATH ((char *)"tmp_file")
2121

2222
umf_memory_provider_ops_t UMF_MALLOC_MEMORY_PROVIDER_OPS =
23-
umf::providerMakeCOps<umf_test::provider_ba_global, void>();
23+
umf_test::providerMakeCOps<umf_test::provider_ba_global, void>();
2424

2525
struct FileWithMemoryStrategyTest
2626
: umf_test::test,

test/ipcAPI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ provider_mock_ipc::allocations_mutex_type provider_mock_ipc::alloc_mutex;
109109
provider_mock_ipc::allocations_map_type provider_mock_ipc::allocations;
110110

111111
static umf_memory_provider_ops_t IPC_MOCK_PROVIDER_OPS =
112-
umf::providerMakeCOps<provider_mock_ipc, void>();
112+
umf_test::providerMakeCOps<provider_mock_ipc, void>();
113113

114114
HostMemoryAccessor hostMemoryAccessor;
115115

test/ipcFixtures.hpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ struct umfIpcTest : umf_test::test,
9797

9898
void TearDown() override { test::TearDown(); }
9999

100-
umf::pool_unique_handle_t makePool() {
100+
umf_test::pool_unique_handle_t makePool() {
101101
// TODO: The function is similar to poolCreateExt function
102102
// from memoryPool.hpp
103103
umf_memory_provider_handle_t hProvider = NULL;
@@ -147,7 +147,7 @@ struct umfIpcTest : umf_test::test,
147147
poolParamsDestroy(poolParams);
148148
}
149149

150-
return umf::pool_unique_handle_t(hPool, &umfPoolDestroy);
150+
return umf_test::pool_unique_handle_t(hPool, &umfPoolDestroy);
151151
}
152152

153153
struct stats_type {
@@ -179,7 +179,7 @@ struct umfIpcTest : umf_test::test,
179179
std::vector<void *> ptrs;
180180
constexpr size_t ALLOC_SIZE = 100;
181181
constexpr size_t NUM_POINTERS = 100;
182-
umf::pool_unique_handle_t pool = makePool();
182+
umf_test::pool_unique_handle_t pool = makePool();
183183
ASSERT_NE(pool.get(), nullptr);
184184

185185
for (size_t i = 0; i < NUM_POINTERS; ++i) {
@@ -237,7 +237,7 @@ struct umfIpcTest : umf_test::test,
237237
std::vector<void *> ptrs;
238238
constexpr size_t ALLOC_SIZE = 100;
239239
constexpr size_t NUM_POINTERS = 100;
240-
umf::pool_unique_handle_t pool = makePool();
240+
umf_test::pool_unique_handle_t pool = makePool();
241241
ASSERT_NE(pool.get(), nullptr);
242242

243243
for (size_t i = 0; i < NUM_POINTERS; ++i) {
@@ -284,7 +284,7 @@ struct umfIpcTest : umf_test::test,
284284
std::vector<void *> ptrs;
285285
constexpr size_t ALLOC_SIZE = 100;
286286
constexpr size_t NUM_POINTERS = 100;
287-
umf::pool_unique_handle_t pool = makePool();
287+
umf_test::pool_unique_handle_t pool = makePool();
288288
ASSERT_NE(pool.get(), nullptr);
289289

290290
for (size_t i = 0; i < NUM_POINTERS; ++i) {
@@ -363,7 +363,7 @@ struct umfIpcTest : umf_test::test,
363363
std::vector<void *> ptrs;
364364
constexpr size_t ALLOC_SIZE = 100;
365365
constexpr size_t NUM_POINTERS = 100;
366-
umf::pool_unique_handle_t pool = makePool();
366+
umf_test::pool_unique_handle_t pool = makePool();
367367
ASSERT_NE(pool.get(), nullptr);
368368

369369
for (size_t i = 0; i < NUM_POINTERS; ++i) {
@@ -432,7 +432,7 @@ struct umfIpcTest : umf_test::test,
432432

433433
TEST_P(umfIpcTest, GetIPCHandleSize) {
434434
size_t size = 0;
435-
umf::pool_unique_handle_t pool = makePool();
435+
umf_test::pool_unique_handle_t pool = makePool();
436436
ASSERT_NE(pool.get(), nullptr);
437437

438438
umf_result_t ret = umfPoolGetIPCHandleSize(pool.get(), &size);
@@ -445,7 +445,7 @@ TEST_P(umfIpcTest, GetIPCHandleSizeInvalidArgs) {
445445
umf_result_t ret = umfPoolGetIPCHandleSize(nullptr, &size);
446446
EXPECT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT);
447447

448-
umf::pool_unique_handle_t pool = makePool();
448+
umf_test::pool_unique_handle_t pool = makePool();
449449
ASSERT_NE(pool.get(), nullptr);
450450

451451
ret = umfPoolGetIPCHandleSize(pool.get(), nullptr);
@@ -463,7 +463,7 @@ TEST_P(umfIpcTest, GetIPCHandleInvalidArgs) {
463463
ret = umfGetIPCHandle(ptr, &ipcHandle, &handleSize);
464464
EXPECT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT);
465465

466-
umf::pool_unique_handle_t pool = makePool();
466+
umf_test::pool_unique_handle_t pool = makePool();
467467
ASSERT_NE(pool.get(), nullptr);
468468

469469
ptr = umfPoolMalloc(pool.get(), SIZE);
@@ -488,7 +488,7 @@ TEST_P(umfIpcTest, CloseIPCHandleInvalidPtr) {
488488
TEST_P(umfIpcTest, BasicFlow) {
489489
constexpr size_t SIZE = 100;
490490
std::vector<int> expected_data(SIZE);
491-
umf::pool_unique_handle_t pool = makePool();
491+
umf_test::pool_unique_handle_t pool = makePool();
492492
ASSERT_NE(pool.get(), nullptr);
493493

494494
int *ptr = (int *)umfPoolMalloc(pool.get(), SIZE * sizeof(int));
@@ -555,7 +555,7 @@ TEST_P(umfIpcTest, BasicFlow) {
555555

556556
TEST_P(umfIpcTest, AllocFreeAllocTest) {
557557
constexpr size_t SIZE = 64 * 1024;
558-
umf::pool_unique_handle_t pool = makePool();
558+
umf_test::pool_unique_handle_t pool = makePool();
559559
ASSERT_NE(pool.get(), nullptr);
560560

561561
umf_ipc_handler_handle_t ipcHandler = nullptr;
@@ -616,9 +616,9 @@ TEST_P(umfIpcTest, AllocFreeAllocTest) {
616616
TEST_P(umfIpcTest, openInTwoIpcHandlers) {
617617
constexpr size_t SIZE = 100;
618618
std::vector<int> expected_data(SIZE);
619-
umf::pool_unique_handle_t pool1 = makePool();
619+
umf_test::pool_unique_handle_t pool1 = makePool();
620620
ASSERT_NE(pool1.get(), nullptr);
621-
umf::pool_unique_handle_t pool2 = makePool();
621+
umf_test::pool_unique_handle_t pool2 = makePool();
622622
ASSERT_NE(pool2.get(), nullptr);
623623
umf_ipc_handler_handle_t ipcHandler1 = nullptr;
624624
umf_ipc_handler_handle_t ipcHandler2 = nullptr;
@@ -715,8 +715,8 @@ TEST_P(umfIpcTest, ConcurrentDestroyIpcHandlers) {
715715
constexpr size_t NUM_POOLS = 10;
716716
void *ptrs[NUM_ALLOCS];
717717
void *openedPtrs[NUM_POOLS][NUM_ALLOCS];
718-
std::vector<umf::pool_unique_handle_t> consumerPools;
719-
umf::pool_unique_handle_t producerPool = makePool();
718+
std::vector<umf_test::pool_unique_handle_t> consumerPools;
719+
umf_test::pool_unique_handle_t producerPool = makePool();
720720
ASSERT_NE(producerPool.get(), nullptr);
721721

722722
for (size_t i = 0; i < NUM_POOLS; ++i) {

test/memoryPoolAPI.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ TEST_P(umfPoolWithCreateFlagsTest, memoryPoolWithCustomProvider) {
125125
return UMF_RESULT_SUCCESS;
126126
}
127127
};
128-
umf_memory_pool_ops_t pool_ops = umf::poolMakeCOps<pool, void>();
128+
umf_memory_pool_ops_t pool_ops = umf_test::poolMakeCOps<pool, void>();
129129

130130
umf_memory_pool_handle_t hPool;
131131
auto ret = umfPoolCreate(&pool_ops, hProvider, nullptr, flags, &hPool);
@@ -187,8 +187,8 @@ struct tagTest : umf_test::test {
187187
createPoolChecked(umfProxyPoolOps(), provider.get(), nullptr));
188188
}
189189

190-
umf::provider_unique_handle_t provider;
191-
umf::pool_unique_handle_t pool;
190+
umf_test::provider_unique_handle_t provider;
191+
umf_test::pool_unique_handle_t pool;
192192
};
193193

194194
TEST_F(tagTest, SetAndGet) {
@@ -370,7 +370,8 @@ TEST_P(poolInitializeTest, errorPropagation) {
370370
return *errorToReturn;
371371
}
372372
};
373-
umf_memory_pool_ops_t pool_ops = umf::poolMakeCOps<pool, umf_result_t>();
373+
umf_memory_pool_ops_t pool_ops =
374+
umf_test::poolMakeCOps<pool, umf_result_t>();
374375

375376
umf_memory_pool_handle_t hPool;
376377
auto ret = umfPoolCreate(&pool_ops, hProvider, (void *)&this->GetParam(), 0,
@@ -420,7 +421,7 @@ TEST_F(test, getLastFailedMemoryProvider) {
420421
const char *name;
421422
};
422423
umf_memory_provider_ops_t provider_ops =
423-
umf::providerMakeCOps<memory_provider, char>();
424+
umf_test::providerMakeCOps<memory_provider, char>();
424425

425426
auto providerUnique1 = wrapProviderUnique(
426427
createProviderChecked(&provider_ops, (void *)"provider1"));

test/memoryProviderAPI.cpp

Lines changed: 2 additions & 2 deletions
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 tests for UMF provider API
@@ -335,7 +335,7 @@ TEST_P(providerInitializeTest, errorPropagation) {
335335
}
336336
};
337337
umf_memory_provider_ops_t provider_ops =
338-
umf::providerMakeCOps<provider, umf_result_t>();
338+
umf_test::providerMakeCOps<provider, umf_result_t>();
339339

340340
umf_memory_provider_handle_t hProvider;
341341
auto ret = umfMemoryProviderCreate(&provider_ops, (void *)&this->GetParam(),

test/poolFixtures.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ using poolCreateExtParams =
3232
pfnPoolParamsDestroy, umf_memory_provider_ops_t *,
3333
pfnProviderParamsCreate, pfnProviderParamsDestroy>;
3434

35-
umf::pool_unique_handle_t poolCreateExtUnique(poolCreateExtParams params) {
35+
umf_test::pool_unique_handle_t poolCreateExtUnique(poolCreateExtParams params) {
3636
auto [pool_ops, poolParamsCreate, poolParamsDestroy, provider_ops,
3737
providerParamsCreate, providerParamsDestroy] = params;
3838

@@ -73,7 +73,7 @@ umf::pool_unique_handle_t poolCreateExtUnique(poolCreateExtParams params) {
7373
providerParamsDestroy(provider_params);
7474
}
7575

76-
return umf::pool_unique_handle_t(hPool, &umfPoolDestroy);
76+
return umf_test::pool_unique_handle_t(hPool, &umfPoolDestroy);
7777
}
7878

7979
struct umfPoolTest : umf_test::test,
@@ -86,7 +86,7 @@ struct umfPoolTest : umf_test::test,
8686

8787
void TearDown() override { test::TearDown(); }
8888

89-
umf::pool_unique_handle_t pool;
89+
umf_test::pool_unique_handle_t pool;
9090

9191
static constexpr int NTHREADS = 5;
9292
static constexpr std::array<int, 7> nonAlignedAllocSizes = {5, 7, 23, 55,
@@ -106,7 +106,7 @@ struct umfMultiPoolTest : umf_test::test,
106106

107107
void TearDown() override { test::TearDown(); }
108108

109-
std::vector<umf::pool_unique_handle_t> pools;
109+
std::vector<umf_test::pool_unique_handle_t> pools;
110110
};
111111

112112
struct umfMemTest
@@ -123,7 +123,7 @@ struct umfMemTest
123123

124124
void TearDown() override { test::TearDown(); }
125125

126-
umf::pool_unique_handle_t pool;
126+
umf_test::pool_unique_handle_t pool;
127127
int expectedRecycledPoolAllocs;
128128
};
129129

0 commit comments

Comments
 (0)