Store indirect residency at command queue level

Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>

Related-To: NEO-7211
This commit is contained in:
Maciej Plewka
2022-09-14 09:39:13 +00:00
committed by Compute-Runtime-Automation
parent fc9352cfcb
commit ffad5c6c09
18 changed files with 336 additions and 114 deletions

View File

@@ -11,6 +11,7 @@ namespace NEO {
struct MockSVMAllocsManager : public SVMAllocsManager {
public:
using SVMAllocsManager::memoryManager;
using SVMAllocsManager::mtx;
using SVMAllocsManager::multiOsContextSupport;
using SVMAllocsManager::SVMAllocs;
using SVMAllocsManager::SVMAllocsManager;

View File

@@ -27,6 +27,7 @@ target_sources(neo_shared_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/storage_info_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/surface_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/unified_memory_manager_cache_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/unified_memory_manager_tests.cpp
)
add_subdirectories()

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/mocks/mock_svm_manager.h"
#include "shared/test/common/mocks/ult_device_factory.h"
#include "shared/test/common/test_macros/test.h"
#include "gtest/gtest.h"
using namespace NEO;
TEST(SvmDeviceAllocationTest, givenGivenSvmAllocsManagerWhenObtainOwnershipCalledThenLockedUniqueLockReturned) {
std::unique_ptr<UltDeviceFactory> deviceFactory(new UltDeviceFactory(1, 1));
auto device = deviceFactory->rootDevices[0];
auto svmManager = std::make_unique<MockSVMAllocsManager>(device->getMemoryManager(), false);
auto lock = svmManager->obtainOwnership();
std::thread th1([&] {
EXPECT_FALSE(svmManager->mtx.try_lock());
});
th1.join();
lock.unlock();
std::thread th2([&] {
EXPECT_TRUE(svmManager->mtx.try_lock());
svmManager->mtx.unlock();
});
th2.join();
}