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
8 changes: 7 additions & 1 deletion test/coarse_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,13 @@ INSTANTIATE_TEST_SUITE_P(
CoarseWithMemoryStrategyTest, CoarseWithMemoryStrategyTest,
::testing::Values(UMF_COARSE_MEMORY_STRATEGY_FASTEST,
UMF_COARSE_MEMORY_STRATEGY_FASTEST_BUT_ONE,
UMF_COARSE_MEMORY_STRATEGY_CHECK_ALL_SIZE));
UMF_COARSE_MEMORY_STRATEGY_CHECK_ALL_SIZE),
([](auto const &info) {
const char *names[] = {"UMF_COARSE_MEMORY_STRATEGY_FASTEST",
"UMF_COARSE_MEMORY_STRATEGY_FASTEST_BUT_ONE",
"UMF_COARSE_MEMORY_STRATEGY_CHECK_ALL_SIZE"};
return names[info.index];
}));

TEST_P(CoarseWithMemoryStrategyTest, coarseTest_basic_provider) {
umf_memory_provider_handle_t malloc_memory_provider;
Expand Down
8 changes: 7 additions & 1 deletion test/disjoint_pool_file_prov.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ INSTANTIATE_TEST_SUITE_P(
FileWithMemoryStrategyTest, FileWithMemoryStrategyTest,
::testing::Values(UMF_COARSE_MEMORY_STRATEGY_FASTEST,
UMF_COARSE_MEMORY_STRATEGY_FASTEST_BUT_ONE,
UMF_COARSE_MEMORY_STRATEGY_CHECK_ALL_SIZE));
UMF_COARSE_MEMORY_STRATEGY_CHECK_ALL_SIZE),
([](auto const &info) {
const char *names[] = {"UMF_COARSE_MEMORY_STRATEGY_FASTEST",
"UMF_COARSE_MEMORY_STRATEGY_FASTEST_BUT_ONE",
"UMF_COARSE_MEMORY_STRATEGY_CHECK_ALL_SIZE"};
return names[info.index];
}));

TEST_P(FileWithMemoryStrategyTest, disjointFileMallocPool_simple1) {
umf_memory_provider_handle_t malloc_memory_provider = nullptr;
Expand Down
37 changes: 30 additions & 7 deletions test/memoryPoolAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,16 +309,22 @@ INSTANTIATE_TEST_SUITE_P(
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr},
poolCreateExtParams{umfDisjointPoolOps(), defaultDisjointPoolConfig,
defaultDisjointPoolConfigDestroy,
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}));
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}),
poolCreateExtParamsNameGen);

INSTANTIATE_TEST_SUITE_P(mallocMultiPoolTest, umfMultiPoolTest,
::testing::Values(poolCreateExtParams{
umfProxyPoolOps(), nullptr, nullptr,
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}));
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}),
poolCreateExtParamsNameGen);

INSTANTIATE_TEST_SUITE_P(umfPoolWithCreateFlagsTest, umfPoolWithCreateFlagsTest,
::testing::Values(0,
UMF_POOL_CREATE_FLAG_OWN_PROVIDER));
INSTANTIATE_TEST_SUITE_P(
umfPoolWithCreateFlagsTest, umfPoolWithCreateFlagsTest,
::testing::Values(0, UMF_POOL_CREATE_FLAG_OWN_PROVIDER),
([](auto const &info) {
const char *names[] = {"NONE", "UMF_POOL_CREATE_FLAG_OWN_PROVIDER"};
return names[info.index];
}));

////////////////// Negative test cases /////////////////

Expand Down Expand Up @@ -382,7 +388,14 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY,
UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC,
UMF_RESULT_ERROR_INVALID_ARGUMENT,
UMF_RESULT_ERROR_UNKNOWN));
UMF_RESULT_ERROR_UNKNOWN),
([](auto const &info) {
const char *names[] = {"UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY",
"UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC",
"UMF_RESULT_ERROR_INVALID_ARGUMENT",
"UMF_RESULT_ERROR_UNKNOWN"};
return names[info.index];
}));

TEST_P(poolInitializeTest, errorPropagation) {
auto nullProvider = umf_test::wrapProviderUnique(nullProviderCreate());
Expand Down Expand Up @@ -554,4 +567,14 @@ INSTANTIATE_TEST_SUITE_P(
umf_test::withGeneratedArgs(umfPoolCalloc),
umf_test::withGeneratedArgs(umfPoolRealloc),
umf_test::withGeneratedArgs(umfPoolMallocUsableSize),
umf_test::withGeneratedArgs(umfPoolGetLastAllocationError)));
umf_test::withGeneratedArgs(umfPoolGetLastAllocationError)),
([](auto const &info) {
const char *names[] = {"umfPoolMalloc",
"umfPoolAlignedMalloc",
"umfPoolFree",
"umfPoolCalloc",
"umfPoolRealloc",
"umfPoolMallocUsableSize",
"umfPoolGetLastAllocationError"};
return names[info.index];
}));
21 changes: 19 additions & 2 deletions test/memoryProviderAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,14 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY,
UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC,
UMF_RESULT_ERROR_INVALID_ARGUMENT,
UMF_RESULT_ERROR_UNKNOWN));
UMF_RESULT_ERROR_UNKNOWN),
([](auto const &info) {
const char *names[] = {"UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY",
"UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC",
"UMF_RESULT_ERROR_INVALID_ARGUMENT",
"UMF_RESULT_ERROR_UNKNOWN"};
return names[info.index];
}));

TEST_P(providerInitializeTest, errorPropagation) {
struct provider : public umf_test::provider_base_t {
Expand Down Expand Up @@ -389,4 +396,14 @@ INSTANTIATE_TEST_SUITE_P(
umf_test::withGeneratedArgs(umfMemoryProviderGetMinPageSize),
umf_test::withGeneratedArgs(umfMemoryProviderPurgeLazy),
umf_test::withGeneratedArgs(umfMemoryProviderPurgeForce),
umf_test::withGeneratedArgs(umfMemoryProviderGetName)));
umf_test::withGeneratedArgs(umfMemoryProviderGetName)),
([](auto const &info) {
const char *names[] = {"umfMemoryProviderAlloc",
"umfMemoryProviderFree",
"umfMemoryProviderGetRecommendedPageSize",
"umfMemoryProviderGetMinPageSize",
"umfMemoryProviderPurgeLazy",
"umfMemoryProviderPurgeForce",
"umfMemoryProviderGetName"};
return names[info.index];
}));
29 changes: 19 additions & 10 deletions test/memspaces/memspace_highest_bandwidth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,25 @@ static void canQueryBandwidth(size_t nodeId) {
}
}

INSTANTIATE_TEST_SUITE_P(memspaceLowestLatencyTest, memspaceGetTest,
::testing::Values(memspaceGetParams{
canQueryBandwidth,
umfMemspaceHighestBandwidthGet}));

INSTANTIATE_TEST_SUITE_P(memspaceLowestLatencyProviderTest,
memspaceProviderTest,
::testing::Values(memspaceGetParams{
canQueryBandwidth,
umfMemspaceHighestBandwidthGet}));
INSTANTIATE_TEST_SUITE_P(
memspaceLowestLatencyTest, memspaceGetTest,
::testing::Values(memspaceGetParams{canQueryBandwidth,
umfMemspaceHighestBandwidthGet}),
([](auto const &info) {
const char *names[] = {"canQueryBandwidth",
"umfMemspaceHighestBandwidthGet"};
return names[info.index];
}));

INSTANTIATE_TEST_SUITE_P(
memspaceLowestLatencyProviderTest, memspaceProviderTest,
::testing::Values(memspaceGetParams{canQueryBandwidth,
umfMemspaceHighestBandwidthGet}),
([](auto const &info) {
const char *names[] = {"canQueryBandwidth",
"umfMemspaceHighestBandwidthGet"};
return names[info.index];
}));

TEST_F(numaNodesTest, PerCoreBandwidthPlacement) {
const size_t allocSize = 4096;
Expand Down
16 changes: 14 additions & 2 deletions test/memspaces/memspace_lowest_latency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,21 @@ static void canQueryLatency(size_t nodeId) {

INSTANTIATE_TEST_SUITE_P(memspaceLowestLatencyTest, memspaceGetTest,
::testing::Values(memspaceGetParams{
canQueryLatency, umfMemspaceLowestLatencyGet}));
canQueryLatency, umfMemspaceLowestLatencyGet}),
([](auto const &info) {
const char *names[] = {
"canQueryLatency",
"umfMemspaceLowestLatencyGet"};
return names[info.index];
}));

INSTANTIATE_TEST_SUITE_P(memspaceLowestLatencyProviderTest,
memspaceProviderTest,
::testing::Values(memspaceGetParams{
canQueryLatency, umfMemspaceLowestLatencyGet}));
canQueryLatency, umfMemspaceLowestLatencyGet}),
([](auto const &info) {
const char *names[] = {
"canQueryLatency",
"umfMemspaceLowestLatencyGet"};
return names[info.index];
}));
20 changes: 20 additions & 0 deletions test/poolFixtures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@ using poolCreateExtParams =
pfnPoolParamsDestroy, const umf_memory_provider_ops_t *,
pfnProviderParamsCreate, pfnProviderParamsDestroy>;

std::string poolCreateExtParamsNameGen(
const testing::TestParamInfo<poolCreateExtParams> param) {

const umf_memory_pool_ops_t *pool_ops = std::get<0>(param.param);
const umf_memory_provider_ops_t *provider_ops = std::get<3>(param.param);

const char *poolName = NULL;
const char *providerName = NULL;

pool_ops->get_name(NULL, &poolName);
provider_ops->get_name(NULL, &providerName);

std::string poolParams =
std::get<1>(param.param)
? std::string("_w_params_") + std::to_string(param.index)
: std::string("");

return std::string(poolName) + poolParams + "_" + providerName;
}

umf_test::pool_unique_handle_t poolCreateExtUnique(poolCreateExtParams params) {
auto [pool_ops, poolParamsCreate, poolParamsDestroy, provider_ops,
providerParamsCreate, providerParamsDestroy] = params;
Expand Down
6 changes: 4 additions & 2 deletions test/pools/disjoint_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,8 @@ INSTANTIATE_TEST_SUITE_P(disjointPoolTests, umfPoolTest,
::testing::Values(poolCreateExtParams{
umfDisjointPoolOps(), defaultDisjointPoolConfig,
defaultDisjointPoolConfigDestroy,
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}));
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}),
poolCreateExtParamsNameGen);

void *memProviderParams() { return (void *)&DEFAULT_DISJOINT_CAPACITY; }

Expand All @@ -516,4 +517,5 @@ INSTANTIATE_TEST_SUITE_P(disjointMultiPoolTests, umfMultiPoolTest,
::testing::Values(poolCreateExtParams{
umfDisjointPoolOps(), defaultDisjointPoolConfig,
defaultDisjointPoolConfigDestroy,
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}));
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}),
poolCreateExtParamsNameGen);
3 changes: 2 additions & 1 deletion test/pools/jemalloc_coarse_devdax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ static std::vector<poolCreateExtParams> poolParamsList =
: std::vector<poolCreateExtParams>{};

INSTANTIATE_TEST_SUITE_P(jemallocCoarseDevDaxTest, umfPoolTest,
::testing::ValuesIn(poolParamsList));
::testing::ValuesIn(poolParamsList),
poolCreateExtParamsNameGen);
3 changes: 2 additions & 1 deletion test/pools/jemalloc_coarse_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ INSTANTIATE_TEST_SUITE_P(jemallocCoarseFileTest, umfPoolTest,
::testing::Values(poolCreateExtParams{
umfJemallocPoolOps(), nullptr, nullptr,
umfFileMemoryProviderOps(), getFileParamsDefault,
destroyFileParams}));
destroyFileParams}),
poolCreateExtParamsNameGen);
3 changes: 2 additions & 1 deletion test/pools/jemalloc_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ INSTANTIATE_TEST_SUITE_P(
poolCreateExtParams{umfJemallocPoolOps(), createJemallocParams<1>,
destroyJemallocParams, umfOsMemoryProviderOps(),
createOsMemoryProviderParams,
destroyOsMemoryProviderParams}));
destroyOsMemoryProviderParams}),
poolCreateExtParamsNameGen);

// this test makes sure that jemalloc does not use
// memory provider to allocate metadata (and hence
Expand Down
3 changes: 2 additions & 1 deletion test/pools/pool_base_alloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ umf_memory_pool_ops_t BA_POOL_OPS =
INSTANTIATE_TEST_SUITE_P(baPool, umfPoolTest,
::testing::Values(poolCreateExtParams{
&BA_POOL_OPS, nullptr, nullptr,
&umf_test::BASE_PROVIDER_OPS, nullptr, nullptr}));
&umf_test::BASE_PROVIDER_OPS, nullptr, nullptr}),
poolCreateExtParamsNameGen);
3 changes: 2 additions & 1 deletion test/pools/scalable_coarse_devdax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ static std::vector<poolCreateExtParams> poolParamsList =
: std::vector<poolCreateExtParams>{};

INSTANTIATE_TEST_SUITE_P(scalableCoarseDevDaxTest, umfPoolTest,
::testing::ValuesIn(poolParamsList));
::testing::ValuesIn(poolParamsList),
poolCreateExtParamsNameGen);
3 changes: 2 additions & 1 deletion test/pools/scalable_coarse_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ INSTANTIATE_TEST_SUITE_P(scalableCoarseFileTest, umfPoolTest,
::testing::Values(poolCreateExtParams{
umfScalablePoolOps(), nullptr, nullptr,
umfFileMemoryProviderOps(), getFileParamsDefault,
destroyFileParams}));
destroyFileParams}),
poolCreateExtParamsNameGen);
3 changes: 2 additions & 1 deletion test/pools/scalable_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ INSTANTIATE_TEST_SUITE_P(
scalablePoolTest, umfPoolTest,
::testing::Values(poolCreateExtParams{
umfScalablePoolOps(), nullptr, nullptr, umfOsMemoryProviderOps(),
createOsMemoryProviderParams, destroyOsMemoryProviderParams}));
createOsMemoryProviderParams, destroyOsMemoryProviderParams}),
poolCreateExtParamsNameGen);

using scalablePoolParams = std::tuple<size_t, bool>;
struct umfScalablePoolParamsTest
Expand Down
19 changes: 14 additions & 5 deletions test/provider_os_memory_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,20 @@ struct providerConfigTestNumaMode
}
};

INSTANTIATE_TEST_SUITE_P(numa_modes, providerConfigTestNumaMode,
testing::Values(UMF_NUMA_MODE_DEFAULT,
UMF_NUMA_MODE_BIND,
UMF_NUMA_MODE_INTERLEAVE,
UMF_NUMA_MODE_LOCAL));
INSTANTIATE_TEST_SUITE_P(
numa_modes, providerConfigTestNumaMode,
testing::Values(UMF_NUMA_MODE_DEFAULT, UMF_NUMA_MODE_BIND,
UMF_NUMA_MODE_INTERLEAVE, UMF_NUMA_MODE_LOCAL),
([](auto const &info) {
const char *names[] = {
"UMF_NUMA_MODE_DEFAULT",
"UMF_NUMA_MODE_BIND",
"UMF_NUMA_MODE_INTERLEAVE",
"UMF_NUMA_MODE_LOCAL"
};
return names[info.index];
}));

#ifndef MPOL_LOCAL
#define MPOL_LOCAL 4
#endif
Expand Down
6 changes: 4 additions & 2 deletions test/provider_tracking_fixture_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ INSTANTIATE_TEST_SUITE_P(TrackingProviderPoolTest, umfPoolTest,
::testing::Values(poolCreateExtParams{
umfProxyPoolOps(), nullptr, nullptr,
&PROVIDER_FROM_POOL_OPS,
providerFromPoolParamsCreate, nullptr}));
providerFromPoolParamsCreate, nullptr}),
poolCreateExtParamsNameGen);

INSTANTIATE_TEST_SUITE_P(TrackingProviderMultiPoolTest, umfMultiPoolTest,
::testing::Values(poolCreateExtParams{
umfProxyPoolOps(), nullptr, nullptr,
&PROVIDER_FROM_POOL_OPS,
providerFromPoolParamsCreate, nullptr}));
providerFromPoolParamsCreate, nullptr}),
poolCreateExtParamsNameGen);
15 changes: 13 additions & 2 deletions test/providers/provider_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,13 @@ TEST_P(umfCUDAProviderAllocFlagsTest, reuseParams) {
INSTANTIATE_TEST_SUITE_P(umfCUDAProviderTestSuite, umfCUDAProviderTest,
::testing::Values(UMF_MEMORY_TYPE_DEVICE,
UMF_MEMORY_TYPE_SHARED,
UMF_MEMORY_TYPE_HOST));
UMF_MEMORY_TYPE_HOST),
([](auto const &info) {
const char *names[] = {"UMF_MEMORY_TYPE_DEVICE",
"UMF_MEMORY_TYPE_SHARED",
"UMF_MEMORY_TYPE_HOST"};
return names[info.index];
}));

INSTANTIATE_TEST_SUITE_P(
umfCUDAProviderAllocFlagsTestSuite, umfCUDAProviderAllocFlagsTest,
Expand All @@ -619,7 +625,12 @@ INSTANTIATE_TEST_SUITE_P(
std::make_tuple(UMF_MEMORY_TYPE_SHARED, CU_MEM_ATTACH_HOST),
std::make_tuple(UMF_MEMORY_TYPE_HOST, CU_MEMHOSTALLOC_PORTABLE),
std::make_tuple(UMF_MEMORY_TYPE_HOST, CU_MEMHOSTALLOC_DEVICEMAP),
std::make_tuple(UMF_MEMORY_TYPE_HOST, CU_MEMHOSTALLOC_WRITECOMBINED)));
std::make_tuple(UMF_MEMORY_TYPE_HOST, CU_MEMHOSTALLOC_WRITECOMBINED)),
([](auto const &info) {
const char *names[] = {"SHARED_GLOBAL", "SHARED_HOST", "HOST_PORTABLE",
"HOST_DEVICEMAP", "HOST_WRITECOMBINED"};
return names[info.index];
}));

// TODO: add IPC API
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(umfIpcTest);
Expand Down
16 changes: 14 additions & 2 deletions test/providers/provider_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ struct LevelZeroProviderInit
INSTANTIATE_TEST_SUITE_P(, LevelZeroProviderInit,
::testing::Values(UMF_MEMORY_TYPE_HOST,
UMF_MEMORY_TYPE_DEVICE,
UMF_MEMORY_TYPE_SHARED));
UMF_MEMORY_TYPE_SHARED),
([](auto const &info) {
const char *names[] = {"UMF_MEMORY_TYPE_HOST",
"UMF_MEMORY_TYPE_SHARED",
"UMF_MEMORY_TYPE_DEVICE"};
return names[info.index];
}));

TEST_P(LevelZeroProviderInit, FailNullContext) {
const umf_memory_provider_ops_t *ops = umfLevelZeroMemoryProviderOps();
Expand Down Expand Up @@ -490,7 +496,13 @@ INSTANTIATE_TEST_SUITE_P(umfLevelZeroProviderTestSuite,
umfLevelZeroProviderTest,
::testing::Values(UMF_MEMORY_TYPE_DEVICE,
UMF_MEMORY_TYPE_SHARED,
UMF_MEMORY_TYPE_HOST));
UMF_MEMORY_TYPE_HOST),
([](auto const &info) {
const char *names[] = {"UMF_MEMORY_TYPE_DEVICE",
"UMF_MEMORY_TYPE_SHARED",
"UMF_MEMORY_TYPE_HOST"};
return names[info.index];
}));

LevelZeroTestHelper l0TestHelper;

Expand Down
Loading