mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Stop creating MockContext in MockParentKernel
Change-Id: I398d7e6f159e246e4f66cd73ac1f04eb09ea04ca
This commit is contained in:
committed by
sys_ocldev
parent
d53e1c3979
commit
b83b9ac120
@@ -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());
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user