Stop creating MockContext in MockParentKernel

Change-Id: I398d7e6f159e246e4f66cd73ac1f04eb09ea04ca
This commit is contained in:
Maciej Dziuban
2018-07-30 14:13:37 +02:00
committed by sys_ocldev
parent d53e1c3979
commit b83b9ac120
9 changed files with 62 additions and 72 deletions

View File

@@ -310,7 +310,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueSlb, cleanupSection) {
auto mockDeviceQueueHw = new MockDeviceQueueHw<FamilyType>(pContext, device, deviceQueueProperties::minimumProperties[0]);
auto commandsSize = mockDeviceQueueHw->getMinimumSlbSize() + mockDeviceQueueHw->getWaCommandsSize();
auto igilCmdQueue = reinterpret_cast<IGIL_CommandQueue *>(mockDeviceQueueHw->getQueueBuffer()->getUnderlyingBuffer());
MockParentKernel *mockParentKernel = MockParentKernel::create(*device);
MockParentKernel *mockParentKernel = MockParentKernel::create(*pContext);
uint32_t taskCount = 7;
mockDeviceQueueHw->buildSlbDummyCommands();
@@ -364,7 +364,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueSlb, AddEMCleanupSectionWithProfiling) {
auto mockDeviceQueueHw = new MockDeviceQueueHw<FamilyType>(pContext, device, deviceQueueProperties::minimumProperties[0]);
auto commandsSize = mockDeviceQueueHw->getMinimumSlbSize() + mockDeviceQueueHw->getWaCommandsSize();
auto igilCmdQueue = reinterpret_cast<IGIL_CommandQueue *>(mockDeviceQueueHw->getQueueBuffer()->getUnderlyingBuffer());
MockParentKernel *mockParentKernel = MockParentKernel::create(*device);
MockParentKernel *mockParentKernel = MockParentKernel::create(*pContext);
uint32_t taskCount = 7;
HwTimeStamps hwTimeStamp;
@@ -684,10 +684,10 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TheSimplestDeviceQueueFixture, addExecutionModelClea
}
};
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
MockContext context;
MockContext context(device.get());
std::unique_ptr<MockDeviceQueueWithMediaStateClearRegistering> mockDeviceQueueHw(new MockDeviceQueueWithMediaStateClearRegistering(&context, device.get(), deviceQueueProperties::minimumProperties[0]));
std::unique_ptr<MockParentKernel> mockParentKernel(MockParentKernel::create(*device));
std::unique_ptr<MockParentKernel> mockParentKernel(MockParentKernel::create(context));
uint32_t taskCount = 7;
mockDeviceQueueHw->buildSlbDummyCommands();

View File

@@ -573,7 +573,8 @@ HWTEST_F(ParentKernelEnqueueFixture, givenCsrInBatchingModeWhenExecutionModelKer
size_t offset[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
std::unique_ptr<MockParentKernel> kernelToRun(MockParentKernel::create(*pDevice, false, false, false, false, false));
MockContext context(pDevice);
std::unique_ptr<MockParentKernel> kernelToRun(MockParentKernel::create(context, false, false, false, false, false));
pCmdQ->enqueueKernel(kernelToRun.get(), 1, offset, gws, gws, 0, nullptr, nullptr);

View File

@@ -217,7 +217,7 @@ typedef ParentKernelCommandQueueFixture ParentKernelCommandStreamFixture;
HWTEST_F(ParentKernelCommandStreamFixture, GivenDispatchInfoWithParentKernelWhenCommandStreamIsAcquiredThenSizeAccountsForSchedulerDispatch) {
if (device->getSupportedClVersion() >= 20) {
MockParentKernel *mockParentKernel = MockParentKernel::create(*device);
MockParentKernel *mockParentKernel = MockParentKernel::create(*context);
DispatchInfo dispatchInfo(mockParentKernel, 1, Vec3<size_t>{24, 1, 1}, Vec3<size_t>{24, 1, 1}, Vec3<size_t>{0, 0, 0});
MultiDispatchInfo multiDispatchInfo;
@@ -263,7 +263,7 @@ class MockParentKernelDispatch : public ExecutionModelSchedulerTest,
HWTEST_F(MockParentKernelDispatch, GivenBlockedQueueWhenParentKernelIsDispatchedThenDshHeapForIndirectObjectHeapIsUsed) {
if (pDevice->getSupportedClVersion() >= 20) {
MockParentKernel *mockParentKernel = MockParentKernel::create(*pDevice);
MockParentKernel *mockParentKernel = MockParentKernel::create(*context);
KernelOperation *blockedCommandsData = nullptr;
const size_t globalOffsets[3] = {0, 0, 0};
@@ -296,7 +296,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, MockParentKernelDispatch, GivenParentKernelWhenDispa
typedef typename FamilyType::INTERFACE_DESCRIPTOR_DATA INTERFACE_DESCRIPTOR_DATA;
if (pDevice->getSupportedClVersion() >= 20) {
MockParentKernel *mockParentKernel = MockParentKernel::create(*pDevice);
MockParentKernel *mockParentKernel = MockParentKernel::create(*context);
KernelOperation *blockedCommandsData = nullptr;
const size_t globalOffsets[3] = {0, 0, 0};
@@ -341,7 +341,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, MockParentKernelDispatch, GivenParentKernelWhenDispa
HWTEST_F(MockParentKernelDispatch, GivenUsedSSHHeapWhenParentKernelIsDispatchedThenNewSSHIsAllocated) {
if (pDevice->getSupportedClVersion() >= 20) {
MockParentKernel *mockParentKernel = MockParentKernel::create(*pDevice);
MockParentKernel *mockParentKernel = MockParentKernel::create(*context);
KernelOperation *blockedCommandsData = nullptr;
const size_t globalOffsets[3] = {0, 0, 0};
@@ -381,7 +381,7 @@ HWTEST_F(MockParentKernelDispatch, GivenUsedSSHHeapWhenParentKernelIsDispatchedT
HWTEST_F(MockParentKernelDispatch, GivenNotUsedSSHHeapWhenParentKernelIsDispatchedThenExistingSSHIsUsed) {
if (pDevice->getSupportedClVersion() >= 20) {
MockParentKernel *mockParentKernel = MockParentKernel::create(*pDevice);
MockParentKernel *mockParentKernel = MockParentKernel::create(*context);
KernelOperation *blockedCommandsData = nullptr;
const size_t globalOffsets[3] = {0, 0, 0};

View File

@@ -91,7 +91,7 @@ class MockDeviceQueueHwWithCriticalSectionRelease : public DeviceQueueHw<GfxFami
HWTEST_F(ParentKernelCommandQueueFixture, givenLockedEMcritcalSectionWhenParentKernelCommandIsSubmittedThenItWaitsForcriticalSectionReleasement) {
if (device->getSupportedClVersion() >= 20) {
cl_queue_properties properties[3] = {0};
MockParentKernel *parentKernel = MockParentKernel::create(*device);
MockParentKernel *parentKernel = MockParentKernel::create(*context);
MockDeviceQueueHwWithCriticalSectionRelease<FamilyType> mockDevQueue(context, device, properties[0]);
parentKernel->createReflectionSurface();
context->setDefaultDeviceQueue(&mockDevQueue);
@@ -133,7 +133,7 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenLockedEMcritcalSectionWhenParentK
HWTEST_F(ParentKernelCommandQueueFixture, givenParentKernelWhenCommandIsSubmittedThenPassedDshIsUsed) {
if (device->getSupportedClVersion() >= 20) {
cl_queue_properties properties[3] = {0};
MockParentKernel *parentKernel = MockParentKernel::create(*device);
MockParentKernel *parentKernel = MockParentKernel::create(*context);
MockDeviceQueueHwWithCriticalSectionRelease<FamilyType> mockDevQueue(context, device, properties[0]);
parentKernel->createReflectionSurface();
context->setDefaultDeviceQueue(&mockDevQueue);
@@ -198,7 +198,7 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenParentKernelWhenCommandIsSubmitte
HWTEST_F(ParentKernelCommandQueueFixture, givenParentKernelWhenCommandIsSubmittedThenIndirectStateAndEMCleanupSectionIsSetup) {
if (device->getSupportedClVersion() >= 20) {
cl_queue_properties properties[3] = {0};
MockParentKernel *parentKernel = MockParentKernel::create(*device);
MockParentKernel *parentKernel = MockParentKernel::create(*context);
MockDeviceQueueHwWithCriticalSectionRelease<FamilyType> mockDevQueue(context, device, properties[0]);
parentKernel->createReflectionSurface();
context->setDefaultDeviceQueue(&mockDevQueue);
@@ -240,7 +240,7 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenParentKernelWhenCommandIsSubmitte
HWTEST_F(ParentKernelCommandQueueFixture, givenBlockedParentKernelWithProfilingWhenCommandIsSubmittedThenEMCleanupSectionsSetsCompleteTimestamp) {
if (device->getSupportedClVersion() >= 20) {
cl_queue_properties properties[3] = {0};
MockParentKernel *parentKernel = MockParentKernel::create(*device);
MockParentKernel *parentKernel = MockParentKernel::create(*context);
MockDeviceQueueHwWithCriticalSectionRelease<FamilyType> mockDevQueue(context, device, properties[0]);
parentKernel->createReflectionSurface();
context->setDefaultDeviceQueue(&mockDevQueue);
@@ -283,7 +283,7 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenBlockedParentKernelWithProfilingW
HWTEST_F(ParentKernelCommandQueueFixture, givenParentKernelWhenCommandIsSubmittedThenSchedulerIsDispatched) {
if (device->getSupportedClVersion() >= 20) {
cl_queue_properties properties[3] = {0};
MockParentKernel *parentKernel = MockParentKernel::create(*device);
MockParentKernel *parentKernel = MockParentKernel::create(*context);
MockDeviceQueueHwWithCriticalSectionRelease<FamilyType> mockDevQueue(context, device, properties[0]);
parentKernel->createReflectionSurface();
context->setDefaultDeviceQueue(&mockDevQueue);
@@ -323,7 +323,7 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenParentKernelWhenCommandIsSubmitte
HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenUsedCommandQueueHeapshenParentKernelIsSubmittedThenQueueHeapsAreNotUsed) {
if (device->getSupportedClVersion() >= 20) {
cl_queue_properties properties[3] = {0};
MockParentKernel *parentKernel = MockParentKernel::create(*device);
MockParentKernel *parentKernel = MockParentKernel::create(*context);
MockDeviceQueueHw<FamilyType> mockDevQueue(context, device, properties[0]);
parentKernel->createReflectionSurface();
context->setDefaultDeviceQueue(&mockDevQueue);
@@ -379,7 +379,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenUsedCommandQue
HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenNotUsedSSHWhenParentKernelIsSubmittedThenExistingSSHIsUsed) {
if (device->getSupportedClVersion() >= 20) {
cl_queue_properties properties[3] = {0};
MockParentKernel *parentKernel = MockParentKernel::create(*device);
MockParentKernel *parentKernel = MockParentKernel::create(*context);
MockDeviceQueueHw<FamilyType> mockDevQueue(context, device, properties[0]);
parentKernel->createReflectionSurface();
context->setDefaultDeviceQueue(&mockDevQueue);
@@ -428,7 +428,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenNotUsedSSHWhen
HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenBlockedCommandQueueWhenDispatchWalkerIsCalledThenHeapsHaveProperSizes) {
if (device->getSupportedClVersion() >= 20) {
cl_queue_properties properties[3] = {0};
std::unique_ptr<MockParentKernel> parentKernel(MockParentKernel::create(*device));
std::unique_ptr<MockParentKernel> parentKernel(MockParentKernel::create(*context));
MockDeviceQueueHw<FamilyType> mockDevQueue(context, device, properties[0]);
parentKernel->createReflectionSurface();

View File

@@ -90,7 +90,7 @@ class ExecutionModelSchedulerTest : public DeviceFixture,
CommandQueueHwFixture::SetUp(pDevice, 0);
DeviceQueueFixture::SetUp(context, pDevice);
parentKernel = MockParentKernel::create(*pDevice);
parentKernel = MockParentKernel::create(*context);
ASSERT_NE(nullptr, parentKernel);
}
@@ -107,6 +107,7 @@ class ExecutionModelSchedulerTest : public DeviceFixture,
struct ParentKernelCommandQueueFixture : public CommandQueueHwFixture,
testing::Test {
void SetUp() override {
device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
CommandQueueHwFixture::SetUp(device, 0);

View File

@@ -1910,9 +1910,9 @@ typedef ParentKernelCommandQueueFixture ReflectionSurfaceTestForPrintfHandler;
TEST_F(ReflectionSurfaceTestForPrintfHandler, PatchReflectionSurfacePatchesPrintfBufferWhenPrintfHandlerIsPassed) {
MockContext context;
MockContext context(device);
cl_queue_properties properties[3] = {0};
MockParentKernel *parentKernel = MockParentKernel::create(*device);
MockParentKernel *parentKernel = MockParentKernel::create(context);
DeviceQueue devQueue(&context, device, properties[0]);
parentKernel->createReflectionSurface();
@@ -1938,9 +1938,9 @@ TEST_F(ReflectionSurfaceTestForPrintfHandler, PatchReflectionSurfacePatchesPrint
TEST_F(ReflectionSurfaceTestForPrintfHandler, PatchReflectionSurfaceDoesNotPatchPrintfBufferWhenPrintfSurfaceIsNotCreated) {
MockContext context;
MockContext context(device);
cl_queue_properties properties[3] = {0};
MockParentKernel *parentKernel = MockParentKernel::create(*device);
MockParentKernel *parentKernel = MockParentKernel::create(context);
DeviceQueue devQueue(&context, device, properties[0]);
parentKernel->createReflectionSurface();
@@ -1976,8 +1976,8 @@ class ReflectionSurfaceConstantValuesPatchingTest : public DeviceFixture,
TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithGlobalMemoryWhenReflectionSurfaceIsPatchedWithConstantValuesThenProgramGlobalMemoryAddressIsPatched) {
MockContext context;
MockParentKernel *parentKernel = MockParentKernel::create(*pDevice, false, true, false);
MockContext context(pDevice);
MockParentKernel *parentKernel = MockParentKernel::create(context, false, true, false);
// graphicsMemory is released by Program
GraphicsAllocation *globalMemory = pDevice->getMemoryManager()->allocateGraphicsMemory(4096);
@@ -2010,8 +2010,8 @@ TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithGlobalMemoryWh
TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithGlobalMemoryAndProgramWithoutGlobalMemortWhenReflectionSurfaceIsPatchedWithConstantValuesThenZeroAddressIsPatched) {
MockContext context;
MockParentKernel *parentKernel = MockParentKernel::create(*pDevice, false, true, false);
MockContext context(pDevice);
MockParentKernel *parentKernel = MockParentKernel::create(context, false, true, false);
if (parentKernel->mockProgram->getGlobalSurface()) {
pDevice->getMemoryManager()->freeGraphicsMemory(parentKernel->mockProgram->getGlobalSurface());
@@ -2043,8 +2043,8 @@ TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithGlobalMemoryAn
TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithConstantMemoryWhenReflectionSurfaceIsPatchedWithConstantValuesThenProgramConstantMemoryAddressIsPatched) {
MockContext context;
MockParentKernel *parentKernel = MockParentKernel::create(*pDevice, false, false, true);
MockContext context(pDevice);
MockParentKernel *parentKernel = MockParentKernel::create(context, false, false, true);
// graphicsMemory is released by Program
GraphicsAllocation *constantMemory = pDevice->getMemoryManager()->allocateGraphicsMemory(4096);
@@ -2086,8 +2086,8 @@ TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithConstantMemory
TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithConstantMemoryAndProgramWithoutConstantMemortWhenReflectionSurfaceIsPatchedWithConstantValuesThenZeroAddressIsPatched) {
MockContext context;
MockParentKernel *parentKernel = MockParentKernel::create(*pDevice, false, false, true);
MockContext context(pDevice);
MockParentKernel *parentKernel = MockParentKernel::create(context, false, false, true);
if (parentKernel->mockProgram->getConstantSurface()) {
pDevice->getMemoryManager()->freeGraphicsMemory(parentKernel->mockProgram->getConstantSurface());

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* Copyright (c) 2017 - 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -80,8 +80,9 @@ TEST(ParentKernelTest, GetObjectCounts) {
}
TEST(ParentKernelTest, patchBlocksSimdSize) {
MockDevice *device = new MockDevice(*platformDevices[0]);
MockParentKernel *parentKernel = MockParentKernel::create(*device, true);
MockDevice device(*platformDevices[0]);
MockContext context(&device);
std::unique_ptr<MockParentKernel> parentKernel(MockParentKernel::create(context, true));
MockProgram *program = (MockProgram *)parentKernel->mockProgram;
parentKernel->patchBlocksSimdSize();
@@ -90,13 +91,12 @@ TEST(ParentKernelTest, patchBlocksSimdSize) {
uint32_t *simdSize = reinterpret_cast<uint32_t *>(blockSimdSize);
EXPECT_EQ(program->getBlockKernelInfo(0)->getMaxSimdSize(), *simdSize);
delete parentKernel;
delete device;
}
TEST(ParentKernelTest, hasDeviceEnqueue) {
MockDevice device(*platformDevices[0]);
std::unique_ptr<MockParentKernel> parentKernel(MockParentKernel::create(device));
MockContext context(&device);
std::unique_ptr<MockParentKernel> parentKernel(MockParentKernel::create(context));
EXPECT_TRUE(parentKernel->getKernelInfo().hasDeviceEnqueue());
}
@@ -109,8 +109,9 @@ TEST(ParentKernelTest, doesnthaveDeviceEnqueue) {
}
TEST(ParentKernelTest, initializeOnParentKernelPatchesBlocksSimdSize) {
MockDevice *device = new MockDevice(*platformDevices[0]);
MockParentKernel *parentKernel = MockParentKernel::create(*device, true);
MockDevice device(*platformDevices[0]);
MockContext context(&device);
std::unique_ptr<MockParentKernel> parentKernel(MockParentKernel::create(context, true));
MockProgram *program = (MockProgram *)parentKernel->mockProgram;
parentKernel->initialize();
@@ -119,13 +120,12 @@ TEST(ParentKernelTest, initializeOnParentKernelPatchesBlocksSimdSize) {
uint32_t *simdSize = reinterpret_cast<uint32_t *>(blockSimdSize);
EXPECT_EQ(program->getBlockKernelInfo(0)->getMaxSimdSize(), *simdSize);
delete parentKernel;
delete device;
}
TEST(ParentKernelTest, initializeOnParentKernelAllocatesPrivateMemoryForBlocks) {
MockDevice *device = new MockDevice(*platformDevices[0]);
MockParentKernel *parentKernel = MockParentKernel::create(*device, true);
MockDevice device(*platformDevices[0]);
MockContext context(&device);
std::unique_ptr<MockParentKernel> parentKernel(MockParentKernel::create(context, true));
MockProgram *program = (MockProgram *)parentKernel->mockProgram;
uint32_t crossThreadOffsetBlock = 0;
@@ -149,14 +149,14 @@ TEST(ParentKernelTest, initializeOnParentKernelAllocatesPrivateMemoryForBlocks)
crossThreadOffsetBlock += 8;
SPatchAllocateStatelessPrivateSurface *privateSurfaceBlock = new SPatchAllocateStatelessPrivateSurface;
auto privateSurfaceBlock = std::make_unique<SPatchAllocateStatelessPrivateSurface>();
privateSurfaceBlock->DataParamOffset = crossThreadOffsetBlock;
privateSurfaceBlock->DataParamSize = 8;
privateSurfaceBlock->Size = 8;
privateSurfaceBlock->SurfaceStateHeapOffset = 0;
privateSurfaceBlock->Token = 0;
privateSurfaceBlock->PerThreadPrivateMemorySize = 1000;
infoBlock->patchInfo.pAllocateStatelessPrivateSurface = privateSurfaceBlock;
infoBlock->patchInfo.pAllocateStatelessPrivateSurface = privateSurfaceBlock.get();
crossThreadOffsetBlock += 8;
@@ -213,10 +213,6 @@ TEST(ParentKernelTest, initializeOnParentKernelAllocatesPrivateMemoryForBlocks)
parentKernel->initialize();
EXPECT_NE(nullptr, program->getBlockKernelManager()->getPrivateSurface(program->getBlockKernelManager()->getCount() - 1));
delete privateSurfaceBlock;
delete parentKernel;
delete device;
}
TEST_P(ParentKernelFromBinaryTest, getInstructionHeapSizeForExecutionModelReturnsNonZeroForParentKernel) {

View File

@@ -308,7 +308,9 @@ class MockKernelWithInternals {
class MockParentKernel : public Kernel {
public:
using Kernel::patchBlocksCurbeWithConstantValues;
static MockParentKernel *create(Device &device, bool addChildSimdSize = false, bool addChildGlobalMemory = false, bool addChildConstantMemory = false, bool addPrintfForParent = true, bool addPrintfForBlock = true) {
static MockParentKernel *create(Context &context, bool addChildSimdSize = false, bool addChildGlobalMemory = false, bool addChildConstantMemory = false, bool addPrintfForParent = true, bool addPrintfForBlock = true) {
Device &device = *context.getDevice(0);
KernelInfo *info = new KernelInfo();
const size_t crossThreadSize = 160;
uint32_t crossThreadOffset = 0;
@@ -367,7 +369,7 @@ class MockParentKernel : public Kernel {
}
MockProgram *mockProgram = new MockProgram();
mockProgram->setContext(getContext());
mockProgram->setContext(&context);
mockProgram->setDevice(&device);
if (addChildSimdSize) {
@@ -502,7 +504,6 @@ class MockParentKernel : public Kernel {
delete kernelInfo.patchInfo.threadPayload;
delete kernelInfo.heapInfo.pKernelHeader;
delete &kernelInfo;
cleanContext();
BlockKernelManager *blockManager = program->getBlockKernelManager();
for (uint32_t i = 0; i < blockManager->getCount(); i++) {
@@ -525,17 +526,8 @@ class MockParentKernel : public Kernel {
}
}
static MockContext *&getContext() {
static MockContext *context;
if (context == nullptr)
context = new MockContext;
return context;
}
static void cleanContext() {
MockContext *&context = getContext();
delete context;
context = nullptr;
Context *getContext() {
return &mockProgram->getContext();
}
void setReflectionSurface(GraphicsAllocation *reflectionSurface) {

View File

@@ -89,12 +89,12 @@ TEST(PrintfHandlerTest, givenPreparedPrintfHandlerWhenGetSurfaceIsCalledThenResu
TEST(PrintfHandlerTest, givenParentKernelWihoutPrintfAndBlockKernelWithPrintfWhenPrintfHandlerCreateCalledThenResaultIsAnObject) {
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
std::unique_ptr<MockParentKernel> parentKernelWithoutPrintf(MockParentKernel::create(*device.get(), false, false, false, false));
MockContext context(device.get());
std::unique_ptr<MockParentKernel> parentKernelWithoutPrintf(MockParentKernel::create(context, false, false, false, false));
MockMultiDispatchInfo multiDispatchInfo(parentKernelWithoutPrintf.get());
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *device.get()));
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *device));
ASSERT_NE(nullptr, printfHandler.get());
}
@@ -102,24 +102,24 @@ TEST(PrintfHandlerTest, givenParentKernelWihoutPrintfAndBlockKernelWithPrintfWhe
TEST(PrintfHandlerTest, givenParentKernelAndBlockKernelWithoutPrintfWhenPrintfHandlerCreateCalledThenResaultIsNullptr) {
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
std::unique_ptr<MockParentKernel> blockKernelWithoutPrintf(MockParentKernel::create(*device.get(), false, false, false, false, false));
MockContext context(device.get());
std::unique_ptr<MockParentKernel> blockKernelWithoutPrintf(MockParentKernel::create(context, false, false, false, false, false));
MockMultiDispatchInfo multiDispatchInfo(blockKernelWithoutPrintf.get());
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *device.get()));
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *device));
ASSERT_EQ(nullptr, printfHandler.get());
}
TEST(PrintfHandlerTest, givenParentKernelWithPrintfAndBlockKernelWithoutPrintfWhenPrintfHandlerCreateCalledThenResaultIsAnObject) {
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
std::unique_ptr<MockParentKernel> parentKernelWithPrintfBlockKernelWithoutPrintf(MockParentKernel::create(*device.get(), false, false, false, true, false));
MockContext context(device.get());
std::unique_ptr<MockParentKernel> parentKernelWithPrintfBlockKernelWithoutPrintf(MockParentKernel::create(context, false, false, false, true, false));
MockMultiDispatchInfo multiDispatchInfo(parentKernelWithPrintfBlockKernelWithoutPrintf.get());
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *device.get()));
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *device));
ASSERT_NE(nullptr, printfHandler);
}