2020-03-18 20:08:45 +08:00
|
|
|
/*
|
2023-01-09 19:05:21 +08:00
|
|
|
* Copyright (C) 2020-2023 Intel Corporation
|
2020-03-18 20:08:45 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
|
|
|
|
2021-01-21 20:10:13 +08:00
|
|
|
#include "shared/test/common/mocks/mock_device.h"
|
2020-04-02 15:35:50 +08:00
|
|
|
|
2023-01-09 19:05:21 +08:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_cl_execution_environment.h"
|
2021-07-09 21:06:20 +08:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
|
|
|
|
2020-03-18 20:08:45 +08:00
|
|
|
using namespace NEO;
|
|
|
|
|
|
|
|
bool &MockClDevice::createSingleDevice = MockDevice::createSingleDevice;
|
|
|
|
|
|
|
|
decltype(&createCommandStream) &MockClDevice::createCommandStreamReceiverFunc = MockDevice::createCommandStreamReceiverFunc;
|
|
|
|
|
|
|
|
MockClDevice::MockClDevice(MockDevice *pMockDevice)
|
|
|
|
: ClDevice(*pMockDevice, platform()), device(*pMockDevice), sharedDeviceInfo(device.deviceInfo),
|
2021-12-13 20:45:24 +08:00
|
|
|
executionEnvironment(pMockDevice->executionEnvironment), allEngines(pMockDevice->allEngines) {
|
2020-03-18 20:08:45 +08:00
|
|
|
}
|
2020-05-05 22:40:31 +08:00
|
|
|
|
2023-01-09 19:05:21 +08:00
|
|
|
ExecutionEnvironment *MockClDevice::prepareExecutionEnvironment(const HardwareInfo *pHwInfo, uint32_t rootDeviceIndex) {
|
|
|
|
auto executionEnvironment = new MockClExecutionEnvironment();
|
|
|
|
auto numRootDevices = DebugManager.flags.CreateMultipleRootDevices.get() ? DebugManager.flags.CreateMultipleRootDevices.get() : rootDeviceIndex + 1;
|
|
|
|
executionEnvironment->prepareRootDeviceEnvironments(numRootDevices);
|
|
|
|
pHwInfo = pHwInfo ? pHwInfo : defaultHwInfo.get();
|
|
|
|
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
|
|
|
|
executionEnvironment->rootDeviceEnvironments[i]->setHwInfoAndInitHelpers(pHwInfo);
|
|
|
|
executionEnvironment->rootDeviceEnvironments[i]->initGmm();
|
|
|
|
}
|
|
|
|
executionEnvironment->calculateMaxOsContextCount();
|
|
|
|
return executionEnvironment;
|
|
|
|
}
|
|
|
|
|
2020-05-05 22:40:31 +08:00
|
|
|
bool MockClDevice::areOcl21FeaturesSupported() const {
|
|
|
|
return device.getHardwareInfo().capabilityTable.supportsOcl21Features;
|
|
|
|
}
|
2023-01-05 22:01:17 +08:00
|
|
|
|
|
|
|
void MockClDevice::setPciUuid(std::array<uint8_t, ProductHelper::uuidSize> &id) {
|
|
|
|
memcpy_s(device.uuid.id.data(), ProductHelper::uuidSize, id.data(), ProductHelper::uuidSize);
|
|
|
|
device.uuid.isValid = true;
|
|
|
|
}
|