2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2022-06-28 16:27:56 +00:00
|
|
|
* Copyright (C) 2020-2022 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-05-28 14:05:12 +02:00
|
|
|
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
2021-04-16 12:52:30 +00:00
|
|
|
|
|
|
|
#include "shared/source/built_ins/sip.h"
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2019-02-27 11:39:32 +01:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2022-08-16 14:51:17 +00:00
|
|
|
void ClDeviceFixture::setUp() {
|
2020-03-24 11:42:54 +01:00
|
|
|
hardwareInfo = *defaultHwInfo;
|
2022-06-28 16:27:56 +00:00
|
|
|
setUpImpl(&hardwareInfo);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
2022-06-28 16:27:56 +00:00
|
|
|
void ClDeviceFixture::setUpImpl(const NEO::HardwareInfo *hardwareInfo) {
|
2021-10-15 12:02:31 +00:00
|
|
|
pDevice = MockClDevice::createWithNewExecutionEnvironment<MockDevice>(hardwareInfo, rootDeviceIndex);
|
2017-12-21 00:45:38 +01:00
|
|
|
ASSERT_NE(nullptr, pDevice);
|
2021-10-15 12:02:31 +00:00
|
|
|
pClExecutionEnvironment = static_cast<MockClExecutionEnvironment *>(pDevice->getExecutionEnvironment());
|
2020-01-14 14:32:11 +01:00
|
|
|
pClDevice = new MockClDevice{pDevice};
|
|
|
|
ASSERT_NE(nullptr, pClDevice);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2019-07-15 14:28:09 +02:00
|
|
|
auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver();
|
2017-12-21 00:45:38 +01:00
|
|
|
pTagMemory = commandStreamReceiver.getTagAddress();
|
|
|
|
ASSERT_NE(nullptr, const_cast<uint32_t *>(pTagMemory));
|
2021-05-19 21:41:59 +00:00
|
|
|
this->osContext = pDevice->getDefaultEngine().osContext;
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
2022-08-16 14:51:17 +00:00
|
|
|
void ClDeviceFixture::tearDown() {
|
2020-01-14 14:32:11 +01:00
|
|
|
delete pClDevice;
|
|
|
|
pClDevice = nullptr;
|
2019-02-04 13:08:47 +01:00
|
|
|
pDevice = nullptr;
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
2020-05-28 14:05:12 +02:00
|
|
|
MockDevice *ClDeviceFixture::createWithUsDeviceId(unsigned short usDeviceId) {
|
2020-03-24 11:42:54 +01:00
|
|
|
hardwareInfo = *defaultHwInfo;
|
2019-05-08 16:00:24 +02:00
|
|
|
hardwareInfo.platform.usDeviceID = usDeviceId;
|
2020-10-08 11:36:31 +02:00
|
|
|
return MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hardwareInfo, rootDeviceIndex);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|