Skip to content

Commit 6504923

Browse files
committed
[CTS] add UMF integration test
1 parent 95e03b4 commit 6504923

File tree

3 files changed

+70
-2
lines changed

3 files changed

+70
-2
lines changed

source/common/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ target_include_directories(ur_common PUBLIC
2828

2929
message(STATUS "Download Unified Memory Framework from github.com")
3030
if (NOT DEFINED UMF_REPO)
31-
set(UMF_REPO "https://github.com/oneapi-src/unified-memory-framework.git")
31+
set(UMF_REPO "https://github.com/vinser52/unified-memory-framework.git")
3232
endif()
3333

3434
if (NOT DEFINED UMF_TAG)
3535
# commit 6709535de92933d6bfc1e1d19a324f17afec3877
3636
# Author: Rafał Rudnicki <[email protected]>
3737
# Date: Mon Jan 27 10:57:57 2025 +0100
3838
# Merge pull request #1056 from lukaszstolarczuk/hwloc-revert-examples-win
39-
set(UMF_TAG 6709535de92933d6bfc1e1d19a324f17afec3877)
39+
set(UMF_TAG 63c5902cc8db77db8d5d28535ef9daae812646f1)
4040
endif()
4141

4242
message(STATUS "Will fetch Unified Memory Framework from ${UMF_REPO}")

test/conformance/usm/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,12 @@ add_conformance_test_with_kernels_environment(usm
1313
urUSMPoolRelease.cpp
1414
urUSMPoolRetain.cpp
1515
urUSMSharedAlloc.cpp)
16+
17+
if(UMF_BUILD_SHARED_LIBRARY)
18+
add_conformance_test_with_kernels_environment(usm_umf
19+
umfIntegration.cpp)
20+
21+
target_link_libraries(test-usm_umf PRIVATE umf::umf)
22+
else()
23+
message(WARNING "UMF build as static library, UMF integration tests will be disabled")
24+
endif()
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Copyright (C) 2025 Intel Corporation
2+
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM
3+
// Exceptions. See LICENSE.TXT
4+
//
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
#include "helpers.h"
7+
#include "uur/utils.h"
8+
#include <uur/fixtures.h>
9+
#include <uur/known_failure.h>
10+
11+
#include <umf.h>
12+
#include <umf/memory_pool.h>
13+
#include <umf/memory_provider.h>
14+
15+
struct umfDeviceAllocTest : uur::urUSMAllocTest {
16+
void SetUp() override {
17+
UUR_RETURN_ON_FATAL_FAILURE(uur::urUSMAllocTest::SetUp());
18+
ASSERT_SUCCESS(uur::GetDeviceUSMDeviceSupport(device, USMSupport));
19+
if (!USMSupport) {
20+
GTEST_SKIP() << "Device USM is not supported.";
21+
}
22+
}
23+
};
24+
25+
// The 0 value parameters are not relevant for umfDeviceAllocTest tests, they
26+
// are used below in urUSMDeviceAllocAlignmentTest for allocation size and
27+
// alignment values
28+
UUR_DEVICE_TEST_SUITE_WITH_PARAM(
29+
umfDeviceAllocTest,
30+
testing::Combine(
31+
testing::ValuesIn(uur::BoolTestParam::makeBoolParam("UsePool")),
32+
testing::Values(0), testing::Values(0),
33+
testing::Values(UR_USM_ADVICE_FLAG_DEFAULT)),
34+
uur::printUSMAllocTestString<umfDeviceAllocTest>);
35+
36+
TEST_P(umfDeviceAllocTest, UMFAllocSuccessfull) {
37+
UUR_KNOWN_FAILURE_ON(uur::NativeCPU{}, uur::CUDA{}, uur::HIP{},
38+
uur::OpenCL{});
39+
40+
void *ptr = nullptr;
41+
size_t allocation_size = sizeof(int);
42+
ASSERT_SUCCESS(
43+
urUSMDeviceAlloc(context, device, nullptr, pool, allocation_size, &ptr));
44+
ASSERT_NE(ptr, nullptr);
45+
46+
auto umfPool = umfPoolByPtr(ptr);
47+
ASSERT_NE(umfPool, nullptr);
48+
49+
umf_memory_provider_handle_t hProvider;
50+
ASSERT_EQ(umfPoolGetMemoryProvider(umfPool, &hProvider), UMF_RESULT_SUCCESS);
51+
ASSERT_NE(hProvider, nullptr);
52+
53+
// make sure that pool can be used for allocations
54+
void *umfPtr = umfPoolMalloc(umfPool, allocation_size);
55+
ASSERT_NE(umfPtr, nullptr);
56+
ASSERT_EQ(umfPoolFree(umfPool, umfPtr), UMF_RESULT_SUCCESS);
57+
58+
ASSERT_SUCCESS(urUSMFree(context, ptr));
59+
}

0 commit comments

Comments
 (0)