Cleanup includes in shared
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
8605f06435
commit
44112f8d94
|
@ -1244,8 +1244,8 @@ HWTEST_F(HwHelperTest, whenGettingNumberOfCacheRegionsThenReturnZero) {
|
|||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, whenCheckingForSmallKernelPreferenceThenFalseIsReturned) {
|
||||
auto &hwHelper = HwHelper::get(renderCoreFamily);
|
||||
EXPECT_FALSE(hwHelper.preferSmallWorkgroupSizeForKernel(0u, this->pClDevice->getHardwareInfo()));
|
||||
EXPECT_FALSE(hwHelper.preferSmallWorkgroupSizeForKernel(20000u, this->pClDevice->getHardwareInfo()));
|
||||
EXPECT_FALSE(hwHelper.preferSmallWorkgroupSizeForKernel(0u, this->pDevice->getHardwareInfo()));
|
||||
EXPECT_FALSE(hwHelper.preferSmallWorkgroupSizeForKernel(20000u, this->pDevice->getHardwareInfo()));
|
||||
}
|
||||
|
||||
TEST_F(HwHelperTest, givenGenHelperWhenKernelArgumentIsNotPureStatefulThenRequireNonAuxMode) {
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using HwHelperTest = Test<ClDeviceFixture>;
|
||||
using HwHelperTest = Test<DeviceFixture>;
|
||||
|
||||
struct ComputeSlmTestInput {
|
||||
uint32_t expected;
|
||||
|
|
|
@ -16,12 +16,13 @@
|
|||
|
||||
#include "opencl/source/command_queue/gpgpu_walker.h"
|
||||
#include "opencl/source/helpers/hardware_commands_helper.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
|
||||
|
||||
#include "engine_node.h"
|
||||
#include "pipe_control_args.h"
|
||||
|
||||
using HwHelperTestXeHPAndLater = HwHelperTest;
|
||||
using HwHelperTestXeHPAndLater = Test<ClDeviceFixture>;
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, HwHelperTestXeHPAndLater, WhenGettingMaxBarriersPerSliceThen32IsReturned) {
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
|
|
|
@ -89,20 +89,22 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, PreemptionWatermarkXeHPAndLater, givenPreambleThenP
|
|||
EXPECT_EQ(expectedSize, PreambleHelper<FamilyType>::getAdditionalCommandsSize(mockDevice));
|
||||
}
|
||||
|
||||
struct KernelCommandsXeHPAndLater : public PreambleVfeState,
|
||||
public ClDeviceFixture {
|
||||
struct KernelCommandsXeHPAndLater : public PreambleVfeState {
|
||||
void SetUp() override {
|
||||
PreambleVfeState::SetUp();
|
||||
ClDeviceFixture::SetUp();
|
||||
pDevice->incRefInternal();
|
||||
pClDevice = new MockClDevice{pDevice};
|
||||
ASSERT_NE(nullptr, pClDevice);
|
||||
|
||||
program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
ClDeviceFixture::TearDown();
|
||||
pClDevice->decRefInternal();
|
||||
PreambleVfeState::TearDown();
|
||||
}
|
||||
|
||||
MockClDevice *pClDevice = nullptr;
|
||||
std::unique_ptr<MockProgram> program;
|
||||
KernelInfo kernelInfo;
|
||||
};
|
||||
|
|
|
@ -12,11 +12,10 @@
|
|||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "patch_g7.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
|
@ -29,8 +28,8 @@ void DevicePreemptionTests::SetUp() {
|
|||
}
|
||||
|
||||
device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
executionEnvironment.reset(new SPatchExecutionEnvironment);
|
||||
memset(executionEnvironment.get(), 0, sizeof(SPatchExecutionEnvironment));
|
||||
executionEnvironment.reset(new iOpenCL::SPatchExecutionEnvironment);
|
||||
memset(executionEnvironment.get(), 0, sizeof(iOpenCL::SPatchExecutionEnvironment));
|
||||
|
||||
ASSERT_NE(nullptr, device);
|
||||
|
||||
|
|
|
@ -59,9 +59,9 @@ GEN11TEST_F(Gen11PreambleVfeState, GivenWaOffWhenProgrammingVfeStateThenProgramm
|
|||
typedef typename ICLFamily::PIPE_CONTROL PIPE_CONTROL;
|
||||
testWaTable->waSendMIFLUSHBeforeVFE = 0;
|
||||
LinearStream &cs = linearStream;
|
||||
auto pVfeCmd = PreambleHelper<ICLFamily>::getSpaceForVfeState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), EngineGroupType::RenderCompute);
|
||||
auto pVfeCmd = PreambleHelper<ICLFamily>::getSpaceForVfeState(&linearStream, pDevice->getHardwareInfo(), EngineGroupType::RenderCompute);
|
||||
StreamProperties emptyProperties{};
|
||||
PreambleHelper<ICLFamily>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 168u, emptyProperties);
|
||||
PreambleHelper<ICLFamily>::programVfeState(pVfeCmd, pDevice->getHardwareInfo(), 0u, 0, 168u, emptyProperties);
|
||||
|
||||
parseCommands<ICLFamily>(cs);
|
||||
|
||||
|
@ -79,9 +79,9 @@ GEN11TEST_F(Gen11PreambleVfeState, GivenWaOnWhenProgrammingVfeStateThenProgrammi
|
|||
typedef typename ICLFamily::PIPE_CONTROL PIPE_CONTROL;
|
||||
testWaTable->waSendMIFLUSHBeforeVFE = 1;
|
||||
LinearStream &cs = linearStream;
|
||||
auto pVfeCmd = PreambleHelper<ICLFamily>::getSpaceForVfeState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), EngineGroupType::RenderCompute);
|
||||
auto pVfeCmd = PreambleHelper<ICLFamily>::getSpaceForVfeState(&linearStream, pDevice->getHardwareInfo(), EngineGroupType::RenderCompute);
|
||||
StreamProperties emptyProperties{};
|
||||
PreambleHelper<ICLFamily>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 168u, emptyProperties);
|
||||
PreambleHelper<ICLFamily>::programVfeState(pVfeCmd, pDevice->getHardwareInfo(), 0u, 0, 168u, emptyProperties);
|
||||
|
||||
parseCommands<ICLFamily>(cs);
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
|
||||
#include "opencl/source/helpers/hardware_commands_helper.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
|
||||
#include "opencl/source/helpers/hardware_commands_helper.h"
|
||||
#include "test.h"
|
||||
using namespace NEO;
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
|
||||
#include "opencl/source/helpers/hardware_commands_helper.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
|
|
@ -63,9 +63,9 @@ HWTEST2_F(Gen12LpPreambleVfeState, GivenWaOffWhenProgrammingVfeStateThenProgramm
|
|||
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
|
||||
testWaTable->waSendMIFLUSHBeforeVFE = 0;
|
||||
LinearStream &cs = linearStream;
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), EngineGroupType::RenderCompute);
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, pDevice->getHardwareInfo(), EngineGroupType::RenderCompute);
|
||||
StreamProperties emptyProperties{};
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 672u, emptyProperties);
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pDevice->getHardwareInfo(), 0u, 0, 672u, emptyProperties);
|
||||
|
||||
parseCommands<FamilyType>(cs);
|
||||
|
||||
|
@ -85,9 +85,9 @@ HWTEST2_F(Gen12LpPreambleVfeState, givenCcsEngineWhenWaIsSetThenAppropriatePipeC
|
|||
testWaTable->waSendMIFLUSHBeforeVFE = 1;
|
||||
LinearStream &cs = linearStream;
|
||||
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), EngineGroupType::Compute);
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, pDevice->getHardwareInfo(), EngineGroupType::Compute);
|
||||
StreamProperties emptyProperties{};
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 672u, emptyProperties);
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pDevice->getHardwareInfo(), 0u, 0, 672u, emptyProperties);
|
||||
|
||||
parseCommands<FamilyType>(cs);
|
||||
|
||||
|
@ -106,9 +106,9 @@ HWTEST2_F(Gen12LpPreambleVfeState, givenRcsEngineWhenWaIsSetThenAppropriatePipeC
|
|||
testWaTable->waSendMIFLUSHBeforeVFE = 1;
|
||||
LinearStream &cs = linearStream;
|
||||
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), EngineGroupType::RenderCompute);
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, pDevice->getHardwareInfo(), EngineGroupType::RenderCompute);
|
||||
StreamProperties emptyProperties{};
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 672u, emptyProperties);
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pDevice->getHardwareInfo(), 0u, 0, 672u, emptyProperties);
|
||||
|
||||
parseCommands<FamilyType>(cs);
|
||||
|
||||
|
@ -136,7 +136,7 @@ HWTEST2_F(Gen12LpPreambleVfeState, givenCfeFusedEuDispatchFlagsWhenprogramAdditi
|
|||
using MEDIA_VFE_STATE = typename FamilyType::MEDIA_VFE_STATE;
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
auto pHwInfo = pPlatform->getClDevice(0)->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
auto pHwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
auto pMediaVfeState = reinterpret_cast<MEDIA_VFE_STATE *>(linearStream.getSpace(sizeof(MEDIA_VFE_STATE)));
|
||||
*pMediaVfeState = FamilyType::cmdInitMediaVfeState;
|
||||
auto &waTable = pHwInfo->workaroundTable;
|
||||
|
@ -162,7 +162,7 @@ HWTEST2_F(Gen12LpPreambleVfeState, givenMaxNumberOfDssDebugVariableWhenMediaVfeS
|
|||
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.MediaVfeStateMaxSubSlices.set(2);
|
||||
auto pHwInfo = pPlatform->getClDevice(0)->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
auto pHwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
auto pMediaVfeState = reinterpret_cast<MEDIA_VFE_STATE *>(linearStream.getSpace(sizeof(MEDIA_VFE_STATE)));
|
||||
*pMediaVfeState = FamilyType::cmdInitMediaVfeState;
|
||||
PreambleHelper<FamilyType>::programAdditionalFieldsInVfeState(pMediaVfeState, *pHwInfo);
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#include "shared/source/helpers/preamble.h"
|
||||
#include "shared/test/unit_test/preamble/preamble_fixture.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/platform_fixture.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
typedef PreambleFixture BdwSlm;
|
||||
|
|
|
@ -120,9 +120,9 @@ GEN9TEST_F(PreambleVfeState, GivenWaOffWhenProgrammingVfeStateThenProgrammingIsC
|
|||
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
|
||||
testWaTable->waSendMIFLUSHBeforeVFE = 0;
|
||||
LinearStream &cs = linearStream;
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), EngineGroupType::RenderCompute);
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, pDevice->getHardwareInfo(), EngineGroupType::RenderCompute);
|
||||
StreamProperties emptyProperties{};
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 168u, emptyProperties);
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pDevice->getHardwareInfo(), 0u, 0, 168u, emptyProperties);
|
||||
|
||||
parseCommands<FamilyType>(cs);
|
||||
|
||||
|
@ -140,9 +140,9 @@ GEN9TEST_F(PreambleVfeState, GivenWaOnWhenProgrammingVfeStateThenProgrammingIsCo
|
|||
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
|
||||
testWaTable->waSendMIFLUSHBeforeVFE = 1;
|
||||
LinearStream &cs = linearStream;
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), EngineGroupType::RenderCompute);
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, pDevice->getHardwareInfo(), EngineGroupType::RenderCompute);
|
||||
StreamProperties emptyProperties{};
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 168u, emptyProperties);
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pDevice->getHardwareInfo(), 0u, 0, 168u, emptyProperties);
|
||||
|
||||
parseCommands<FamilyType>(cs);
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
|
||||
#include "opencl/source/kernel/kernel.h"
|
||||
#include "shared/source/kernel/kernel_descriptor.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "shared/test/common/test_macros/matchers.h"
|
||||
#include "shared/test/unit_test/device_binary_format/patchtokens_tests.h"
|
||||
|
||||
#include "opencl/source/helpers/hardware_commands_helper.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "hw_cmds.h"
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_dispatch_kernel_encoder_interface.h"
|
||||
|
||||
#include "opencl/source/helpers/hardware_commands_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_event.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "hw_cmds.h"
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "shared/test/common/mocks/mock_gmm_client_context.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_resource_info.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_hw_helper.h"
|
||||
#include "test.h"
|
||||
|
||||
extern PRODUCT_FAMILY productFamily;
|
||||
|
|
|
@ -8,30 +8,29 @@
|
|||
#pragma once
|
||||
#include "shared/source/helpers/preamble.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
|
||||
#include "opencl/test/unit_test/command_stream/linear_stream_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/platform_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct PreambleFixture : public ClDeviceFixture,
|
||||
struct PreambleFixture : public DeviceFixture,
|
||||
public LinearStreamFixture,
|
||||
public HardwareParse,
|
||||
public ::testing::Test {
|
||||
void SetUp() override {
|
||||
ClDeviceFixture::SetUp();
|
||||
DeviceFixture::SetUp();
|
||||
HardwareParse::SetUp();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
HardwareParse::TearDown();
|
||||
ClDeviceFixture::TearDown();
|
||||
DeviceFixture::TearDown();
|
||||
}
|
||||
};
|
||||
|
||||
class PreambleVfeState : public PlatformFixture,
|
||||
class PreambleVfeState : public DeviceFixture,
|
||||
public ::testing::Test,
|
||||
public LinearStreamFixture,
|
||||
public HardwareParse {
|
||||
|
@ -40,11 +39,11 @@ class PreambleVfeState : public PlatformFixture,
|
|||
::testing::Test::SetUp();
|
||||
LinearStreamFixture::SetUp();
|
||||
HardwareParse::SetUp();
|
||||
PlatformFixture::SetUp();
|
||||
testWaTable = &pPlatform->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getMutableHardwareInfo()->workaroundTable;
|
||||
DeviceFixture::SetUp();
|
||||
testWaTable = &pDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->getMutableHardwareInfo()->workaroundTable;
|
||||
}
|
||||
void TearDown() override {
|
||||
PlatformFixture::TearDown();
|
||||
DeviceFixture::TearDown();
|
||||
HardwareParse::TearDown();
|
||||
LinearStreamFixture::TearDown();
|
||||
::testing::Test::TearDown();
|
||||
|
|
|
@ -15,10 +15,7 @@
|
|||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
|
||||
#include "opencl/source/command_queue/command_queue_hw.h"
|
||||
#include "opencl/source/helpers/dispatch_info.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_builtins.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
|
||||
|
|
|
@ -12,9 +12,6 @@
|
|||
#include "shared/test/common/mocks/mock_debugger.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
||||
|
||||
#include "test_traits_common.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
#include "shared/source/program/kernel_info.h"
|
||||
#include "shared/source/program/program_info.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||
#include "shared/test/unit_test/compiler_interface/linker_mock.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
@ -24,9 +22,8 @@
|
|||
using namespace NEO;
|
||||
|
||||
TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreNotExportedThenMemoryIsAllocatedAsNonSvmAllocation) {
|
||||
auto &device = *(new MockDevice);
|
||||
MockDevice device{};
|
||||
REQUIRE_SVM_OR_SKIP(&device);
|
||||
MockClDevice clDevice{&device};
|
||||
MockSVMAllocsManager svmAllocsManager(device.getMemoryManager(), false);
|
||||
WhiteBox<LinkerInput> emptyLinkerInput;
|
||||
std::vector<uint8_t> initData;
|
||||
|
@ -67,9 +64,8 @@ TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreNotExportedTh
|
|||
}
|
||||
|
||||
TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreExportedThenMemoryIsAllocatedAsSvmAllocation) {
|
||||
auto &device = *(new MockDevice);
|
||||
MockDevice device{};
|
||||
REQUIRE_SVM_OR_SKIP(&device);
|
||||
MockClDevice clDevice{&device};
|
||||
MockMemoryManager memoryManager;
|
||||
MockSVMAllocsManager svmAllocsManager(&memoryManager, false);
|
||||
WhiteBox<LinkerInput> linkerInputExportGlobalVariables;
|
||||
|
@ -112,8 +108,7 @@ TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreExportedThenM
|
|||
}
|
||||
|
||||
TEST(AllocateGlobalSurfaceTest, GivenNullSvmAllocsManagerWhenGlobalsAreExportedThenMemoryIsAllocatedAsNonSvmAllocation) {
|
||||
auto pDevice = new MockDevice{};
|
||||
MockClDevice clDevice{pDevice};
|
||||
MockDevice device{};
|
||||
WhiteBox<LinkerInput> linkerInputExportGlobalVariables;
|
||||
WhiteBox<LinkerInput> linkerInputExportGlobalConstants;
|
||||
linkerInputExportGlobalVariables.traits.exportsGlobalVariables = true;
|
||||
|
@ -122,76 +117,74 @@ TEST(AllocateGlobalSurfaceTest, GivenNullSvmAllocsManagerWhenGlobalsAreExportedT
|
|||
initData.resize(64, 7U);
|
||||
GraphicsAllocation *alloc = nullptr;
|
||||
|
||||
alloc = allocateGlobalsSurface(nullptr, *pDevice, initData.size(), true /* constant */, &linkerInputExportGlobalConstants, initData.data());
|
||||
alloc = allocateGlobalsSurface(nullptr, device, initData.size(), true /* constant */, &linkerInputExportGlobalConstants, initData.data());
|
||||
ASSERT_NE(nullptr, alloc);
|
||||
ASSERT_EQ(initData.size(), alloc->getUnderlyingBufferSize());
|
||||
EXPECT_EQ(0, memcmp(alloc->getUnderlyingBuffer(), initData.data(), initData.size()));
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::CONSTANT_SURFACE, alloc->getAllocationType());
|
||||
pDevice->getMemoryManager()->freeGraphicsMemory(alloc);
|
||||
device.getMemoryManager()->freeGraphicsMemory(alloc);
|
||||
|
||||
alloc = allocateGlobalsSurface(nullptr, *pDevice, initData.size(), true /* constant */, &linkerInputExportGlobalVariables, initData.data());
|
||||
alloc = allocateGlobalsSurface(nullptr, device, initData.size(), true /* constant */, &linkerInputExportGlobalVariables, initData.data());
|
||||
ASSERT_NE(nullptr, alloc);
|
||||
ASSERT_EQ(initData.size(), alloc->getUnderlyingBufferSize());
|
||||
EXPECT_EQ(0, memcmp(alloc->getUnderlyingBuffer(), initData.data(), initData.size()));
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::CONSTANT_SURFACE, alloc->getAllocationType());
|
||||
pDevice->getMemoryManager()->freeGraphicsMemory(alloc);
|
||||
device.getMemoryManager()->freeGraphicsMemory(alloc);
|
||||
|
||||
alloc = allocateGlobalsSurface(nullptr, *pDevice, initData.size(), false /* constant */, &linkerInputExportGlobalConstants, initData.data());
|
||||
alloc = allocateGlobalsSurface(nullptr, device, initData.size(), false /* constant */, &linkerInputExportGlobalConstants, initData.data());
|
||||
ASSERT_NE(nullptr, alloc);
|
||||
ASSERT_EQ(initData.size(), alloc->getUnderlyingBufferSize());
|
||||
EXPECT_EQ(0, memcmp(alloc->getUnderlyingBuffer(), initData.data(), initData.size()));
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::GLOBAL_SURFACE, alloc->getAllocationType());
|
||||
pDevice->getMemoryManager()->freeGraphicsMemory(alloc);
|
||||
device.getMemoryManager()->freeGraphicsMemory(alloc);
|
||||
|
||||
alloc = allocateGlobalsSurface(nullptr, *pDevice, initData.size(), false /* constant */, &linkerInputExportGlobalVariables, initData.data());
|
||||
alloc = allocateGlobalsSurface(nullptr, device, initData.size(), false /* constant */, &linkerInputExportGlobalVariables, initData.data());
|
||||
ASSERT_NE(nullptr, alloc);
|
||||
ASSERT_EQ(initData.size(), alloc->getUnderlyingBufferSize());
|
||||
EXPECT_EQ(0, memcmp(alloc->getUnderlyingBuffer(), initData.data(), initData.size()));
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::GLOBAL_SURFACE, alloc->getAllocationType());
|
||||
pDevice->getMemoryManager()->freeGraphicsMemory(alloc);
|
||||
device.getMemoryManager()->freeGraphicsMemory(alloc);
|
||||
}
|
||||
|
||||
TEST(AllocateGlobalSurfaceTest, WhenGlobalsAreNotExportedAndAllocationFailsThenGracefullyReturnsNullptr) {
|
||||
auto pDevice = new MockDevice{};
|
||||
MockClDevice clDevice{pDevice};
|
||||
auto memoryManager = std::make_unique<MockMemoryManager>(*clDevice.getExecutionEnvironment());
|
||||
MockDevice device{};
|
||||
auto memoryManager = std::make_unique<MockMemoryManager>(*device.getExecutionEnvironment());
|
||||
memoryManager->failInAllocateWithSizeAndAlignment = true;
|
||||
clDevice.injectMemoryManager(memoryManager.release());
|
||||
MockSVMAllocsManager mockSvmAllocsManager(clDevice.getMemoryManager(), false);
|
||||
device.injectMemoryManager(memoryManager.release());
|
||||
MockSVMAllocsManager mockSvmAllocsManager(device.getMemoryManager(), false);
|
||||
WhiteBox<LinkerInput> emptyLinkerInput;
|
||||
std::vector<uint8_t> initData;
|
||||
initData.resize(64, 7U);
|
||||
GraphicsAllocation *alloc = nullptr;
|
||||
|
||||
alloc = allocateGlobalsSurface(&mockSvmAllocsManager, *pDevice, initData.size(), true /* constant */, nullptr /* linker input */, initData.data());
|
||||
alloc = allocateGlobalsSurface(&mockSvmAllocsManager, device, initData.size(), true /* constant */, nullptr /* linker input */, initData.data());
|
||||
EXPECT_EQ(nullptr, alloc);
|
||||
|
||||
alloc = allocateGlobalsSurface(&mockSvmAllocsManager, *pDevice, initData.size(), false /* constant */, nullptr /* linker input */, initData.data());
|
||||
alloc = allocateGlobalsSurface(&mockSvmAllocsManager, device, initData.size(), false /* constant */, nullptr /* linker input */, initData.data());
|
||||
EXPECT_EQ(nullptr, alloc);
|
||||
|
||||
alloc = allocateGlobalsSurface(&mockSvmAllocsManager, *pDevice, initData.size(), true /* constant */, &emptyLinkerInput, initData.data());
|
||||
alloc = allocateGlobalsSurface(&mockSvmAllocsManager, device, initData.size(), true /* constant */, &emptyLinkerInput, initData.data());
|
||||
EXPECT_EQ(nullptr, alloc);
|
||||
|
||||
alloc = allocateGlobalsSurface(&mockSvmAllocsManager, *pDevice, initData.size(), false /* constant */, &emptyLinkerInput, initData.data());
|
||||
alloc = allocateGlobalsSurface(&mockSvmAllocsManager, device, initData.size(), false /* constant */, &emptyLinkerInput, initData.data());
|
||||
EXPECT_EQ(nullptr, alloc);
|
||||
|
||||
alloc = allocateGlobalsSurface(nullptr /* svmAllocsManager */, *pDevice, initData.size(), true /* constant */, nullptr /* linker input */, initData.data());
|
||||
alloc = allocateGlobalsSurface(nullptr /* svmAllocsManager */, device, initData.size(), true /* constant */, nullptr /* linker input */, initData.data());
|
||||
EXPECT_EQ(nullptr, alloc);
|
||||
|
||||
alloc = allocateGlobalsSurface(nullptr /* svmAllocsManager */, *pDevice, initData.size(), false /* constant */, nullptr /* linker input */, initData.data());
|
||||
alloc = allocateGlobalsSurface(nullptr /* svmAllocsManager */, device, initData.size(), false /* constant */, nullptr /* linker input */, initData.data());
|
||||
EXPECT_EQ(nullptr, alloc);
|
||||
|
||||
alloc = allocateGlobalsSurface(nullptr /* svmAllocsManager */, *pDevice, initData.size(), true /* constant */, &emptyLinkerInput, initData.data());
|
||||
alloc = allocateGlobalsSurface(nullptr /* svmAllocsManager */, device, initData.size(), true /* constant */, &emptyLinkerInput, initData.data());
|
||||
EXPECT_EQ(nullptr, alloc);
|
||||
|
||||
alloc = allocateGlobalsSurface(nullptr /* svmAllocsManager */, *pDevice, initData.size(), false /* constant */, &emptyLinkerInput, initData.data());
|
||||
alloc = allocateGlobalsSurface(nullptr /* svmAllocsManager */, device, initData.size(), false /* constant */, &emptyLinkerInput, initData.data());
|
||||
EXPECT_EQ(nullptr, alloc);
|
||||
}
|
||||
|
||||
TEST(AllocateGlobalSurfaceTest, WhenGlobalsAreExportedAndAllocationFailsThenGracefullyReturnsNullptr) {
|
||||
auto pDevice = new MockDevice{};
|
||||
MockClDevice clDevice{pDevice};
|
||||
MockMemoryManager memoryManager{*clDevice.getExecutionEnvironment()};
|
||||
MockDevice device{};
|
||||
MockMemoryManager memoryManager{*device.getExecutionEnvironment()};
|
||||
MockSVMAllocsManager svmAllocsManager(&memoryManager, false);
|
||||
memoryManager.failInAllocateWithSizeAndAlignment = true;
|
||||
WhiteBox<LinkerInput> linkerInputExportGlobalVariables;
|
||||
|
@ -202,10 +195,10 @@ TEST(AllocateGlobalSurfaceTest, WhenGlobalsAreExportedAndAllocationFailsThenGrac
|
|||
initData.resize(64, 7U);
|
||||
GraphicsAllocation *alloc = nullptr;
|
||||
|
||||
alloc = allocateGlobalsSurface(&svmAllocsManager, *pDevice, initData.size(), true /* constant */, &linkerInputExportGlobalConstants, initData.data());
|
||||
alloc = allocateGlobalsSurface(&svmAllocsManager, device, initData.size(), true /* constant */, &linkerInputExportGlobalConstants, initData.data());
|
||||
EXPECT_EQ(nullptr, alloc);
|
||||
|
||||
alloc = allocateGlobalsSurface(&svmAllocsManager, *pDevice, initData.size(), false /* constant */, &linkerInputExportGlobalVariables, initData.data());
|
||||
alloc = allocateGlobalsSurface(&svmAllocsManager, device, initData.size(), false /* constant */, &linkerInputExportGlobalVariables, initData.data());
|
||||
EXPECT_EQ(nullptr, alloc);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue