Files
compute-runtime/shared/test/common/fixtures/device_fixture.cpp
Warchulski, Jaroslaw c275008e51 Cleanup includes 32
Cleaned up files:
level_zero/core/source/cmdlist/cmdlist_hw.h
level_zero/core/source/cmdqueue/cmdqueue.h
level_zero/core/source/event/event.h
opencl/source/helpers/get_info_status_mapper.h
opencl/source/helpers/hardware_commands_helper.h
shared/source/helpers/per_thread_data.h

Related-To: NEO-5548
Signed-off-by: Warchulski, Jaroslaw <jaroslaw.warchulski@intel.com>
2023-01-16 20:41:37 +01:00

53 lines
1.6 KiB
C++

/*
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/source/built_ins/sip.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/test/common/mocks/mock_device.h"
#include "gtest/gtest.h"
namespace NEO {
void DeviceFixture::setUp() {
hardwareInfo = *defaultHwInfo;
setUpImpl(&hardwareInfo);
}
void DeviceFixture::setUpImpl(const NEO::HardwareInfo *hardwareInfo) {
pDevice = MockDevice::createWithNewExecutionEnvironment<MockDevice>(hardwareInfo, rootDeviceIndex);
ASSERT_NE(nullptr, pDevice);
auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver();
pTagMemory = commandStreamReceiver.getTagAddress();
ASSERT_NE(nullptr, const_cast<TagAddressType *>(pTagMemory));
}
void DeviceFixture::tearDown() {
delete pDevice;
pDevice = nullptr;
}
MockDevice *DeviceFixture::createWithUsDeviceIdRevId(unsigned short usDeviceId, unsigned short usRevId) {
hardwareInfo = *defaultHwInfo;
hardwareInfo.platform.usDeviceID = usDeviceId;
hardwareInfo.platform.usRevId = usRevId;
return MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hardwareInfo);
}
template <typename HelperType>
HelperType &DeviceFixture::getHelper() const {
auto &helper = this->pDevice->getRootDeviceEnvironment().getHelper<HelperType>();
return helper;
}
template ProductHelper &DeviceFixture::getHelper<ProductHelper>() const;
template GfxCoreHelper &DeviceFixture::getHelper<GfxCoreHelper>() const;
} // namespace NEO