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