Files
compute-runtime/opencl/test/unit_test/mocks/mock_cl_device.cpp
Kamil Diedrich ad579be87c Use common definition of UUID for Intel GPUs
This patch will eventaully allow matching UUIDs queried
from NEO with UUIDs queried from other GPU APIs implementations
for Intel GPUs

Signed-off-by: Kamil Diedrich <kamil.diedrich@intel.com>
2023-01-11 16:31:05 +01:00

47 lines
1.9 KiB
C++

/*
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "shared/test/common/mocks/mock_device.h"
#include "opencl/test/unit_test/mocks/mock_cl_execution_environment.h"
#include "opencl/test/unit_test/mocks/mock_platform.h"
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),
executionEnvironment(pMockDevice->executionEnvironment), allEngines(pMockDevice->allEngines) {
}
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;
}
bool MockClDevice::areOcl21FeaturesSupported() const {
return device.getHardwareInfo().capabilityTable.supportsOcl21Features;
}
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;
}