diff --git a/source/common/CMakeLists.txt b/source/common/CMakeLists.txt index c04572540c..8b18883213 100644 --- a/source/common/CMakeLists.txt +++ b/source/common/CMakeLists.txt @@ -28,7 +28,7 @@ target_include_directories(ur_common PUBLIC message(STATUS "Download Unified Memory Framework from github.com") if (NOT DEFINED UMF_REPO) - set(UMF_REPO "https://github.com/oneapi-src/unified-memory-framework.git") + set(UMF_REPO "https://github.com/vinser52/unified-memory-framework.git") endif() if (NOT DEFINED UMF_TAG) @@ -36,7 +36,7 @@ if (NOT DEFINED UMF_TAG) # Author: RafaƂ Rudnicki # Date: Mon Jan 27 10:57:57 2025 +0100 # Merge pull request #1056 from lukaszstolarczuk/hwloc-revert-examples-win - set(UMF_TAG 6709535de92933d6bfc1e1d19a324f17afec3877) + set(UMF_TAG 63c5902cc8db77db8d5d28535ef9daae812646f1) endif() message(STATUS "Will fetch Unified Memory Framework from ${UMF_REPO}") diff --git a/test/conformance/usm/CMakeLists.txt b/test/conformance/usm/CMakeLists.txt index f197447cbf..b2a3c63bcc 100644 --- a/test/conformance/usm/CMakeLists.txt +++ b/test/conformance/usm/CMakeLists.txt @@ -13,3 +13,12 @@ add_conformance_test_with_kernels_environment(usm urUSMPoolRelease.cpp urUSMPoolRetain.cpp urUSMSharedAlloc.cpp) + +if(UMF_BUILD_SHARED_LIBRARY) + add_conformance_test_with_kernels_environment(usm_umf + umfIntegration.cpp) + + target_link_libraries(test-usm_umf PRIVATE umf::umf) +else() + message(WARNING "UMF build as static library, UMF integration tests will be disabled") +endif() diff --git a/test/conformance/usm/umfIntegration.cpp b/test/conformance/usm/umfIntegration.cpp new file mode 100644 index 0000000000..12f9b30786 --- /dev/null +++ b/test/conformance/usm/umfIntegration.cpp @@ -0,0 +1,59 @@ +// Copyright (C) 2025 Intel Corporation +// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM +// Exceptions. See LICENSE.TXT +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include "helpers.h" +#include "uur/utils.h" +#include +#include + +#include +#include +#include + +struct umfDeviceAllocTest : uur::urUSMAllocTest { + void SetUp() override { + UUR_RETURN_ON_FATAL_FAILURE(uur::urUSMAllocTest::SetUp()); + ASSERT_SUCCESS(uur::GetDeviceUSMDeviceSupport(device, USMSupport)); + if (!USMSupport) { + GTEST_SKIP() << "Device USM is not supported."; + } + } +}; + +// The 0 value parameters are not relevant for umfDeviceAllocTest tests, they +// are used below in urUSMDeviceAllocAlignmentTest for allocation size and +// alignment values +UUR_DEVICE_TEST_SUITE_WITH_PARAM( + umfDeviceAllocTest, + testing::Combine( + testing::ValuesIn(uur::BoolTestParam::makeBoolParam("UsePool")), + testing::Values(0), testing::Values(0), + testing::Values(UR_USM_ADVICE_FLAG_DEFAULT)), + uur::printUSMAllocTestString); + +TEST_P(umfDeviceAllocTest, UMFAllocSuccessfull) { + UUR_KNOWN_FAILURE_ON(uur::NativeCPU{}, uur::CUDA{}, uur::HIP{}, + uur::OpenCL{}); + + void *ptr = nullptr; + size_t allocation_size = sizeof(int); + ASSERT_SUCCESS( + urUSMDeviceAlloc(context, device, nullptr, pool, allocation_size, &ptr)); + ASSERT_NE(ptr, nullptr); + + auto umfPool = umfPoolByPtr(ptr); + ASSERT_NE(umfPool, nullptr); + + umf_memory_provider_handle_t hProvider; + ASSERT_EQ(umfPoolGetMemoryProvider(umfPool, &hProvider), UMF_RESULT_SUCCESS); + ASSERT_NE(hProvider, nullptr); + + // make sure that pool can be used for allocations + void *umfPtr = umfPoolMalloc(umfPool, allocation_size); + ASSERT_NE(umfPtr, nullptr); + ASSERT_EQ(umfPoolFree(umfPool, umfPtr), UMF_RESULT_SUCCESS); + + ASSERT_SUCCESS(urUSMFree(context, ptr)); +}