mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00

Unlock flow for multi device setup in: - enqueueCopyBufferRect - enqueueReadBufferRect - enqueueWriteBufferRect Related-To: NEO-4589 Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
46 lines
1.7 KiB
C++
46 lines
1.7 KiB
C++
/*
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
#include "shared/source/os_interface/device_factory.h"
|
|
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
|
|
#include "shared/test/unit_test/helpers/variable_backup.h"
|
|
#include "shared/test/unit_test/mocks/mock_device.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
|
#include "opencl/test/unit_test/mocks/mock_context.h"
|
|
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
|
|
|
|
namespace NEO {
|
|
class MultiRootDeviceFixture : public ::testing::Test {
|
|
public:
|
|
void SetUp() override {
|
|
createMemoryManagerFuncBackup = [](ExecutionEnvironment &executionEnvironment) -> void {
|
|
executionEnvironment.memoryManager = std::make_unique<MockMemoryManager>(executionEnvironment);
|
|
};
|
|
|
|
deviceFactory = std::make_unique<UltClDeviceFactory>(3, 0);
|
|
device1 = deviceFactory->rootDevices[1];
|
|
device2 = deviceFactory->rootDevices[2];
|
|
|
|
cl_device_id devices[] = {device1, device2};
|
|
|
|
context.reset(new MockContext(ClDeviceVector(devices, 2), false));
|
|
mockMemoryManager = static_cast<MockMemoryManager *>(device1->getMemoryManager());
|
|
ASSERT_EQ(mockMemoryManager, device1->getMemoryManager());
|
|
}
|
|
|
|
const uint32_t expectedRootDeviceIndex = 1;
|
|
std::unique_ptr<UltClDeviceFactory> deviceFactory;
|
|
MockClDevice *device1 = nullptr;
|
|
MockClDevice *device2 = nullptr;
|
|
std::unique_ptr<MockContext> context;
|
|
MockMemoryManager *mockMemoryManager;
|
|
VariableBackup<decltype(DeviceFactory::createMemoryManagerFunc)> createMemoryManagerFuncBackup{&DeviceFactory::createMemoryManagerFunc};
|
|
};
|
|
}; // namespace NEO
|