Avoid default parameter to program constructor.

Change-Id: I75e9a619131f7d8721416cf18d87418568d04f25
This commit is contained in:
Mrozek, Michal 2018-02-28 13:06:23 +01:00 committed by sys_ocldev
parent 0b6acb4d7a
commit 7f7daef49c
26 changed files with 69 additions and 69 deletions

View File

@ -1226,7 +1226,7 @@ cl_program CL_API_CALL clLinkProgram(cl_context context,
pContext = castToObject<Context>(context); pContext = castToObject<Context>(context);
} }
if (pContext != nullptr) { if (pContext != nullptr) {
program = new Program(pContext); program = new Program(pContext, false);
Program *pProgram = castToObject<Program>(program); Program *pProgram = castToObject<Program>(program);
retVal = pProgram->link(numDevices, deviceList, options, retVal = pProgram->link(numDevices, deviceList, options,
numInputPrograms, inputPrograms, numInputPrograms, inputPrograms,

View File

@ -37,7 +37,7 @@ T *Program::create(
auto pContext = castToObject<Context>(context); auto pContext = castToObject<Context>(context);
DEBUG_BREAK_IF(!pContext); DEBUG_BREAK_IF(!pContext);
auto program = new T(pContext); auto program = new T(pContext, false);
auto retVal = program->createProgramFromBinary(binaries[0], lengths[0]); auto retVal = program->createProgramFromBinary(binaries[0], lengths[0]);
@ -76,7 +76,7 @@ T *Program::create(
lengths); lengths);
if (CL_SUCCESS == retVal) { if (CL_SUCCESS == retVal) {
program = new T(pContext); program = new T(pContext, false);
program->sourceCode.swap(combinedString); program->sourceCode.swap(combinedString);
} }

View File

@ -35,7 +35,7 @@ namespace OCLRT {
const std::string Program::clOptNameClVer("-cl-std=CL"); const std::string Program::clOptNameClVer("-cl-std=CL");
const std::string Program::clOptNameUniformWgs{"-cl-uniform-work-group-size"}; const std::string Program::clOptNameUniformWgs{"-cl-uniform-work-group-size"};
Program::Program() : Program(nullptr) { Program::Program() : Program(nullptr, false) {
numDevices = 0; numDevices = 0;
} }

View File

@ -116,7 +116,7 @@ class Program : public BaseObject<_cl_program> {
size_t length, size_t length,
cl_int &errcodeRet); cl_int &errcodeRet);
Program(Context *context, bool isBuiltIn = false); Program(Context *context, bool isBuiltIn);
~Program() override; ~Program() override;
Program(const Program &) = delete; Program(const Program &) = delete;

View File

@ -48,7 +48,7 @@ void api_fixture::SetUp() {
pCommandQueue = new CommandQueue(pContext, pDevice, 0); pCommandQueue = new CommandQueue(pContext, pDevice, 0);
pProgram = new MockProgram(pContext); pProgram = new MockProgram(pContext, false);
pKernel = new MockKernel(pProgram, *pProgram->MockProgram::getKernelInfo(), *pDevice); pKernel = new MockKernel(pProgram, *pProgram->MockProgram::getKernelInfo(), *pDevice);
ASSERT_NE(nullptr, pKernel); ASSERT_NE(nullptr, pKernel);
@ -82,7 +82,7 @@ void api_fixture_using_aligned_memory_manager::SetUp() {
commandQueue = new CommandQueue(context, devPtr, 0); commandQueue = new CommandQueue(context, devPtr, 0);
program = new MockProgram(ctxPtr); program = new MockProgram(ctxPtr, false);
Program *prgPtr = reinterpret_cast<Program *>(program); Program *prgPtr = reinterpret_cast<Program *>(program);
kernel = new MockKernel(prgPtr, *program->MockProgram::getKernelInfo(), *devPtr); kernel = new MockKernel(prgPtr, *program->MockProgram::getKernelInfo(), *devPtr);

View File

@ -98,7 +98,7 @@ TEST_F(clCreateKernelTests, invalidKernel) {
pKernelInfo->isValid = false; pKernelInfo->isValid = false;
pKernelInfo->name = "CopyBuffer"; pKernelInfo->name = "CopyBuffer";
MockProgram *pMockProg = new MockProgram(pContext); MockProgram *pMockProg = new MockProgram(pContext, false);
pMockProg->addKernelInfo(pKernelInfo); pMockProg->addKernelInfo(pKernelInfo);
kernel = clCreateKernel( kernel = clCreateKernel(

View File

@ -358,7 +358,7 @@ TEST_F(CompilerInterfaceCachedTests, canInjectCache) {
} }
TEST_F(CompilerInterfaceCachedTests, notCachedAndIgcFailed) { TEST_F(CompilerInterfaceCachedTests, notCachedAndIgcFailed) {
MockContext context(pDevice, true); MockContext context(pDevice, true);
MockProgram program(&context); MockProgram program(&context, false);
BinaryCacheMock cache; BinaryCacheMock cache;
TranslationArgs inputArgs; TranslationArgs inputArgs;
@ -389,7 +389,7 @@ TEST_F(CompilerInterfaceCachedTests, notCachedAndIgcFailed) {
TEST_F(CompilerInterfaceCachedTests, wasCached) { TEST_F(CompilerInterfaceCachedTests, wasCached) {
MockContext context(pDevice, true); MockContext context(pDevice, true);
MockProgram program(&context); MockProgram program(&context, false);
BinaryCacheMock cache; BinaryCacheMock cache;
TranslationArgs inputArgs; TranslationArgs inputArgs;
@ -420,7 +420,7 @@ TEST_F(CompilerInterfaceCachedTests, wasCached) {
TEST_F(CompilerInterfaceCachedTests, builtThenCached) { TEST_F(CompilerInterfaceCachedTests, builtThenCached) {
MockContext context(pDevice, true); MockContext context(pDevice, true);
MockProgram program(&context); MockProgram program(&context, false);
BinaryCacheMock cache; BinaryCacheMock cache;
TranslationArgs inputArgs; TranslationArgs inputArgs;

View File

@ -82,7 +82,7 @@ class CompilerInterfaceTest : public MemoryManagementFixture,
cl_device_id clDevice = pDevice; cl_device_id clDevice = pDevice;
pContext = Context::create<MockContext>(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal); pContext = Context::create<MockContext>(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal);
pProgram = new Program(pContext); pProgram = new Program(pContext, false);
inputArgs.pInput = (char *)pSource; inputArgs.pInput = (char *)pSource;
inputArgs.InputSize = (uint32_t)sourceSize; inputArgs.InputSize = (uint32_t)sourceSize;
@ -482,7 +482,7 @@ TEST_F(CompilerInterfaceTest, igcBuildFailure) {
TEST_F(CompilerInterfaceTest, CompileAndLinkSpirToIsa) { TEST_F(CompilerInterfaceTest, CompileAndLinkSpirToIsa) {
// compile and link from SPIR binary to gen ISA // compile and link from SPIR binary to gen ISA
MockProgram program(pContext); MockProgram program(pContext, false);
char binary[] = "BC\xc0\xde "; char binary[] = "BC\xc0\xde ";
auto retVal = program.createProgramFromBinary(binary, sizeof(binary)); auto retVal = program.createProgramFromBinary(binary, sizeof(binary));
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
@ -494,7 +494,7 @@ TEST_F(CompilerInterfaceTest, CompileAndLinkSpirToIsa) {
TEST_F(CompilerInterfaceTest, BuildSpirToIsa) { TEST_F(CompilerInterfaceTest, BuildSpirToIsa) {
// build from SPIR binary to gen ISA // build from SPIR binary to gen ISA
MockProgram program(pContext); MockProgram program(pContext, false);
char binary[] = "BC\xc0\xde "; char binary[] = "BC\xc0\xde ";
auto retVal = program.createProgramFromBinary(binary, sizeof(binary)); auto retVal = program.createProgramFromBinary(binary, sizeof(binary));
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
@ -504,7 +504,7 @@ TEST_F(CompilerInterfaceTest, BuildSpirToIsa) {
TEST_F(CompilerInterfaceTest, BuildSpirvToIsa) { TEST_F(CompilerInterfaceTest, BuildSpirvToIsa) {
// build from SPIR binary to gen ISA // build from SPIR binary to gen ISA
MockProgram program(pContext); MockProgram program(pContext, false);
uint64_t spirv[16] = {0x03022307}; uint64_t spirv[16] = {0x03022307};
auto retVal = program.createProgramFromBinary(spirv, sizeof(spirv)); auto retVal = program.createProgramFromBinary(spirv, sizeof(spirv));
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);

View File

@ -593,7 +593,7 @@ TEST_F(InternalsEventTest, givenBlockedKernelWithPrintfWhenSubmittedThenPrintOut
pKernelInfo->patchInfo.pAllocateStatelessPrintfSurface = pPrintfSurface; pKernelInfo->patchInfo.pAllocateStatelessPrintfSurface = pPrintfSurface;
pKernelInfo->patchInfo.stringDataMap.insert(std::make_pair(0, printfStringInfo)); pKernelInfo->patchInfo.stringDataMap.insert(std::make_pair(0, printfStringInfo));
MockProgram *pProgram = new MockProgram(mockContext); MockProgram *pProgram = new MockProgram(mockContext, false);
uint64_t crossThread[10]; uint64_t crossThread[10];
MockKernel *pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); MockKernel *pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice);

View File

@ -52,7 +52,7 @@ class ScenarioTest : public ::testing::Test,
cl_device_id clDevice = pDevice; cl_device_id clDevice = pDevice;
context = Context::create<MockContext>(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal); context = Context::create<MockContext>(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal);
commandQueue = new MockCommandQueue(context, pDevice, 0); commandQueue = new MockCommandQueue(context, pDevice, 0);
program = new MockProgram(context); program = new MockProgram(context, false);
kernelInternals = new MockKernelWithInternals(*pDevice, context); kernelInternals = new MockKernelWithInternals(*pDevice, context);
kernel = kernelInternals->mockKernel; kernel = kernelInternals->mockKernel;

View File

@ -81,7 +81,7 @@ class DispatchInfoBuilderFixture : public ContextFixture, public DeviceFixture,
pKernelInfo->kernelArgInfo[2].kernelArgPatchInfoVector[0].crossthreadOffset = 0x50; pKernelInfo->kernelArgInfo[2].kernelArgPatchInfoVector[0].crossthreadOffset = 0x50;
pKernelInfo->kernelArgInfo[2].kernelArgPatchInfoVector[0].size = (uint32_t)sizeof(void *); pKernelInfo->kernelArgInfo[2].kernelArgPatchInfoVector[0].size = (uint32_t)sizeof(void *);
pProgram = new MockProgram(pContext); pProgram = new MockProgram(pContext, false);
pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); ASSERT_EQ(CL_SUCCESS, pKernel->initialize());

View File

@ -53,7 +53,7 @@ class DispatchInfoFixture : public ContextFixture, public DeviceFixture, public
pKernelInfo->patchInfo.mediavfestate = pMediaVFEstate; pKernelInfo->patchInfo.mediavfestate = pMediaVFEstate;
pPrintfSurface = new SPatchAllocateStatelessPrintfSurface(); pPrintfSurface = new SPatchAllocateStatelessPrintfSurface();
pKernelInfo->patchInfo.pAllocateStatelessPrintfSurface = pPrintfSurface; pKernelInfo->patchInfo.pAllocateStatelessPrintfSurface = pPrintfSurface;
pProgram = new MockProgram(pContext); pProgram = new MockProgram(pContext, false);
pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice);
pKernel->slmTotalSize = 128; pKernel->slmTotalSize = 128;

View File

@ -410,7 +410,7 @@ HWTEST_F(KernelCommandsTest, usedBindingTableStatePointersForGlobalAndConstantAn
// create program with valid context // create program with valid context
MockContext context; MockContext context;
MockProgram program(&context); MockProgram program(&context, false);
// setup global memory // setup global memory
char globalBuffer[16]; char globalBuffer[16];
@ -531,7 +531,7 @@ HWTEST_F(KernelCommandsTest, setBindingTableStatesForKernelWithBuffersNotRequiri
// create program with valid context // create program with valid context
MockContext context; MockContext context;
MockProgram program(&context); MockProgram program(&context, false);
// create kernel // create kernel
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice);
@ -590,7 +590,7 @@ HWTEST_F(KernelCommandsTest, setBindingTableStatesForNoSurfaces) {
// create program with valid context // create program with valid context
MockContext context; MockContext context;
MockProgram program(&context); MockProgram program(&context, false);
// create kernel // create kernel
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice);
@ -790,7 +790,7 @@ HWTEST_F(KernelCommandsTest, getSizeRequiredIHForExecutionModelReturnsZeroForNon
// create program with valid context // create program with valid context
MockContext context; MockContext context;
MockProgram program(&context); MockProgram program(&context, false);
// create kernel // create kernel
std::unique_ptr<MockKernel> pKernel = std::unique_ptr<MockKernel>(new MockKernel(&program, *pKernelInfo.get(), *pDevice)); std::unique_ptr<MockKernel> pKernel = std::unique_ptr<MockKernel>(new MockKernel(&program, *pKernelInfo.get(), *pDevice));

View File

@ -97,7 +97,7 @@ class CloneKernelFixture : public ContextFixture, public DeviceFixture, public M
pKernelInfo->kernelArgInfo[0].offsetVmeSadAdjustMode = 0x14; pKernelInfo->kernelArgInfo[0].offsetVmeSadAdjustMode = 0x14;
pKernelInfo->kernelArgInfo[0].offsetVmeSearchPathType = 0x1c; pKernelInfo->kernelArgInfo[0].offsetVmeSearchPathType = 0x1c;
pProgram = new MockProgram(pContext); pProgram = new MockProgram(pContext, false);
pSourceKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); pSourceKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice);
ASSERT_EQ(CL_SUCCESS, pSourceKernel->initialize()); ASSERT_EQ(CL_SUCCESS, pSourceKernel->initialize());

View File

@ -78,7 +78,7 @@ class KernelArgAcceleratorFixture : public ContextFixture, public DeviceFixture,
pKernelInfo->kernelArgInfo[0].offsetVmeSadAdjustMode = 0x14; pKernelInfo->kernelArgInfo[0].offsetVmeSadAdjustMode = 0x14;
pKernelInfo->kernelArgInfo[0].offsetVmeSearchPathType = 0x1c; pKernelInfo->kernelArgInfo[0].offsetVmeSearchPathType = 0x1c;
pProgram = new MockProgram(pContext); pProgram = new MockProgram(pContext, false);
pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); ASSERT_EQ(CL_SUCCESS, pKernel->initialize());

View File

@ -63,7 +63,7 @@ void KernelArgBufferFixture::SetUp() {
pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].crossthreadOffset = 0x30; pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].crossthreadOffset = 0x30;
pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].size = (uint32_t)sizeof(void *); pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].size = (uint32_t)sizeof(void *);
pProgram = new MockProgram(pContext); pProgram = new MockProgram(pContext, false);
pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); ASSERT_EQ(CL_SUCCESS, pKernel->initialize());

View File

@ -72,7 +72,7 @@ class KernelArgPipeFixture : public ContextFixture, public DeviceFixture, public
pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].crossthreadOffset = 0x30; pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].crossthreadOffset = 0x30;
pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].size = (uint32_t)sizeof(void *); pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].size = (uint32_t)sizeof(void *);
pProgram = new MockProgram(pContext); pProgram = new MockProgram(pContext, false);
pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); ASSERT_EQ(CL_SUCCESS, pKernel->initialize());

View File

@ -71,7 +71,7 @@ class KernelArgSvmFixture_ : public ContextFixture, public DeviceFixture, public
pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].crossthreadOffset = 0x30; pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].crossthreadOffset = 0x30;
pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].size = (uint32_t)sizeof(void *); pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].size = (uint32_t)sizeof(void *);
pProgram = new MockProgram(pContext); pProgram = new MockProgram(pContext, false);
pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); ASSERT_EQ(CL_SUCCESS, pKernel->initialize());

View File

@ -491,7 +491,7 @@ TEST_F(KernelPrivateSurfaceTest, testPrivateSurface) {
// create kernel // create kernel
MockContext context; MockContext context;
MockProgram program(&context); MockProgram program(&context, false);
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); ASSERT_EQ(CL_SUCCESS, pKernel->initialize());
@ -531,7 +531,7 @@ TEST_F(KernelPrivateSurfaceTest, givenKernelWithPrivateSurfaceThatIsInUseByGpuWh
pKernelInfo->patchInfo.executionEnvironment = &tokenEE; pKernelInfo->patchInfo.executionEnvironment = &tokenEE;
MockContext context; MockContext context;
MockProgram program(&context); MockProgram program(&context, false);
std::unique_ptr<MockKernel> pKernel(new MockKernel(&program, *pKernelInfo, *pDevice)); std::unique_ptr<MockKernel> pKernel(new MockKernel(&program, *pKernelInfo, *pDevice));
pKernel->initialize(); pKernel->initialize();
@ -575,7 +575,7 @@ TEST_F(KernelPrivateSurfaceTest, testPrivateSurfaceAllocationFailure) {
// create kernel // create kernel
MockContext context; MockContext context;
MockProgram program(&context); MockProgram program(&context, false);
MemoryManagementFixture::InjectedFunction method = [&](size_t failureIndex) { MemoryManagementFixture::InjectedFunction method = [&](size_t failureIndex) {
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice);
@ -622,7 +622,7 @@ TEST_F(KernelPrivateSurfaceTest, given32BitDeviceWhenKernelIsCreatedThenPrivateS
// create kernel // create kernel
MockContext context; MockContext context;
MockProgram program(&context); MockProgram program(&context, false);
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); ASSERT_EQ(CL_SUCCESS, pKernel->initialize());
@ -655,7 +655,7 @@ HWTEST_F(KernelPrivateSurfaceTest, givenStatefulKernelWhenKernelIsCreatedThenPri
pKernelInfo->patchInfo.pAllocateStatelessPrivateSurface = &AllocateStatelessPrivateMemorySurface; pKernelInfo->patchInfo.pAllocateStatelessPrivateSurface = &AllocateStatelessPrivateMemorySurface;
MockContext context; MockContext context;
MockProgram program(&context); MockProgram program(&context, false);
// create kernel // create kernel
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice);
@ -706,7 +706,7 @@ TEST_F(KernelPrivateSurfaceTest, givenStatelessKernelWhenKernelIsCreatedThenPriv
GraphicsAllocation gfxAlloc(buffer, sizeof(buffer)); GraphicsAllocation gfxAlloc(buffer, sizeof(buffer));
MockContext context; MockContext context;
MockProgram program(&context); MockProgram program(&context, false);
program.setConstantSurface(&gfxAlloc); program.setConstantSurface(&gfxAlloc);
// create kernel // create kernel
@ -774,7 +774,7 @@ TEST_F(KernelGlobalSurfaceTest, givenBuiltInKernelWhenKernelIsCreatedThenGlobalS
// create kernel // create kernel
MockContext context; MockContext context;
MockProgram program(&context); MockProgram program(&context, false);
program.setGlobalSurface(&gfxAlloc); program.setGlobalSurface(&gfxAlloc);
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice);
@ -855,7 +855,7 @@ HWTEST_F(KernelGlobalSurfaceTest, givenStatefulKernelWhenKernelIsCreatedThenGlob
void *bufferAddress = gfxAlloc.getUnderlyingBuffer(); void *bufferAddress = gfxAlloc.getUnderlyingBuffer();
MockContext context; MockContext context;
MockProgram program(&context); MockProgram program(&context, false);
program.setGlobalSurface(&gfxAlloc); program.setGlobalSurface(&gfxAlloc);
// create kernel // create kernel
@ -1033,7 +1033,7 @@ HWTEST_F(KernelConstantSurfaceTest, givenStatefulKernelWhenKernelIsCreatedThenCo
void *bufferAddress = gfxAlloc.getUnderlyingBuffer(); void *bufferAddress = gfxAlloc.getUnderlyingBuffer();
MockContext context; MockContext context;
MockProgram program(&context); MockProgram program(&context, false);
program.setConstantSurface(&gfxAlloc); program.setConstantSurface(&gfxAlloc);
// create kernel // create kernel
@ -1122,7 +1122,7 @@ HWTEST_F(KernelEventPoolSurfaceTest, givenStatefulKernelWhenKernelIsCreatedThenE
pKernelInfo->patchInfo.pAllocateStatelessEventPoolSurface = &AllocateStatelessEventPoolSurface; pKernelInfo->patchInfo.pAllocateStatelessEventPoolSurface = &AllocateStatelessEventPoolSurface;
// create kernel // create kernel
MockProgram program(&context); MockProgram program(&context, false);
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice);
// setup surface state heap // setup surface state heap
@ -1175,7 +1175,7 @@ HWTEST_F(KernelEventPoolSurfaceTest, givenStatefulKernelWhenEventPoolIsPatchedTh
pKernelInfo->patchInfo.pAllocateStatelessEventPoolSurface = &AllocateStatelessEventPoolSurface; pKernelInfo->patchInfo.pAllocateStatelessEventPoolSurface = &AllocateStatelessEventPoolSurface;
// create kernel // create kernel
MockProgram program(&context); MockProgram program(&context, false);
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice);
// setup surface state heap // setup surface state heap
@ -1337,7 +1337,7 @@ HWTEST_F(KernelDefaultDeviceQueueSurfaceTest, givenStatefulKernelWhenKernelIsCre
pKernelInfo->patchInfo.pAllocateStatelessDefaultDeviceQueueSurface = &AllocateStatelessDefaultDeviceQueueSurface; pKernelInfo->patchInfo.pAllocateStatelessDefaultDeviceQueueSurface = &AllocateStatelessDefaultDeviceQueueSurface;
// create kernel // create kernel
MockProgram program(&context); MockProgram program(&context, false);
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice);
// setup surface state heap // setup surface state heap
@ -1390,7 +1390,7 @@ HWTEST_F(KernelDefaultDeviceQueueSurfaceTest, givenStatefulKernelWhenDefaultDevi
pKernelInfo->patchInfo.pAllocateStatelessDefaultDeviceQueueSurface = &AllocateStatelessDefaultDeviceQueueSurface; pKernelInfo->patchInfo.pAllocateStatelessDefaultDeviceQueueSurface = &AllocateStatelessDefaultDeviceQueueSurface;
// create kernel // create kernel
MockProgram program(&context); MockProgram program(&context, false);
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice);
// setup surface state heap // setup surface state heap

View File

@ -72,7 +72,7 @@ class BufferSetArgTest : public ContextFixture,
pKernelInfo->kernelArgInfo[1].kernelArgPatchInfoVector[0].size = sizeOfPointer; pKernelInfo->kernelArgInfo[1].kernelArgPatchInfoVector[0].size = sizeOfPointer;
pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].size = sizeOfPointer; pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].size = sizeOfPointer;
pProgram = new MockProgram(pContext); pProgram = new MockProgram(pContext, false);
pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice);
ASSERT_NE(nullptr, pKernel); ASSERT_NE(nullptr, pKernel);

View File

@ -218,7 +218,7 @@ class MockKernelWithInternals {
mockContext = context; mockContext = context;
} }
mockProgram = new MockProgram(context); mockProgram = new MockProgram(context, false);
mockKernel = new MockKernel(mockProgram, kernelInfo, deviceArg); mockKernel = new MockKernel(mockProgram, kernelInfo, deviceArg);
mockKernel->setCrossThreadData(&crossThreadData, sizeof(crossThreadData)); mockKernel->setCrossThreadData(&crossThreadData, sizeof(crossThreadData));
mockKernel->setSshLocal(&sshLocal, sizeof(sshLocal)); mockKernel->setSshLocal(&sshLocal, sizeof(sshLocal));

View File

@ -33,7 +33,7 @@ class GraphicsAllocation;
class MockProgram : public Program { class MockProgram : public Program {
public: public:
MockProgram() : Program() {} MockProgram() : Program() {}
MockProgram(Context *context) : Program(context) {} MockProgram(Context *context, bool isBuiltinKernel) : Program(context, isBuiltinKernel) {}
~MockProgram() { ~MockProgram() {
if (contextSet) if (contextSet)
context = nullptr; context = nullptr;

View File

@ -564,7 +564,7 @@ TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsBuffer) {
auto buffer = BufferHelper<>::create(&context); auto buffer = BufferHelper<>::create(&context);
cl_mem clObj = buffer; cl_mem clObj = buffer;
MockProgram program(&context); MockProgram program(&context, false);
auto kernelInfo = unique_ptr<KernelInfo>(KernelInfo::create()); auto kernelInfo = unique_ptr<KernelInfo>(KernelInfo::create());
auto device = unique_ptr<Device>(Device::create<OCLRT::Device>(nullptr, false)); auto device = unique_ptr<Device>(Device::create<OCLRT::Device>(nullptr, false));
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device)); auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));

View File

@ -42,7 +42,7 @@ TEST(PrintfHandlerTest, givenNotPreparedPrintfHandlerWhenGetSurfaceIsCalledThenR
KernelInfo *pKernelInfo = new KernelInfo(); KernelInfo *pKernelInfo = new KernelInfo();
pKernelInfo->patchInfo.pAllocateStatelessPrintfSurface = pPrintfSurface; pKernelInfo->patchInfo.pAllocateStatelessPrintfSurface = pPrintfSurface;
MockProgram *pProgram = new MockProgram(&context); MockProgram *pProgram = new MockProgram(&context, false);
MockKernel *pKernel = new MockKernel(pProgram, *pKernelInfo, *device); MockKernel *pKernel = new MockKernel(pProgram, *pKernelInfo, *device);
MockMultiDispatchInfo multiDispatchInfo(pKernel); MockMultiDispatchInfo multiDispatchInfo(pKernel);
@ -68,7 +68,7 @@ TEST(PrintfHandlerTest, givenPreparedPrintfHandlerWhenGetSurfaceIsCalledThenResu
KernelInfo *pKernelInfo = new KernelInfo(); KernelInfo *pKernelInfo = new KernelInfo();
pKernelInfo->patchInfo.pAllocateStatelessPrintfSurface = pPrintfSurface; pKernelInfo->patchInfo.pAllocateStatelessPrintfSurface = pPrintfSurface;
MockProgram *pProgram = new MockProgram(&context); MockProgram *pProgram = new MockProgram(&context, false);
uint64_t crossThread[10]; uint64_t crossThread[10];
MockKernel *pKernel = new MockKernel(pProgram, *pKernelInfo, *device); MockKernel *pKernel = new MockKernel(pProgram, *pKernelInfo, *device);

View File

@ -1609,7 +1609,7 @@ TEST(ProgramFromBinaryTests, CreateWithBinary_FailRecompile) {
TEST(ProgramFromBinaryTests, givenEmptyProgramThenErrorIsReturned) { TEST(ProgramFromBinaryTests, givenEmptyProgramThenErrorIsReturned) {
class TestedProgram : public Program { class TestedProgram : public Program {
public: public:
TestedProgram(Context *context, bool isBuiltIn = false) : Program(context) {} TestedProgram(Context *context, bool isBuiltIn) : Program(context, isBuiltIn) {}
char *setGenBinary(char *binary) { char *setGenBinary(char *binary) {
auto res = genBinary; auto res = genBinary;
genBinary = binary; genBinary = binary;
@ -1679,7 +1679,7 @@ TEST_F(ProgramTests, ProgramCtorSetsProperInternalOptions) {
DebugManager.flags.DisableStatelessToStatefulOptimization.set(false); DebugManager.flags.DisableStatelessToStatefulOptimization.set(false);
if (pDevice) { if (pDevice) {
MockProgram program(pContext); MockProgram program(pContext, false);
char paramValue[32]; char paramValue[32];
pDevice->getDeviceInfo(CL_DEVICE_VERSION, 32, paramValue, 0); pDevice->getDeviceInfo(CL_DEVICE_VERSION, 32, paramValue, 0);
if (strstr(paramValue, "2.1")) { if (strstr(paramValue, "2.1")) {
@ -1702,7 +1702,7 @@ TEST_F(ProgramTests, ProgramCtorSetsProperInternalOptionsForced20) {
pDevice->getMutableDeviceInfo()->clVersion = "OpenCL 2.0 "; pDevice->getMutableDeviceInfo()->clVersion = "OpenCL 2.0 ";
if (pDevice) { if (pDevice) {
MockProgram program(pContext); MockProgram program(pContext, false);
char paramValue[32]; char paramValue[32];
pDevice->getDeviceInfo(CL_DEVICE_VERSION, 32, paramValue, 0); pDevice->getDeviceInfo(CL_DEVICE_VERSION, 32, paramValue, 0);
ASSERT_EQ(std::string(paramValue), "OpenCL 2.0 "); ASSERT_EQ(std::string(paramValue), "OpenCL 2.0 ");
@ -1717,7 +1717,7 @@ TEST_F(ProgramTests, ProgramCtorSetsProperInternalOptionsWhenStatelessToStateful
DebugManager.flags.DisableStatelessToStatefulOptimization.set(true); DebugManager.flags.DisableStatelessToStatefulOptimization.set(true);
if (pDevice) { if (pDevice) {
MockProgram program(pContext); MockProgram program(pContext, false);
char paramValue[32]; char paramValue[32];
pDevice->getDeviceInfo(CL_DEVICE_VERSION, 32, paramValue, 0); pDevice->getDeviceInfo(CL_DEVICE_VERSION, 32, paramValue, 0);
if (strstr(paramValue, "2.1")) { if (strstr(paramValue, "2.1")) {
@ -1746,7 +1746,7 @@ TEST_F(ProgramTests, ProgramCtorSetsProperInternalOptionsWhenForcing32BitAddress
DebugManager.flags.DisableStatelessToStatefulOptimization.set(false); DebugManager.flags.DisableStatelessToStatefulOptimization.set(false);
if (pDevice) { if (pDevice) {
const_cast<DeviceInfo *>(&pDevice->getDeviceInfo())->force32BitAddressess = true; const_cast<DeviceInfo *>(&pDevice->getDeviceInfo())->force32BitAddressess = true;
MockProgram program(pContext); MockProgram program(pContext, false);
char paramValue[32]; char paramValue[32];
pDevice->getDeviceInfo(CL_DEVICE_VERSION, 32, paramValue, 0); pDevice->getDeviceInfo(CL_DEVICE_VERSION, 32, paramValue, 0);
if (strstr(paramValue, "2.1")) { if (strstr(paramValue, "2.1")) {
@ -1841,7 +1841,7 @@ TEST_F(ProgramTests, BuiltinProgramCreateSetsProperInternalOptionsEnablingStatel
TEST_F(ProgramTests, ProgramCtorSetsProperProgramScopePatchListSize) { TEST_F(ProgramTests, ProgramCtorSetsProperProgramScopePatchListSize) {
MockProgram program(pContext); MockProgram program(pContext, false);
EXPECT_EQ((size_t)0, program.getProgramScopePatchListSize()); EXPECT_EQ((size_t)0, program.getProgramScopePatchListSize());
} }
@ -1850,7 +1850,7 @@ TEST_F(ProgramTests, GivenContextWhenCreateProgramThenIncrementContextRefCount)
auto initialInternalRefCount = pContext->getRefInternalCount(); auto initialInternalRefCount = pContext->getRefInternalCount();
MockProgram tempProgram; MockProgram tempProgram;
MockProgram *program = new MockProgram(pContext); MockProgram *program = new MockProgram(pContext, false);
EXPECT_EQ(pContext->getReference(), initialApiRefCount); EXPECT_EQ(pContext->getReference(), initialApiRefCount);
EXPECT_EQ(pContext->getRefInternalCount(), initialInternalRefCount + 1); EXPECT_EQ(pContext->getRefInternalCount(), initialInternalRefCount + 1);
@ -2477,7 +2477,7 @@ TEST_F(ProgramTests, GetProgramCompilerVersion) {
} }
TEST_F(ProgramTests, GivenZeroPrivateSizeInBlockWhenAllocateBlockProvateSurfacesCalledThenNoSurfaceIsCreated) { TEST_F(ProgramTests, GivenZeroPrivateSizeInBlockWhenAllocateBlockProvateSurfacesCalledThenNoSurfaceIsCreated) {
MockProgram *program = new MockProgram(pContext); MockProgram *program = new MockProgram(pContext, false);
uint32_t crossThreadOffsetBlock = 0; uint32_t crossThreadOffsetBlock = 0;
@ -2503,7 +2503,7 @@ TEST_F(ProgramTests, GivenZeroPrivateSizeInBlockWhenAllocateBlockProvateSurfaces
} }
TEST_F(ProgramTests, GivenNonZeroPrivateSizeInBlockWhenAllocateBlockProvateSurfacesCalledThenSurfaceIsCreated) { TEST_F(ProgramTests, GivenNonZeroPrivateSizeInBlockWhenAllocateBlockProvateSurfacesCalledThenSurfaceIsCreated) {
MockProgram *program = new MockProgram(pContext); MockProgram *program = new MockProgram(pContext, false);
uint32_t crossThreadOffsetBlock = 0; uint32_t crossThreadOffsetBlock = 0;
@ -2529,7 +2529,7 @@ TEST_F(ProgramTests, GivenNonZeroPrivateSizeInBlockWhenAllocateBlockProvateSurfa
} }
TEST_F(ProgramTests, GivenNonZeroPrivateSizeInBlockWhenAllocateBlockProvateSurfacesCalledThenSecondSurfaceIsNotCreated) { TEST_F(ProgramTests, GivenNonZeroPrivateSizeInBlockWhenAllocateBlockProvateSurfacesCalledThenSecondSurfaceIsNotCreated) {
MockProgram *program = new MockProgram(pContext); MockProgram *program = new MockProgram(pContext, false);
uint32_t crossThreadOffsetBlock = 0; uint32_t crossThreadOffsetBlock = 0;
@ -2563,7 +2563,7 @@ TEST_F(ProgramTests, GivenNonZeroPrivateSizeInBlockWhenAllocateBlockProvateSurfa
} }
TEST_F(ProgramTests, freeBlockPrivateSurfacesFreesGraphicsAllocationsFromBlockKernelManager) { TEST_F(ProgramTests, freeBlockPrivateSurfacesFreesGraphicsAllocationsFromBlockKernelManager) {
MockProgram *program = new MockProgram(pContext); MockProgram *program = new MockProgram(pContext, false);
uint32_t crossThreadOffsetBlock = 0; uint32_t crossThreadOffsetBlock = 0;
@ -2610,7 +2610,7 @@ TEST_F(Program32BitTests, givenDeviceWithForce32BitAddressingOnWhenBultinIsCreat
} }
TEST_F(Program32BitTests, givenDeviceWithForce32BitAddressingOnWhenProgramIsCreatedThen32bitFlagIsPassedAsInternalOption) { TEST_F(Program32BitTests, givenDeviceWithForce32BitAddressingOnWhenProgramIsCreatedThen32bitFlagIsPassedAsInternalOption) {
MockProgram pProgram(pContext); MockProgram pProgram(pContext, false);
auto &internalOptions = pProgram.getInternalOptions(); auto &internalOptions = pProgram.getInternalOptions();
std::string s1 = internalOptions; std::string s1 = internalOptions;
size_t pos = s1.find("-m32"); size_t pos = s1.find("-m32");
@ -2624,7 +2624,7 @@ TEST_F(Program32BitTests, givenDeviceWithForce32BitAddressingOnWhenProgramIsCrea
TEST_F(Program32BitTests, givenDeviceWhenProgramIsCreatedThenProgramCountInDeviceIncreases) { TEST_F(Program32BitTests, givenDeviceWhenProgramIsCreatedThenProgramCountInDeviceIncreases) {
auto device = pContext->getDevice(0); auto device = pContext->getDevice(0);
EXPECT_EQ(0u, device->getProgramCount()); EXPECT_EQ(0u, device->getProgramCount());
MockProgram pProgram(pContext); MockProgram pProgram(pContext, false);
EXPECT_EQ(1u, device->getProgramCount()); EXPECT_EQ(1u, device->getProgramCount());
} }
@ -2638,8 +2638,8 @@ TEST_F(ProgramTests, givenNewProgramTheStatelessToStatefulBufferOffsetOtimizatio
template <int32_t ErrCodeToReturn, bool spirv = true> template <int32_t ErrCodeToReturn, bool spirv = true>
struct CreateProgramFromBinaryMock : MockProgram { struct CreateProgramFromBinaryMock : MockProgram {
using MockProgram::MockProgram; using MockProgram::MockProgram;
CreateProgramFromBinaryMock(Context *context, bool isBuiltIn = false) CreateProgramFromBinaryMock(Context *context, bool isBuiltIn)
: MockProgram(context) { : MockProgram(context, isBuiltIn) {
} }
cl_int createProgramFromBinary(const void *pBinary, cl_int createProgramFromBinary(const void *pBinary,
@ -2771,7 +2771,7 @@ TEST_F(ProgramTests, linkingTwoValidSpirvProgramsReturnsValidProgram) {
} }
TEST_F(ProgramTests, givenSeparateBlockKernelsWhenNoParentAndSubgroupKernelsThenSeparateNoneKernel) { TEST_F(ProgramTests, givenSeparateBlockKernelsWhenNoParentAndSubgroupKernelsThenSeparateNoneKernel) {
MockProgram program(pContext); MockProgram program(pContext, false);
EXPECT_EQ(0u, program.getKernelInfoArray().size()); EXPECT_EQ(0u, program.getKernelInfoArray().size());
EXPECT_EQ(0u, program.getParentKernelInfoArray().size()); EXPECT_EQ(0u, program.getParentKernelInfoArray().size());
@ -2784,7 +2784,7 @@ TEST_F(ProgramTests, givenSeparateBlockKernelsWhenNoParentAndSubgroupKernelsThen
} }
TEST_F(ProgramTests, givenSeparateBlockKernelsWhenRegularKernelsThenSeparateNoneKernel) { TEST_F(ProgramTests, givenSeparateBlockKernelsWhenRegularKernelsThenSeparateNoneKernel) {
MockProgram program(pContext); MockProgram program(pContext, false);
auto pRegularKernel1Info = KernelInfo::create(); auto pRegularKernel1Info = KernelInfo::create();
pRegularKernel1Info->name = "regular_kernel_1"; pRegularKernel1Info->name = "regular_kernel_1";
@ -2806,7 +2806,7 @@ TEST_F(ProgramTests, givenSeparateBlockKernelsWhenRegularKernelsThenSeparateNone
} }
TEST_F(ProgramTests, givenSeparateBlockKernelsWhenChildLikeKernelWithoutParentKernelThenSeparateNoneKernel) { TEST_F(ProgramTests, givenSeparateBlockKernelsWhenChildLikeKernelWithoutParentKernelThenSeparateNoneKernel) {
MockProgram program(pContext); MockProgram program(pContext, false);
auto pParentKernelInfo = KernelInfo::create(); auto pParentKernelInfo = KernelInfo::create();
pParentKernelInfo->name = "another_parent_kernel"; pParentKernelInfo->name = "another_parent_kernel";
@ -2830,7 +2830,7 @@ TEST_F(ProgramTests, givenSeparateBlockKernelsWhenChildLikeKernelWithoutParentKe
} }
TEST_F(ProgramTests, givenSeparateBlockKernelsWhenChildLikeKernelWithoutSubgroupKernelThenSeparateNoneKernel) { TEST_F(ProgramTests, givenSeparateBlockKernelsWhenChildLikeKernelWithoutSubgroupKernelThenSeparateNoneKernel) {
MockProgram program(pContext); MockProgram program(pContext, false);
auto pSubgroupKernelInfo = KernelInfo::create(); auto pSubgroupKernelInfo = KernelInfo::create();
pSubgroupKernelInfo->name = "another_subgroup_kernel"; pSubgroupKernelInfo->name = "another_subgroup_kernel";
@ -2854,7 +2854,7 @@ TEST_F(ProgramTests, givenSeparateBlockKernelsWhenChildLikeKernelWithoutSubgroup
} }
TEST_F(ProgramTests, givenSeparateBlockKernelsWhenParentKernelWithChildKernelThenSeparateChildKernel) { TEST_F(ProgramTests, givenSeparateBlockKernelsWhenParentKernelWithChildKernelThenSeparateChildKernel) {
MockProgram program(pContext); MockProgram program(pContext, false);
auto pParentKernelInfo = KernelInfo::create(); auto pParentKernelInfo = KernelInfo::create();
pParentKernelInfo->name = "parent_kernel"; pParentKernelInfo->name = "parent_kernel";
@ -2878,7 +2878,7 @@ TEST_F(ProgramTests, givenSeparateBlockKernelsWhenParentKernelWithChildKernelThe
} }
TEST_F(ProgramTests, givenSeparateBlockKernelsWhenSubgroupKernelWithChildKernelThenSeparateChildKernel) { TEST_F(ProgramTests, givenSeparateBlockKernelsWhenSubgroupKernelWithChildKernelThenSeparateChildKernel) {
MockProgram program(pContext); MockProgram program(pContext, false);
auto pSubgroupKernelInfo = KernelInfo::create(); auto pSubgroupKernelInfo = KernelInfo::create();
pSubgroupKernelInfo->name = "subgroup_kernel"; pSubgroupKernelInfo->name = "subgroup_kernel";

View File

@ -118,7 +118,7 @@ TEST_F(ProgramWithBlockKernelsTest, GivenKernelWithBlockKernelsWhenProgramIsLink
ASSERT_NE(nullptr, pProgram); ASSERT_NE(nullptr, pProgram);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
Program *programLinked = new Program(pContext); Program *programLinked = new Program(pContext, false);
cl_program program = pProgram; cl_program program = pProgram;
retVal = pProgram->compile(1, &device, buildOptions, 0, nullptr, nullptr, nullptr, nullptr); retVal = pProgram->compile(1, &device, buildOptions, 0, nullptr, nullptr, nullptr, nullptr);