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
4 changes: 2 additions & 2 deletions source/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ 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)
# commit 6709535de92933d6bfc1e1d19a324f17afec3877
# Author: Rafał Rudnicki <[email protected]>
# 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}")
Expand Down
9 changes: 9 additions & 0 deletions test/conformance/usm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
59 changes: 59 additions & 0 deletions test/conformance/usm/umfIntegration.cpp
Original file line number Diff line number Diff line change
@@ -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 <uur/fixtures.h>
#include <uur/known_failure.h>

#include <umf.h>
#include <umf/memory_pool.h>
#include <umf/memory_provider.h>

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<umfDeviceAllocTest>);

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));
}