Pass ClDeviceVector to Program's ctor

Related-To: NEO-5001
Change-Id: Ie0e4395fd3ed9a5df81c7075ef039092a0687b9c
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-10-16 15:00:28 +02:00
committed by sys_ocldev
parent 10165ec9eb
commit f7dcafc295
65 changed files with 333 additions and 384 deletions

View File

@@ -1543,7 +1543,10 @@ cl_program CL_API_CALL clLinkProgram(cl_context context,
pContext = castToObject<Context>(context);
}
if (pContext != nullptr) {
program = new Program(*pContext->getDevice(0)->getExecutionEnvironment(), pContext, false, &pContext->getDevice(0)->getDevice());
ClDeviceVector deviceVector;
deviceVector.push_back(pContext->getDevice(0));
program = new Program(pContext, false, deviceVector);
retVal = program->link(numDevices, deviceList, options,
numInputPrograms, inputPrograms,
funcNotify, userData);

View File

@@ -32,7 +32,9 @@ T *Program::create(
DEBUG_BREAK_IF(!pContext);
auto device = pContext->getDevice(0);
auto program = new T(*device->getExecutionEnvironment(), pContext, false, &device->getDevice());
ClDeviceVector deviceVector;
deviceVector.push_back(device);
auto program = new T(pContext, false, deviceVector);
auto retVal = program->createProgramFromBinary(binaries[0], lengths[0], device->getRootDeviceIndex());
@@ -73,7 +75,9 @@ T *Program::create(
lengths);
if (CL_SUCCESS == retVal) {
program = new T(*pContext->getDevice(0)->getExecutionEnvironment(), pContext, false, &pContext->getDevice(0)->getDevice());
ClDeviceVector deviceVector;
deviceVector.push_back(pContext->getDevice(0));
program = new T(pContext, false, deviceVector);
program->sourceCode.swap(combinedString);
program->createdFrom = CreatedFrom::SOURCE;
}
@@ -97,7 +101,9 @@ T *Program::create(
}
if (retVal == CL_SUCCESS) {
program = new T(*device.getExecutionEnvironment(), context, isBuiltIn, &device.getDevice());
ClDeviceVector deviceVector;
deviceVector.push_back(&device);
program = new T(context, isBuiltIn, deviceVector);
program->sourceCode = nullTerminatedString;
program->createdFrom = CreatedFrom::SOURCE;
}
@@ -136,7 +142,10 @@ T *Program::createFromGenBinary(
}
if (CL_SUCCESS == retVal) {
program = new T(executionEnvironment, context, isBuiltIn, device);
ClDeviceVector deviceVector;
deviceVector.push_back(device->getSpecializedDevice<ClDevice>());
program = new T(context, isBuiltIn, deviceVector);
program->numDevices = 1;
program->replaceDeviceBinary(makeCopy(binary, size), size, device->getRootDeviceIndex());
program->isCreatedFromBinary = true;
@@ -165,7 +174,10 @@ T *Program::createFromIL(Context *context,
}
auto device = context->getDevice(0);
T *program = new T(*device->getExecutionEnvironment(), context, false, &device->getDevice());
ClDeviceVector deviceVector;
deviceVector.push_back(device);
T *program = new T(context, false, deviceVector);
errcodeRet = program->createProgramFromBinary(il, length, device->getRootDeviceIndex());
program->createdFrom = CreatedFrom::IL;

View File

@@ -34,37 +34,24 @@
namespace NEO {
Program::Program(ExecutionEnvironment &executionEnvironment, Context *context, bool isBuiltIn, Device *device) : executionEnvironment(executionEnvironment),
Program::Program(Context *context, bool isBuiltIn, const ClDeviceVector &clDevicesIn) : executionEnvironment(*clDevicesIn[0]->getExecutionEnvironment()),
context(context),
pDevice(device),
pDevice(&clDevicesIn[0]->getDevice()),
clDevices(clDevicesIn),
isBuiltIn(isBuiltIn) {
if (this->context && !this->isBuiltIn) {
this->context->incRefInternal();
}
blockKernelManager = new BlockKernelManager();
ClDevice *pClDevice = nullptr;
if (context != nullptr) {
pClDevice = context->getDevice(0);
if (pDevice == nullptr) {
pDevice = &pClDevice->getDevice();
}
} else if (pDevice != nullptr) {
auto pSpecializedDevice = castToObject<ClDevice>(pDevice->getSpecializedDevice<ClDevice>());
if (pSpecializedDevice != nullptr) {
pClDevice = pSpecializedDevice;
}
}
ClDevice *pClDevice = castToObject<ClDevice>(pDevice->getSpecializedDevice<ClDevice>());
numDevices = 1;
bool force32BitAddressess = false;
uint32_t maxRootDeviceIndex = 0u;
if (device) {
maxRootDeviceIndex = device->getRootDeviceIndex();
}
uint32_t maxRootDeviceIndex = pDevice->getRootDeviceIndex();
buildInfos.resize(maxRootDeviceIndex + 1);
if (pClDevice) {
auto enabledClVersion = pClDevice->getEnabledClVersion();
if (enabledClVersion == 30) {
internalOptions = "-ocl-version=300 ";
@@ -104,7 +91,6 @@ Program::Program(ExecutionEnvironment &executionEnvironment, Context *context, b
if (hwHelper.isForceEmuInt32DivRemSPWARequired(pClDevice->getHardwareInfo())) {
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::forceEmuInt32DivRemSP);
}
}
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::preserveVec3Type);
}

View File

@@ -14,6 +14,7 @@
#include "shared/source/utilities/const_stringref.h"
#include "opencl/source/api/cl_types.h"
#include "opencl/source/cl_device/cl_device_vector.h"
#include "opencl/source/helpers/base_object.h"
#include "opencl/source/helpers/destructor_callback.h"
@@ -131,7 +132,7 @@ class Program : public BaseObject<_cl_program> {
size_t length,
cl_int &errcodeRet);
Program(ExecutionEnvironment &executionEnvironment, Context *context, bool isBuiltIn, Device *device);
Program(Context *context, bool isBuiltIn, const ClDeviceVector &clDevices);
~Program() override;
Program(const Program &) = delete;
@@ -350,6 +351,7 @@ class Program : public BaseObject<_cl_program> {
Context *context = nullptr;
Device *pDevice = nullptr;
cl_uint numDevices = 0U;
ClDeviceVector clDevices;
bool isBuiltIn = false;
bool kernelDebugEnabled = false;

View File

@@ -30,7 +30,7 @@ class MediaImageSetArgTest : public ClDeviceFixture,
ClDeviceFixture::SetUp();
pKernelInfo = std::make_unique<KernelInfo>();
program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
pKernelInfo->heapInfo.SurfaceStateHeapSize = sizeof(surfaceStateHeap);
pKernelInfo->heapInfo.pSsh = surfaceStateHeap;

View File

@@ -28,7 +28,7 @@ void api_fixture_using_aligned_memory_manager::SetUp() {
commandQueue = new MockCommandQueue(context, device, 0);
program = new MockProgram(*device->getExecutionEnvironment(), ctxPtr, false, &device->getDevice());
program = new MockProgram(ctxPtr, false, toClDeviceVector(*device));
Program *prgPtr = reinterpret_cast<Program *>(program);
kernel = new MockKernel(prgPtr, program->mockKernelInfo, *device);

View File

@@ -48,7 +48,7 @@ struct ApiFixture {
pCommandQueue = new MockCommandQueue(pContext, pDevice, nullptr);
pProgram = new MockProgram(*pDevice->getExecutionEnvironment(), pContext, false, &pDevice->getDevice());
pProgram = new MockProgram(pContext, false, toClDeviceVector(*pDevice));
pKernel = new MockKernel(pProgram, pProgram->mockKernelInfo, *pDevice);
ASSERT_NE(nullptr, pKernel);

View File

@@ -141,7 +141,7 @@ TEST_F(clCreateKernelTests, GivenNullKernelNameWhenCreatingNewKernelThenInvalidV
cl_kernel kernel = nullptr;
KernelInfo *pKernelInfo = new KernelInfo();
std::unique_ptr<MockProgram> pMockProg = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment(), pContext, false, nullptr);
std::unique_ptr<MockProgram> pMockProg = std::make_unique<MockProgram>(pContext, false, toClDeviceVector(*pDevice));
pMockProg->addKernelInfo(pKernelInfo);
kernel = clCreateKernel(
@@ -167,7 +167,7 @@ TEST_F(clCreateKernelTests, GivenInvalidProgramWhenCreatingNewKernelThenInvalidP
TEST_F(clCreateKernelTests, GivenProgramWithBuildErrorWhenCreatingNewKernelThenInvalidProgramExecutableErrorIsReturned) {
cl_kernel kernel = nullptr;
std::unique_ptr<MockProgram> pMockProg = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment(), pContext, false, nullptr);
std::unique_ptr<MockProgram> pMockProg = std::make_unique<MockProgram>(pContext, false, toClDeviceVector(*pDevice));
pMockProg->setBuildStatus(CL_BUILD_ERROR);
kernel = clCreateKernel(

View File

@@ -175,7 +175,7 @@ TEST_F(clLinkProgramTests, GivenProgramsWithSpecConstantsThenSpecConstantsAreEmb
uint32_t prog2Keys[1] = {11};
uint64_t prog2Values[1] = {13};
auto progSrc1 = clUniquePtr(new MockProgram(*pProgram->getDevice().getExecutionEnvironment(), pContext, false, pProgram->pDevice));
auto progSrc1 = clUniquePtr(new MockProgram(pContext, false, toClDeviceVector(*pDevice)));
progSrc1->pDevice = pProgram->pDevice;
progSrc1->specConstantsValues[prog1Keys[0]] = prog1Values[0];
progSrc1->specConstantsValues[prog1Keys[1]] = prog1Values[1];
@@ -184,7 +184,7 @@ TEST_F(clLinkProgramTests, GivenProgramsWithSpecConstantsThenSpecConstantsAreEmb
progSrc1->irBinarySize = sizeof(ir1);
progSrc1->isSpirV = true;
auto progSrc2 = clUniquePtr(new MockProgram(*pProgram->getDevice().getExecutionEnvironment(), pContext, false, pProgram->pDevice));
auto progSrc2 = clUniquePtr(new MockProgram(pContext, false, toClDeviceVector(*pDevice)));
progSrc2->pDevice = pProgram->pDevice;
progSrc2->specConstantsValues[prog2Keys[0]] = prog2Values[0];
progSrc2->areSpecializationConstantsInitialized = true;
@@ -192,13 +192,13 @@ TEST_F(clLinkProgramTests, GivenProgramsWithSpecConstantsThenSpecConstantsAreEmb
progSrc2->irBinarySize = sizeof(ir2);
progSrc2->isSpirV = true;
auto progSrc3 = clUniquePtr(new MockProgram(*pProgram->getDevice().getExecutionEnvironment(), pContext, false, pProgram->pDevice));
auto progSrc3 = clUniquePtr(new MockProgram(pContext, false, toClDeviceVector(*pDevice)));
progSrc3->pDevice = pProgram->pDevice;
progSrc3->irBinary = makeCopy(ir3, sizeof(ir3));
progSrc3->irBinarySize = sizeof(ir3);
progSrc3->isSpirV = true;
auto progDst = clUniquePtr(new MockProgram(*pProgram->getDevice().getExecutionEnvironment(), pContext, false, pProgram->pDevice));
auto progDst = clUniquePtr(new MockProgram(pContext, false, toClDeviceVector(*pDevice)));
progDst->pDevice = pProgram->pDevice;
cl_program inputPrograms[3] = {progSrc1.get(), progSrc2.get(), progSrc3.get()};

View File

@@ -427,7 +427,7 @@ HWTEST_F(BuiltInTests, givenKernelWithAuxTranslationRequiredWhenEnqueueCalledThe
auto mockAuxBuiltInOp = new MockAuxBuilInOp(*pBuiltIns, *pContext, *pDevice);
pBuiltIns->BuiltinOpsBuilders[static_cast<uint32_t>(EBuiltInOps::AuxTranslation)].first.reset(mockAuxBuiltInOp);
auto mockProgram = clUniquePtr(new MockProgram(*pDevice->getExecutionEnvironment()));
auto mockProgram = clUniquePtr(new MockProgram(toClDeviceVector(*pClDevice)));
auto mockBuiltinKernel = MockKernel::create(*pDevice, mockProgram.get());
mockAuxBuiltInOp->usedKernels.at(0).reset(mockBuiltinKernel);

View File

@@ -1686,7 +1686,7 @@ HWTEST_TEMPLATED_F(BlitCopyTests, givenLocalMemoryAccessNotAllowedWhenGlobalCons
mockLinkerInput->traits.exportsGlobalConstants = true;
programInfo.linkerInput = std::move(mockLinkerInput);
MockProgram program(*device->getExecutionEnvironment(), bcsMockContext.get(), false, &device->getDevice());
MockProgram program(bcsMockContext.get(), false, toClDeviceVector(*device));
EXPECT_EQ(0u, bcsMockContext->bcsCsr->peekTaskCount());

View File

@@ -1026,7 +1026,7 @@ TEST(CommandQueue, givenEnqueueAcquireSharedObjectsCallWhenAcquireFailsThenCorre
HWTEST_F(CommandQueueCommandStreamTest, givenDebugKernelWhenSetupDebugSurfaceIsCalledThenSurfaceStateIsCorrectlySet) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
program.enableKernelDebug();
std::unique_ptr<MockDebugKernel> kernel(MockKernel::create<MockDebugKernel>(*pDevice, &program));
MockCommandQueue cmdQ(context.get(), pClDevice, 0);
@@ -1046,7 +1046,7 @@ HWTEST_F(CommandQueueCommandStreamTest, givenDebugKernelWhenSetupDebugSurfaceIsC
HWTEST_F(CommandQueueCommandStreamTest, givenCsrWithDebugSurfaceAllocatedWhenSetupDebugSurfaceIsCalledThenDebugSurfaceIsReused) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
program.enableKernelDebug();
std::unique_ptr<MockDebugKernel> kernel(MockKernel::create<MockDebugKernel>(*pDevice, &program));
MockCommandQueue cmdQ(context.get(), pClDevice, 0);

View File

@@ -41,7 +41,7 @@ struct DispatchWalkerTest : public CommandQueueFixture, public ClDeviceFixture,
context = std::make_unique<MockContext>(pClDevice);
CommandQueueFixture::SetUp(context.get(), pClDevice, 0);
program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
memset(&kernelHeader, 0, sizeof(kernelHeader));
kernelHeader.KernelHeapSize = sizeof(kernelIsa);

View File

@@ -153,7 +153,7 @@ class GMockCommandQueueHw : public CommandQueueHw<GfxFamily> {
};
HWTEST_F(EnqueueDebugKernelSimpleTest, givenKernelFromProgramWithDebugEnabledWhenEnqueuedThenDebugSurfaceIsSetup) {
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
program.enableKernelDebug();
std::unique_ptr<MockDebugKernel> kernel(MockKernel::create<MockDebugKernel>(*pDevice, &program));
kernel->setContext(context);
@@ -172,7 +172,7 @@ HWTEST_F(EnqueueDebugKernelSimpleTest, givenKernelFromProgramWithDebugEnabledWhe
}
HWTEST_F(EnqueueDebugKernelSimpleTest, givenKernelWithoutSystemThreadSurfaceWhenEnqueuedThenDebugSurfaceIsNotSetup) {
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
program.enableKernelDebug();
std::unique_ptr<MockKernel> kernel(MockKernel::create<MockKernel>(*pDevice, &program));
kernel->setContext(context);
@@ -191,7 +191,7 @@ HWTEST_F(EnqueueDebugKernelSimpleTest, givenKernelWithoutSystemThreadSurfaceWhen
}
HWTEST_F(EnqueueDebugKernelSimpleTest, givenKernelFromProgramWithoutDebugEnabledWhenEnqueuedThenDebugSurfaceIsNotSetup) {
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
std::unique_ptr<MockDebugKernel> kernel(MockKernel::create<MockDebugKernel>(*pDevice, &program));
kernel->setContext(context);
std::unique_ptr<NiceMock<GMockCommandQueueHw<FamilyType>>> mockCmdQ(new NiceMock<GMockCommandQueueHw<FamilyType>>(context, pClDevice, nullptr));
@@ -208,7 +208,7 @@ HWTEST_F(EnqueueDebugKernelSimpleTest, givenKernelFromProgramWithoutDebugEnabled
using ActiveDebuggerTest = EnqueueDebugKernelTest;
HWTEST_F(ActiveDebuggerTest, givenKernelFromProgramWithoutDebugEnabledAndActiveDebuggerWhenEnqueuedThenDebugSurfaceIsSetup) {
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
std::unique_ptr<MockDebugKernel> kernel(MockKernel::create<MockDebugKernel>(*pDevice, &program));
kernel->setContext(&context);
std::unique_ptr<CommandQueueHw<FamilyType>> cmdQ(new CommandQueueHw<FamilyType>(&context, pClDevice, nullptr, false));

View File

@@ -21,7 +21,7 @@ struct AubSubCaptureTest : public ClDeviceFixture,
public ::testing::Test {
void SetUp() override {
ClDeviceFixture::SetUp();
program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
kernelInfo.name = "kernel_name";
dbgRestore = new DebugManagerStateRestore();
}

View File

@@ -1620,7 +1620,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenBlockedKernelWhenItIsUnblocke
uint32_t numGrfRequired = 666u;
auto pCmdQ = std::make_unique<MockCommandQueue>(&mockContext, pClDevice, nullptr);
auto mockProgram = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment(), &mockContext, false, pDevice);
auto mockProgram = std::make_unique<MockProgram>(&mockContext, false, toClDeviceVector(*pClDevice));
std::unique_ptr<MockKernel> pKernel(MockKernel::create(*pDevice, mockProgram.get(), numGrfRequired));
auto event = std::make_unique<MockEvent<Event>>(pCmdQ.get(), CL_COMMAND_MARKER, 0, 0);

View File

@@ -288,7 +288,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueTest, WhenDeviceQueueIsCreatedThenDshBuff
HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueTest, WhenDispatchingSchedulerThenNoAssertsOccur) {
DeviceQueue devQueue;
MockContext context;
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
MockCommandQueue cmdQ(nullptr, nullptr, 0);
KernelInfo info;
MockSchedulerKernel *kernel = new MockSchedulerKernel(&program, info, *device);

View File

@@ -42,7 +42,7 @@ void DevicePreemptionTests::SetUp() {
executionEnvironment.reset(new SPatchExecutionEnvironment);
memset(executionEnvironment.get(), 0, sizeof(SPatchExecutionEnvironment));
kernelInfo->patchInfo.executionEnvironment = executionEnvironment.get();
program = std::make_unique<MockProgram>(*device->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*device));
kernel.reset(new MockKernel(program.get(), *kernelInfo, *device));
dispatchInfo.reset(new DispatchInfo(kernel.get(), 1, Vec3<size_t>(1, 1, 1), Vec3<size_t>(1, 1, 1), Vec3<size_t>(0, 0, 0)));

View File

@@ -56,7 +56,7 @@ void KernelImageArgTest::SetUp() {
pKernelInfo->kernelArgInfo[0].isImage = true;
ClDeviceFixture::SetUp();
program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
pKernel.reset(new MockKernel(program.get(), *pKernelInfo, *pClDevice));
ASSERT_EQ(CL_SUCCESS, pKernel->initialize());

View File

@@ -53,7 +53,7 @@ class KernelDataTest : public testing::Test {
void SetUp() override {
kernelBinaryHeader.KernelNameSize = kernelNameSize;
pContext = new MockContext;
program = std::make_unique<MockProgram>(*pContext->getDevice(0)->getExecutionEnvironment(), pContext, false, nullptr);
program = std::make_unique<MockProgram>(pContext, false, toClDeviceVector(*pContext->getDevice(0)));
}
void TearDown() override {

View File

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

View File

@@ -51,7 +51,7 @@ struct HardwareInterfaceTests : public ClDeviceFixture, public LinearStreamFixtu
pContext = new NEO::MockContext(pClDevice);
pCommandQueue = new MockCommandQueue(pContext, pClDevice, nullptr);
pProgram = new MockProgram(*pClDevice->getExecutionEnvironment(), pContext, false, &pClDevice->getDevice());
pProgram = new MockProgram(pContext, false, toClDeviceVector(*pClDevice));
pKernel = new MockKernelWithApplicableWa(static_cast<Program *>(pProgram), pProgram->mockKernelInfo, *pClDevice);
}

View File

@@ -2385,7 +2385,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenOnKernelSubitIsCalledThenCo
pKernelInfo->heapInfo.SurfaceStateHeapSize = sizeof(surfaceStateHeap);
pKernelInfo->usesSsh = true;
auto pProgramm = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment(), context.get(), false, nullptr);
auto pProgramm = std::make_unique<MockProgram>(context.get(), false, toClDeviceVector(*pDevice));
std::unique_ptr<MockCommandQueue> cmdQ(new MockCommandQueue(context.get(), pDevice, nullptr));
std::unique_ptr<MockKernel> pKernel(new MockKernel(pProgramm.get(), *pKernelInfo, *pDevice));

View File

@@ -23,6 +23,7 @@
#include "opencl/test/unit_test/mocks/mock_buffer.h"
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
#include "opencl/test/unit_test/mocks/mock_platform.h"
#include "opencl/test/unit_test/mocks/mock_program.h"
#include "gmock/gmock.h"
@@ -85,11 +86,10 @@ class MockObject<Buffer> : public MockObjectBase<Buffer> {
template <>
class MockObject<Program> : public MockObjectBase<Program> {
public:
MockObject() : MockObjectBase<Program>(*new ExecutionEnvironment(), nullptr, false, nullptr),
executionEnvironment(&this->peekExecutionEnvironment()) {}
MockObject() : MockObjectBase<Program>(nullptr, false, toClDeviceVector(*(new MockClDevice(new MockDevice())))), device(this->clDevices[0]) {}
private:
std::unique_ptr<ExecutionEnvironment> executionEnvironment;
std::unique_ptr<ClDevice> device;
};
typedef ::testing::Types<

View File

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

View File

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

View File

@@ -177,7 +177,7 @@ HWTEST_F(HardwareCommandsTest, givenSendCrossThreadDataWhenWhenAddPatchInfoComme
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
auto kernelInfo = std::make_unique<KernelInfo>();
std::unique_ptr<MockKernel> kernel(new MockKernel(&program, *kernelInfo, *pClDevice));
@@ -243,7 +243,7 @@ HWTEST_F(HardwareCommandsTest, givenSendCrossThreadDataWhenWhenAddPatchInfoComme
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
auto kernelInfo = std::make_unique<KernelInfo>();
std::unique_ptr<MockKernel> kernel(new MockKernel(&program, *kernelInfo, *pClDevice));
@@ -711,7 +711,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, WhenGettingBindingTableStateTh
// create program with valid context
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
// setup global memory
char globalBuffer[16];
@@ -838,7 +838,7 @@ HWTEST_F(HardwareCommandsTest, GivenBuffersNotRequiringSshWhenSettingBindingTabl
// create program with valid context
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
// create kernel
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
@@ -893,7 +893,7 @@ HWTEST_F(HardwareCommandsTest, GivenZeroSurfaceStatesWhenSettingBindingTableStat
// create program with valid context
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
// create kernel
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);

View File

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

View File

@@ -18,7 +18,7 @@ using namespace NEO;
TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetDebugSurfaceBtiIsCalledThenCorrectValueIsReturned) {
auto device = std::make_unique<MockClDevice>(new MockDevice);
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
program.enableKernelDebug();
std::unique_ptr<MockKernel> kernel(MockKernel::create<MockDebugKernel>(device->getDevice(), &program));
@@ -27,7 +27,7 @@ TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetDebugSurfaceBtiIsCal
TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetPerThreadSystemThreadSurfaceSizeIsCalledThenCorrectValueIsReturned) {
auto device = std::make_unique<MockClDevice>(new MockDevice);
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
program.enableKernelDebug();
std::unique_ptr<MockDebugKernel> kernel(MockKernel::create<MockDebugKernel>(device->getDevice(), &program));
@@ -36,7 +36,7 @@ TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetPerThreadSystemThrea
TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenQueryingIsKernelDebugEnabledThenTrueIsReturned) {
auto device = std::make_unique<MockClDevice>(new MockDevice);
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
program.enableKernelDebug();
std::unique_ptr<MockKernel> kernel(MockKernel::create<MockDebugKernel>(device->getDevice(), &program));
kernel->initialize();
@@ -46,7 +46,7 @@ TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenQueryingIsKernelDebugEn
TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenQueryingIsKernelDebugEnabledThenFalseIsReturned) {
auto device = std::make_unique<MockClDevice>(new MockDevice);
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
program.enableKernelDebug();
std::unique_ptr<MockKernel> kernel(MockKernel::create<MockKernel>(device->getDevice(), &program));
kernel->initialize();
@@ -56,7 +56,7 @@ TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenQueryingIsKernelDebugEnable
TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetDebugSurfaceBtiIsCalledThenInvalidIndexValueIsReturned) {
auto device = std::make_unique<MockClDevice>(new MockDevice);
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
program.enableKernelDebug();
std::unique_ptr<MockKernel> kernel(MockKernel::create<MockKernel>(device->getDevice(), &program));
@@ -65,7 +65,7 @@ TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetDebugSurfaceBtiIsCalledT
TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetPerThreadSystemThreadSurfaceSizeIsCalledThenZeroIsReturned) {
auto device = std::make_unique<MockClDevice>(new MockDevice);
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
program.enableKernelDebug();
std::unique_ptr<MockKernel> kernel(MockKernel::create<MockKernel>(device->getDevice(), &program));

View File

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

View File

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

View File

@@ -32,7 +32,7 @@ struct KernelArgDevQueueTest : public DeviceHostQueueFixture<DeviceQueue> {
pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector.push_back(kernelArgPatchInfo);
program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*pDevice));
pKernel = new MockKernel(program.get(), *pKernelInfo, *pDevice);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize());

View File

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

View File

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

View File

@@ -27,7 +27,7 @@ class KernelArgImmediateTest : public Test<ClDeviceFixture> {
void SetUp() override {
ClDeviceFixture::SetUp();
memset(pCrossThreadData, 0xfe, sizeof(pCrossThreadData));
program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
// define kernel info
pKernelInfo = std::make_unique<KernelInfo>();
@@ -56,7 +56,7 @@ class KernelArgImmediateTest : public Test<ClDeviceFixture> {
pKernelInfo->kernelArgInfo[1].kernelArgPatchInfoVector[0].size = sizeof(T);
pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].size = sizeof(T);
program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
pKernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize());
pKernel->setCrossThreadData(pCrossThreadData, sizeof(pCrossThreadData));

View File

@@ -604,7 +604,7 @@ TEST_P(KernelReflectionSurfaceTest, WhenGettingCurbeParamsThenTokenMaskIsCorrect
TEST(KernelReflectionSurfaceTestSingle, GivenNonParentKernelWhenCreatingKernelReflectionSurfaceThenKernelReflectionSurfaceIsNotCreated) {
MockClDevice device{new MockDevice};
MockProgram program(*device.getExecutionEnvironment());
MockProgram program(toClDeviceVector(device));
KernelInfo info;
MockKernel kernel(&program, info, device);
@@ -622,7 +622,7 @@ TEST(KernelReflectionSurfaceTestSingle, GivenNonSchedulerKernelWithForcedSchedul
DebugManager.flags.ForceDispatchScheduler.set(true);
MockClDevice device{new MockDevice};
MockProgram program(*device.getExecutionEnvironment());
MockProgram program(toClDeviceVector(device));
KernelInfo info;
MockKernel kernel(&program, info, device);
@@ -639,7 +639,7 @@ TEST(KernelReflectionSurfaceTestSingle, GivenNoKernelArgsWhenObtainingKernelRefl
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(defaultHwInfo);
MockContext context;
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
KernelInfo *blockInfo = new KernelInfo;
KernelInfo &info = *blockInfo;
cl_queue_properties properties[1] = {0};
@@ -688,7 +688,7 @@ TEST(KernelReflectionSurfaceTestSingle, GivenDeviceQueueKernelArgWhenObtainingKe
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(defaultHwInfo);
MockContext context;
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
KernelInfo *blockInfo = new KernelInfo;
KernelInfo &info = *blockInfo;
@@ -2109,7 +2109,7 @@ using KernelReflectionMultiDeviceTest = MultiRootDeviceFixture;
TEST_F(KernelReflectionMultiDeviceTest, GivenNoKernelArgsWhenObtainingKernelReflectionSurfaceThenParamsAreCorrect) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(device.get());
MockProgram program(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice());
MockProgram program(context.get(), false, toClDeviceVector(*device));
KernelInfo *blockInfo = new KernelInfo;
KernelInfo &info = *blockInfo;
cl_queue_properties properties[1] = {0};
@@ -2158,7 +2158,7 @@ TEST_F(KernelReflectionMultiDeviceTest, GivenNoKernelArgsWhenObtainingKernelRefl
TEST_F(KernelReflectionMultiDeviceTest, GivenDeviceQueueKernelArgWhenObtainingKernelReflectionSurfaceThenParamsAreCorrect) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(device.get());
MockProgram program(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice());
MockProgram program(context.get(), false, toClDeviceVector(*device));
KernelInfo *blockInfo = new KernelInfo;
KernelInfo &info = *blockInfo;

View File

@@ -39,7 +39,7 @@ class KernelSlmArgTest : public Test<ClDeviceFixture> {
pKernelInfo->kernelArgInfo[2].slmAlignment = 0x400;
pKernelInfo->workloadInfo.slmStaticSize = 3 * KB;
program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
pKernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize());

View File

@@ -20,7 +20,7 @@ struct KernelSLMAndBarrierTest : public ClDeviceFixture,
public ::testing::TestWithParam<uint32_t> {
void SetUp() override {
ClDeviceFixture::SetUp();
program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
memset(&dataParameterStream, 0, sizeof(dataParameterStream));
dataParameterStream.DataParameterStreamSize = sizeof(crossThreadData);

View File

@@ -579,7 +579,7 @@ TEST_F(KernelPrivateSurfaceTest, WhenChangingResidencyThenCsrResidencySizeIsUpda
// create kernel
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize());
@@ -617,7 +617,7 @@ TEST_F(KernelPrivateSurfaceTest, givenKernelWithPrivateSurfaceThatIsInUseByGpuWh
pKernelInfo->patchInfo.executionEnvironment = &tokenEE;
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
std::unique_ptr<MockKernel> pKernel(new MockKernel(&program, *pKernelInfo, *pClDevice));
pKernel->initialize();
@@ -661,7 +661,7 @@ TEST_F(KernelPrivateSurfaceTest, WhenPrivateSurfaceAllocationFailsThenOutOfResou
// create kernel
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
MemoryManagementFixture::InjectedFunction method = [&](size_t failureIndex) {
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
@@ -706,7 +706,7 @@ TEST_F(KernelPrivateSurfaceTest, given32BitDeviceWhenKernelIsCreatedThenPrivateS
// create kernel
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize());
@@ -738,7 +738,7 @@ HWTEST_F(KernelPrivateSurfaceTest, givenStatefulKernelWhenKernelIsCreatedThenPri
pKernelInfo->patchInfo.pAllocateStatelessPrivateSurface = &AllocateStatelessPrivateMemorySurface;
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
// create kernel
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
@@ -785,7 +785,7 @@ TEST_F(KernelPrivateSurfaceTest, givenStatelessKernelWhenKernelIsCreatedThenPriv
MockGraphicsAllocation gfxAlloc(buffer, sizeof(buffer));
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
program.setConstantSurface(&gfxAlloc);
// create kernel
@@ -830,7 +830,7 @@ TEST_F(KernelPrivateSurfaceTest, GivenKernelWhenPrivateSurfaceTooBigAndGpuPointe
pKernelInfo->patchInfo.pAllocateStatelessPrivateSurface = pAllocateStatelessPrivateSurface.get();
pKernelInfo->patchInfo.executionEnvironment = executionEnvironment.get();
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
std::unique_ptr<MockKernel> pKernel(new MockKernel(&program, *pKernelInfo, *pClDevice));
pKernelInfo->gpuPointerSize = 4;
pDevice->getMemoryManager()->setForce32BitAllocations(false);
@@ -849,7 +849,7 @@ TEST_F(KernelPrivateSurfaceTest, GivenKernelWhenPrivateSurfaceTooBigAndGpuPointe
pKernelInfo->patchInfo.pAllocateStatelessPrivateSurface = pAllocateStatelessPrivateSurface.get();
pKernelInfo->patchInfo.executionEnvironment = executionEnvironment.get();
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
std::unique_ptr<MockKernel> pKernel(new MockKernel(&program, *pKernelInfo, *pClDevice));
pKernelInfo->gpuPointerSize = 4;
pDevice->getMemoryManager()->setForce32BitAllocations(true);
@@ -868,7 +868,7 @@ TEST_F(KernelPrivateSurfaceTest, GivenKernelWhenPrivateSurfaceTooBigAndGpuPointe
pKernelInfo->patchInfo.pAllocateStatelessPrivateSurface = pAllocateStatelessPrivateSurface.get();
pKernelInfo->patchInfo.executionEnvironment = executionEnvironment.get();
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
std::unique_ptr<MockKernel> pKernel(new MockKernel(&program, *pKernelInfo, *pClDevice));
pKernelInfo->gpuPointerSize = 8;
pDevice->getMemoryManager()->setForce32BitAllocations(true);
@@ -906,7 +906,7 @@ TEST_F(KernelGlobalSurfaceTest, givenBuiltInKernelWhenKernelIsCreatedThenGlobalS
// create kernel
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
program.setGlobalSurface(&gfxAlloc);
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
@@ -948,7 +948,7 @@ TEST_F(KernelGlobalSurfaceTest, givenNDRangeKernelWhenKernelIsCreatedThenGlobalS
uint64_t bufferAddress = gfxAlloc.getGpuAddress();
// create kernel
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
program.setGlobalSurface(&gfxAlloc);
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
@@ -985,7 +985,7 @@ HWTEST_F(KernelGlobalSurfaceTest, givenStatefulKernelWhenKernelIsCreatedThenGlob
auto bufferAddress = gfxAlloc.getGpuAddress();
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
program.setGlobalSurface(&gfxAlloc);
// create kernel
@@ -1031,7 +1031,7 @@ TEST_F(KernelGlobalSurfaceTest, givenStatelessKernelWhenKernelIsCreatedThenGloba
char buffer[16];
MockGraphicsAllocation gfxAlloc(buffer, sizeof(buffer));
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
program.setGlobalSurface(&gfxAlloc);
// create kernel
@@ -1078,7 +1078,7 @@ TEST_F(KernelConstantSurfaceTest, givenBuiltInKernelWhenKernelIsCreatedThenConst
uint64_t bufferAddress = (uint64_t)gfxAlloc.getUnderlyingBuffer();
// create kernel
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
program.setConstantSurface(&gfxAlloc);
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
@@ -1120,7 +1120,7 @@ TEST_F(KernelConstantSurfaceTest, givenNDRangeKernelWhenKernelIsCreatedThenConst
uint64_t bufferAddress = gfxAlloc.getGpuAddress();
// create kernel
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
program.setConstantSurface(&gfxAlloc);
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
@@ -1157,7 +1157,7 @@ HWTEST_F(KernelConstantSurfaceTest, givenStatefulKernelWhenKernelIsCreatedThenCo
auto bufferAddress = gfxAlloc.getGpuAddress();
MockContext context;
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
program.setConstantSurface(&gfxAlloc);
// create kernel
@@ -1203,7 +1203,7 @@ TEST_F(KernelConstantSurfaceTest, givenStatelessKernelWhenKernelIsCreatedThenCon
char buffer[16];
MockGraphicsAllocation gfxAlloc(buffer, sizeof(buffer));
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
program.setConstantSurface(&gfxAlloc);
// create kernel
@@ -1242,7 +1242,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelEventPoolSurfaceTest, givenStatefulKernelWhenK
pKernelInfo->patchInfo.pAllocateStatelessEventPoolSurface = &AllocateStatelessEventPoolSurface;
// create kernel
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
// setup surface state heap
@@ -1291,7 +1291,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelEventPoolSurfaceTest, givenStatefulKernelWhenE
pKernelInfo->patchInfo.pAllocateStatelessEventPoolSurface = &AllocateStatelessEventPoolSurface;
// create kernel
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
// setup surface state heap
@@ -1334,7 +1334,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelEventPoolSurfaceTest, givenKernelWithNullEvent
pKernelInfo->patchInfo.pAllocateStatelessEventPoolSurface = nullptr;
// create kernel
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
// define stateful path
@@ -1372,7 +1372,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelEventPoolSurfaceTest, givenStatelessKernelWhen
pKernelInfo->patchInfo.pAllocateStatelessEventPoolSurface = &AllocateStatelessEventPoolSurface;
// create kernel
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
// define stateful path
@@ -1408,7 +1408,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelEventPoolSurfaceTest, givenStatelessKernelWhen
pKernelInfo->patchInfo.pAllocateStatelessEventPoolSurface = &AllocateStatelessEventPoolSurface;
// create kernel
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
// define stateful path
@@ -1446,7 +1446,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelDefaultDeviceQueueSurfaceTest, givenStatefulKe
pKernelInfo->patchInfo.pAllocateStatelessDefaultDeviceQueueSurface = &AllocateStatelessDefaultDeviceQueueSurface;
// create kernel
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
// setup surface state heap
@@ -1495,7 +1495,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelDefaultDeviceQueueSurfaceTest, givenStatefulKe
pKernelInfo->patchInfo.pAllocateStatelessDefaultDeviceQueueSurface = &AllocateStatelessDefaultDeviceQueueSurface;
// create kernel
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false, pDevice);
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
// setup surface state heap
@@ -1546,7 +1546,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelDefaultDeviceQueueSurfaceTest, givenStatelessK
pKernelInfo->patchInfo.pAllocateStatelessDefaultDeviceQueueSurface = &AllocateStatelessDefaultDeviceQueueSurface;
// create kernel
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
// define stateful path
@@ -1574,7 +1574,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelDefaultDeviceQueueSurfaceTest, givenKernelWith
pKernelInfo->patchInfo.pAllocateStatelessDefaultDeviceQueueSurface = nullptr;
// create kernel
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
// define stateful path
@@ -1612,7 +1612,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelDefaultDeviceQueueSurfaceTest, givenStatelessK
pKernelInfo->patchInfo.pAllocateStatelessDefaultDeviceQueueSurface = &AllocateStatelessDefaultDeviceQueueSurface;
// create kernel
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice);
// define stateful path
@@ -1656,7 +1656,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenMakeResidentIsCalledThenKernelIsaIs
pKernelInfo->kernelArgInfo[1].kernelArgPatchInfoVector[0].crossthreadOffset = 0x20;
pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].crossthreadOffset = 0x30;
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
MockContext ctx;
program.setContext(&ctx);
std::unique_ptr<MockKernel> pKernel(new MockKernel(&program, *pKernelInfo, *pClDevice));
@@ -1679,7 +1679,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenMakeResidentIsCalledThenExportedFun
auto memoryManager = commandStreamReceiver.getMemoryManager();
pKernelInfo->kernelAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
auto exportedFunctionsSurface = std::make_unique<MockGraphicsAllocation>();
program.buildInfos[pDevice->getRootDeviceIndex()].exportedFunctionsSurface = exportedFunctionsSurface.get();
MockContext ctx;
@@ -1717,7 +1717,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenMakeResidentIsCalledThenGlobalBuffe
auto memoryManager = commandStreamReceiver.getMemoryManager();
pKernelInfo->kernelAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
MockContext ctx;
program.setContext(&ctx);
program.buildInfos[pDevice->getRootDeviceIndex()].globalSurface = new MockGraphicsAllocation();
@@ -2059,7 +2059,7 @@ TEST(KernelImageDetectionTests, givenKernelWithImagesOnlyWhenItIsAskedIfItHasIma
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
auto context = clUniquePtr(new MockContext(device.get()));
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
auto program = clUniquePtr(new MockProgram(context.get(), false, toClDeviceVector(*device)));
auto kernel = clUniquePtr(new MockKernel(program.get(), *pKernelInfo, *device));
EXPECT_FALSE(kernel->usesOnlyImages());
kernel->initialize();
@@ -2075,7 +2075,7 @@ TEST(KernelImageDetectionTests, givenKernelWithImagesAndBuffersWhenItIsAskedIfIt
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
auto context = clUniquePtr(new MockContext(device.get()));
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
auto program = clUniquePtr(new MockProgram(context.get(), false, toClDeviceVector(*device)));
auto kernel = clUniquePtr(new MockKernel(program.get(), *pKernelInfo, *device));
EXPECT_FALSE(kernel->usesOnlyImages());
kernel->initialize();
@@ -2089,7 +2089,7 @@ TEST(KernelImageDetectionTests, givenKernelWithNoImagesWhenItIsAskedIfItHasImage
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
auto context = clUniquePtr(new MockContext(device.get()));
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
auto program = clUniquePtr(new MockProgram(context.get(), false, toClDeviceVector(*device)));
auto kernel = clUniquePtr(new MockKernel(program.get(), *pKernelInfo, *device));
EXPECT_FALSE(kernel->usesOnlyImages());
kernel->initialize();
@@ -2142,7 +2142,7 @@ HWTEST_F(KernelResidencyTest, WhenMakingArgsResidentThenImageFromImageCheckIsCor
pKernelInfo->kernelArgInfo.push_back(std::move(kernelArgInfo));
auto program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
auto program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
program->setContext(&context);
std::unique_ptr<MockKernel> pKernel(new MockKernel(program.get(), *pKernelInfo, *pClDevice));
@@ -2161,7 +2161,7 @@ struct KernelExecutionEnvironmentTest : public Test<ClDeviceFixture> {
void SetUp() override {
ClDeviceFixture::SetUp();
program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
pKernelInfo = std::make_unique<KernelInfo>();
executionEnvironment.CompiledSIMD32 = 1;
pKernelInfo->patchInfo.executionEnvironment = &executionEnvironment;
@@ -2298,7 +2298,7 @@ struct KernelCrossThreadTests : Test<ClDeviceFixture> {
void SetUp() override {
ClDeviceFixture::SetUp();
program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
patchDataParameterStream.DataParameterStreamSize = 64 * sizeof(uint8_t);
pKernelInfo = std::make_unique<KernelInfo>();
@@ -2689,7 +2689,7 @@ TEST(KernelTest, givenKernelWithKernelInfoWith32bitPointerSizeThenReport32bit) {
MockContext context;
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment(), &context, false, &device->getDevice());
MockProgram program(&context, false, toClDeviceVector(*device));
std::unique_ptr<MockKernel> kernel(new MockKernel(&program, info, *device.get()));
EXPECT_TRUE(kernel->is32Bit());
@@ -2701,7 +2701,7 @@ TEST(KernelTest, givenKernelWithKernelInfoWith64bitPointerSizeThenReport64bit) {
MockContext context;
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment(), &context, false, &device->getDevice());
MockProgram program(&context, false, toClDeviceVector(*device));
std::unique_ptr<MockKernel> kernel(new MockKernel(&program, info, *device.get()));
EXPECT_FALSE(kernel->is32Bit());
@@ -3244,7 +3244,7 @@ TEST_F(KernelMultiRootDeviceTest, WhenGettingRootDeviceIndexThenCorrectRootDevic
tokenSPS.PerThreadPrivateMemorySize = 112;
kernelInfo->patchInfo.pAllocateStatelessPrivateSurface = &tokenSPS;
MockProgram program(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice());
MockProgram program(context.get(), false, toClDeviceVector(*device));
std::unique_ptr<MockKernel> kernel(new MockKernel(&program, *kernelInfo, *device.get()));
kernel->initialize();

View File

@@ -44,7 +44,7 @@ class KernelTransformableTest : public ::testing::Test {
pKernelInfo->kernelArgInfo[3].isImage = true;
pKernelInfo->argumentsToPatchNum = 4;
program = std::make_unique<MockProgram>(*context.getDevice(0)->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*context.getDevice(0)));
pKernel.reset(new MockKernel(program.get(), *pKernelInfo, *context.getDevice(0)));
ASSERT_EQ(CL_SUCCESS, pKernel->initialize());

View File

@@ -38,7 +38,7 @@ class MockKernelWithArgumentAccess : public Kernel {
TEST(ParentKernelTest, WhenArgsAddedThenObjectCountsAreIncremented) {
KernelInfo info;
MockClDevice *device = new MockClDevice{new MockDevice};
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
SPatchExecutionEnvironment environment = {};
environment.HasDeviceEnqueue = 1;

View File

@@ -68,7 +68,7 @@ class BufferSetArgTest : public ContextFixture,
pKernelInfo->heapInfo.SurfaceStateHeapSize = sizeof(surfaceStateHeap);
pKernelInfo->usesSsh = true;
pProgram = new MockProgram(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
pProgram = new MockProgram(pContext, false, toClDeviceVector(*pClDevice));
pKernel = new MockKernel(pProgram, *pKernelInfo, *pClDevice);
ASSERT_NE(nullptr, pKernel);

View File

@@ -78,7 +78,7 @@ class ImageSetArgTest : public ClDeviceFixture,
pKernelInfo->kernelArgInfo[1].isImage = true;
pKernelInfo->kernelArgInfo[0].isImage = true;
program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
pKernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice);
ASSERT_NE(nullptr, pKernel);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize());
@@ -935,7 +935,7 @@ class ImageMediaBlockSetArgTest : public ImageSetArgTest {
pKernelInfo->kernelArgInfo[1].isMediaBlockImage = true;
pKernelInfo->kernelArgInfo[0].isMediaBlockImage = true;
program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
pKernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice);
ASSERT_NE(nullptr, pKernel);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize());

View File

@@ -254,7 +254,7 @@ class MockKernel : public Kernel {
//class below have enough internals to service Enqueue operation.
class MockKernelWithInternals {
public:
MockKernelWithInternals(const ClDevice &deviceArg, Context *context = nullptr, bool addDefaultArg = false, SPatchExecutionEnvironment newExecutionEnvironment = {}) {
MockKernelWithInternals(ClDevice &deviceArg, Context *context = nullptr, bool addDefaultArg = false, SPatchExecutionEnvironment newExecutionEnvironment = {}) {
memset(&kernelHeader, 0, sizeof(SKernelBinaryHeaderCommon));
memset(&threadPayload, 0, sizeof(SPatchThreadPayload));
memcpy(&executionEnvironment, &newExecutionEnvironment, sizeof(SPatchExecutionEnvironment));
@@ -285,8 +285,10 @@ class MockKernelWithInternals {
context->incRefInternal();
mockContext = context;
}
ClDeviceVector deviceVector;
deviceVector.push_back(&deviceArg);
mockProgram = new MockProgram(*deviceArg.getExecutionEnvironment(), context, false, &deviceArg.getDevice());
mockProgram = new MockProgram(context, false, deviceVector);
mockKernel = new MockKernel(mockProgram, kernelInfo, deviceArg);
mockKernel->setCrossThreadData(&crossThreadData, sizeof(crossThreadData));
mockKernel->setSshLocal(&sshLocal, sizeof(sshLocal));
@@ -321,7 +323,7 @@ class MockKernelWithInternals {
}
}
MockKernelWithInternals(const ClDevice &deviceArg, SPatchExecutionEnvironment newExecutionEnvironment) : MockKernelWithInternals(deviceArg, nullptr, false, newExecutionEnvironment) {
MockKernelWithInternals(ClDevice &deviceArg, SPatchExecutionEnvironment newExecutionEnvironment) : MockKernelWithInternals(deviceArg, nullptr, false, newExecutionEnvironment) {
mockKernel->initialize();
}
@@ -362,7 +364,7 @@ class MockParentKernel : public Kernel {
using Kernel::sshLocalSize;
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)->getDevice();
auto clDevice = context.getDevice(0);
auto info = new KernelInfo();
const size_t crossThreadSize = 160;
@@ -415,9 +417,9 @@ class MockParentKernel : public Kernel {
crossThreadOffset += 8;
}
MockProgram *mockProgram = new MockProgram(*device.getExecutionEnvironment());
mockProgram->setContext(&context);
mockProgram->setDevice(&device);
ClDeviceVector deviceVector;
deviceVector.push_back(clDevice);
MockProgram *mockProgram = new MockProgram(&context, false, deviceVector);
if (addChildSimdSize) {
info->childrenKernelsIdOffset.push_back({0, crossThreadOffset});
@@ -426,9 +428,6 @@ class MockParentKernel : public Kernel {
UNRECOVERABLE_IF(crossThreadSize < crossThreadOffset + 8);
info->crossThreadData = new char[crossThreadSize];
auto clDevice = device.getSpecializedDevice<ClDevice>();
DEBUG_BREAK_IF(clDevice == nullptr);
auto parent = new MockParentKernel(mockProgram, *info, *clDevice);
parent->crossThreadData = new char[crossThreadSize];
memset(parent->crossThreadData, 0, crossThreadSize);

View File

@@ -23,6 +23,11 @@
#include "opencl/test/unit_test/mocks/mock_graphics_allocation.h"
namespace NEO {
ClDeviceVector toClDeviceVector(ClDevice &clDevice) {
ClDeviceVector deviceVector;
deviceVector.push_back(&clDevice);
return deviceVector;
}
ProgramInfo *GlobalMockSipProgram::globalSipProgramInfo;
Device *MockProgram::getDevicePtr() { return this->pDevice; }

View File

@@ -21,7 +21,7 @@
namespace NEO {
class GraphicsAllocation;
ClDeviceVector toClDeviceVector(ClDevice &clDevice);
////////////////////////////////////////////////////////////////////////////////
// Program - Core implementation
////////////////////////////////////////////////////////////////////////////////
@@ -57,7 +57,7 @@ class MockProgram : public Program {
using Program::specConstantsSizes;
using Program::specConstantsValues;
MockProgram(ExecutionEnvironment &executionEnvironment) : Program(executionEnvironment, nullptr, false, nullptr) {
MockProgram(const ClDeviceVector &deviceVector) : Program(nullptr, false, deviceVector) {
}
~MockProgram() override {

View File

@@ -33,7 +33,7 @@ struct ProfilingTests : public CommandEnqueueFixture,
void SetUp() override {
CommandEnqueueFixture::SetUp(CL_QUEUE_PROFILING_ENABLE);
program = ReleaseableObjectPtr<MockProgram>(new MockProgram(*pDevice->getExecutionEnvironment()));
program = ReleaseableObjectPtr<MockProgram>(new MockProgram(toClDeviceVector(*pClDevice)));
program->setContext(&ctx);
memset(&dataParameterStream, 0, sizeof(dataParameterStream));

View File

@@ -795,7 +795,7 @@ TEST_F(KernelDataTest, givenFlatImageDataParamTokenWhenDecodingThenSetAllOffsets
if (pKernelData) {
alignedFree(pKernelData);
}
program = std::make_unique<MockProgram>(*pContext->getDevice(0)->getExecutionEnvironment(), pContext, false, nullptr);
program = std::make_unique<MockProgram>(pContext, false, toClDeviceVector(*pContext->getDevice(0)));
}
SPatchDataParameterBuffer dataParameterToken;

View File

@@ -30,7 +30,7 @@ TEST(PrintfHandlerTest, givenNotPreparedPrintfHandlerWhenGetSurfaceIsCalledThenR
auto pKernelInfo = std::make_unique<KernelInfo>();
pKernelInfo->patchInfo.pAllocateStatelessPrintfSurface = pPrintfSurface;
MockProgram *pProgram = new MockProgram(*device->getExecutionEnvironment(), &context, false, &device->getDevice());
MockProgram *pProgram = new MockProgram(&context, false, toClDeviceVector(*device));
MockKernel *pKernel = new MockKernel(pProgram, *pKernelInfo, *device);
MockMultiDispatchInfo multiDispatchInfo(pKernel);
@@ -56,7 +56,7 @@ TEST(PrintfHandlerTest, givenPreparedPrintfHandlerWhenGetSurfaceIsCalledThenResu
auto pKernelInfo = std::make_unique<KernelInfo>();
pKernelInfo->patchInfo.pAllocateStatelessPrintfSurface = pPrintfSurface;
MockProgram *pProgram = new MockProgram(*device->getExecutionEnvironment(), &context, false, &device->getDevice());
MockProgram *pProgram = new MockProgram(&context, false, toClDeviceVector(*device));
uint64_t crossThread[10];
MockKernel *pKernel = new MockKernel(pProgram, *pKernelInfo, *device);
@@ -116,7 +116,7 @@ TEST(PrintfHandlerTest, givenParentKernelWithPrintfAndBlockKernelWithoutPrintfWh
TEST(PrintfHandlerTest, givenMultiDispatchInfoWithMultipleKernelsWhenCreatingAndDispatchingPrintfHandlerThenPickMainKernel) {
MockContext context;
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto program = std::make_unique<MockProgram>(*device->getExecutionEnvironment(), &context, false, &device->getDevice());
auto program = std::make_unique<MockProgram>(&context, false, toClDeviceVector(*device));
auto mainKernelInfo = std::make_unique<KernelInfo>();
auto kernelInfo = std::make_unique<KernelInfo>();
@@ -196,7 +196,7 @@ TEST(PrintfHandlerTest, GivenAllocationInLocalMemoryWhichRequiresBlitterWhenPrep
auto kernelInfo = std::make_unique<KernelInfo>();
kernelInfo->patchInfo.pAllocateStatelessPrintfSurface = printfSurface.get();
auto program = std::make_unique<MockProgram>(*pClDevice->getExecutionEnvironment(), &context, false, &pClDevice->getDevice());
auto program = std::make_unique<MockProgram>(&context, false, toClDeviceVector(*pClDevice));
uint64_t crossThread[10];
auto kernel = std::make_unique<MockKernel>(program.get(), *kernelInfo, *pClDevice);
kernel->setCrossThreadData(&crossThread, sizeof(uint64_t) * 8);
@@ -224,7 +224,7 @@ TEST_F(PrintfHandlerMultiRootDeviceTests, printfSurfaceHasCorrectRootDeviceIndex
auto kernelInfo = std::make_unique<KernelInfo>();
kernelInfo->patchInfo.pAllocateStatelessPrintfSurface = printfSurface.get();
auto program = std::make_unique<MockProgram>(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice());
auto program = std::make_unique<MockProgram>(context.get(), false, toClDeviceVector(*device));
uint64_t crossThread[10];
auto kernel = std::make_unique<MockKernel>(program.get(), *kernelInfo, *device);

View File

@@ -49,7 +49,7 @@ class PrintFormatterTest : public testing::Test {
kernelInfo = std::make_unique<KernelInfo>();
device = new MockClDevice{MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr)};
program = std::make_unique<MockProgram>(*device->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*device));
kernel = new MockKernel(program.get(), *kernelInfo, *device);
printFormatter = std::unique_ptr<PrintFormatter>(new PrintFormatter(static_cast<uint8_t *>(data->getUnderlyingBuffer()), PrintFormatter::maxPrintfOutputLength, is32bit, kernelInfo->patchInfo.stringDataMap));

View File

@@ -28,7 +28,7 @@ TEST_F(ProgramTests, GivenProgramWithDebugDataForTwoKernelsWhenPorcessedThenDebu
kernelInfo1->name = kernelName1;
auto kernelInfo2 = new KernelInfo();
kernelInfo2->name = kernelName2;
auto program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
auto program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
SProgramDebugDataHeaderIGC *programDebugHeader = reinterpret_cast<SProgramDebugDataHeaderIGC *>(debugData.get());
programDebugHeader->NumberOfKernels = 2;
@@ -84,7 +84,7 @@ TEST_F(ProgramTests, GivenProgramWithoutDebugDataWhenPorcessedThenDebugDataIsNot
auto kernelInfo1 = new KernelInfo();
kernelInfo1->name = kernelName1;
auto program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
auto program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
program->addKernelInfo(kernelInfo1);
program->processDebugData();

View File

@@ -29,7 +29,7 @@ class ProcessElfBinaryTests : public ::testing::Test {
public:
void SetUp() override {
device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr, rootDeviceIndex));
program = std::make_unique<MockProgram>(*device->getExecutionEnvironment(), nullptr, false, &device->getDevice());
program = std::make_unique<MockProgram>(nullptr, false, toClDeviceVector(*device));
}
std::unique_ptr<MockProgram> program;
@@ -116,7 +116,7 @@ class ProcessElfBinaryTestsWithBinaryType : public ::testing::TestWithParam<unsi
public:
void SetUp() override {
device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr, rootDeviceIndex));
program = std::make_unique<MockProgram>(*device->getExecutionEnvironment(), nullptr, false, &device->getDevice());
program = std::make_unique<MockProgram>(nullptr, false, toClDeviceVector(*device));
}
std::unique_ptr<MockProgram> program;

View File

@@ -8,6 +8,7 @@
#include "shared/source/device/device.h"
#include "shared/source/helpers/string.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "opencl/test/unit_test/mocks/mock_program.h"
#include "gtest/gtest.h"
@@ -17,11 +18,11 @@ using namespace NEO;
class ProcessSpirBinaryTests : public ::testing::Test {
public:
void SetUp() override {
executionEnvironment = std::make_unique<ExecutionEnvironment>();
program = std::make_unique<MockProgram>(*executionEnvironment);
device = std::make_unique<MockClDevice>(new MockDevice());
program = std::make_unique<MockProgram>(toClDeviceVector(*device));
}
std::unique_ptr<ExecutionEnvironment> executionEnvironment;
std::unique_ptr<ClDevice> device;
std::unique_ptr<MockProgram> program;
};

View File

@@ -424,7 +424,8 @@ TEST_F(ProgramDataTest, Given32BitDeviceWhenGlobalMemorySurfaceIsPresentThenItHa
TEST(ProgramScopeMetadataTest, WhenPatchingGlobalSurfaceThenPickProperSourceBuffer) {
MockExecutionEnvironment execEnv;
MockClDevice device{new MockDevice};
execEnv.incRefInternal();
MockClDevice device{new MockDevice(&execEnv, 0)};
execEnv.memoryManager = std::make_unique<MockMemoryManager>();
PatchTokensTestData::ValidProgramWithMixedGlobalVarAndConstSurfacesAndPointers decodedProgram;
decodedProgram.globalPointerMutable->GlobalPointerOffset = 0U;
@@ -432,8 +433,7 @@ TEST(ProgramScopeMetadataTest, WhenPatchingGlobalSurfaceThenPickProperSourceBuff
memset(decodedProgram.globalSurfMutable + 1, 0U, sizeof(uintptr_t));
memset(decodedProgram.constSurfMutable + 1, 0U, sizeof(uintptr_t));
ProgramInfo programInfo;
MockProgram program(execEnv);
program.pDevice = &device.getDevice();
MockProgram program(toClDeviceVector(device));
NEO::populateProgramInfo(programInfo, decodedProgram);
program.processProgramInfo(programInfo);
auto &buildInfo = program.buildInfos[device.getRootDeviceIndex()];
@@ -540,8 +540,8 @@ TEST_F(ProgramDataTest, givenSymbolTablePatchTokenThenLinkerInputIsCreated) {
TEST(ProgramLinkBinaryTest, whenLinkerInputEmptyThenLinkSuccessful) {
auto linkerInput = std::make_unique<WhiteBox<LinkerInput>>();
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
MockProgram program{*device->getExecutionEnvironment(), nullptr, false, device.get()};
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
MockProgram program{nullptr, false, toClDeviceVector(*device)};
program.setLinkerInput(device->getRootDeviceIndex(), std::move(linkerInput));
auto ret = program.linkBinary(program.pDevice, nullptr, nullptr);
EXPECT_EQ(CL_SUCCESS, ret);
@@ -554,8 +554,8 @@ TEST(ProgramLinkBinaryTest, whenLinkerUnresolvedExternalThenLinkFailedAndBuildLo
relocation.offset = 0;
linkerInput->relocations.push_back(NEO::LinkerInput::Relocations{relocation});
linkerInput->traits.requiresPatchingOfInstructionSegments = true;
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
MockProgram program{*device->getExecutionEnvironment(), nullptr, false, device.get()};
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
MockProgram program{nullptr, false, toClDeviceVector(*device)};
KernelInfo kernelInfo = {};
kernelInfo.name = "onlyKernel";
std::vector<char> kernelHeap;
@@ -590,8 +590,8 @@ TEST_F(ProgramDataTest, whenLinkerInputValidThenIsaIsProperlyPatched) {
NEO::LinkerInput::RelocationInfo{"C", 24U, relocationType}});
linkerInput->traits.requiresPatchingOfInstructionSegments = true;
linkerInput->exportedFunctionsSegmentId = 0;
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
MockProgram program{*device->getExecutionEnvironment(), nullptr, false, device.get()};
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
MockProgram program{nullptr, false, toClDeviceVector(*device)};
auto &buildInfo = program.buildInfos[device->getRootDeviceIndex()];
KernelInfo kernelInfo = {};
kernelInfo.name = "onlyKernel";
@@ -640,8 +640,8 @@ TEST_F(ProgramDataTest, whenRelocationsAreNotNeededThenIsaIsPreserved) {
linkerInput->symbols["A"] = NEO::SymbolInfo{4U, 4U, NEO::SegmentType::GlobalVariables};
linkerInput->symbols["B"] = NEO::SymbolInfo{8U, 4U, NEO::SegmentType::GlobalConstants};
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
MockProgram program{*device->getExecutionEnvironment(), nullptr, false, device.get()};
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
MockProgram program{nullptr, false, toClDeviceVector(*device)};
auto &buildInfo = program.buildInfos[device->getRootDeviceIndex()];
KernelInfo kernelInfo = {};
kernelInfo.name = "onlyKernel";

View File

@@ -35,10 +35,10 @@ using namespace NEO;
class MyMockProgram : public MockProgram {
public:
MyMockProgram() : MockProgram(*new ExecutionEnvironment()), executionEnvironment(&this->peekExecutionEnvironment()) {}
MyMockProgram() : MockProgram(toClDeviceVector(*(new MockClDevice(new MockDevice())))), device(this->clDevices[0]) {}
private:
std::unique_ptr<ExecutionEnvironment> executionEnvironment;
std::unique_ptr<ClDevice> device;
};
TEST(ProgramNonUniform, GivenNoBuildOptionsWhenUpdatingAllowNonUniformThenNonUniformNotAllowed) {
@@ -102,51 +102,52 @@ TEST(ProgramNonUniform, GivenBuildOptionsCl21AndUniformFlagWhenUpdatingAllowNonU
}
TEST(KernelNonUniform, WhenSettingAllowNonUniformThenGettingAllowNonUniformReturnsCorrectValue) {
KernelInfo ki;
MockClDevice d{new MockDevice};
MockProgram pm(*d.getExecutionEnvironment());
KernelInfo kernelInfo;
MockClDevice device{new MockDevice()};
MockProgram program(toClDeviceVector(device));
struct KernelMock : Kernel {
KernelMock(Program *p, KernelInfo &ki, ClDevice &d)
: Kernel(p, ki, d) {
}
};
KernelMock k{&pm, ki, d};
pm.setAllowNonUniform(false);
KernelMock k{&program, kernelInfo, device};
program.setAllowNonUniform(false);
EXPECT_FALSE(k.getAllowNonUniform());
pm.setAllowNonUniform(true);
program.setAllowNonUniform(true);
EXPECT_TRUE(k.getAllowNonUniform());
pm.setAllowNonUniform(false);
program.setAllowNonUniform(false);
EXPECT_FALSE(k.getAllowNonUniform());
}
TEST(ProgramNonUniform, WhenSettingAllowNonUniformThenGettingAllowNonUniformReturnsCorrectValue) {
ExecutionEnvironment executionEnvironment;
MockProgram pm(executionEnvironment);
MockProgram pm1(executionEnvironment);
MockProgram pm2(executionEnvironment);
const MockProgram *inputPrograms[] = {&pm1, &pm2};
MockClDevice device{new MockDevice()};
auto deviceVector = toClDeviceVector(device);
MockProgram program(deviceVector);
MockProgram program1(deviceVector);
MockProgram program2(deviceVector);
const MockProgram *inputPrograms[] = {&program1, &program2};
cl_uint numInputPrograms = 2;
pm1.setAllowNonUniform(false);
pm2.setAllowNonUniform(false);
pm.updateNonUniformFlag((const Program **)inputPrograms, numInputPrograms);
EXPECT_FALSE(pm.getAllowNonUniform());
program1.setAllowNonUniform(false);
program2.setAllowNonUniform(false);
program.updateNonUniformFlag((const Program **)inputPrograms, numInputPrograms);
EXPECT_FALSE(program.getAllowNonUniform());
pm1.setAllowNonUniform(false);
pm2.setAllowNonUniform(true);
pm.updateNonUniformFlag((const Program **)inputPrograms, numInputPrograms);
EXPECT_FALSE(pm.getAllowNonUniform());
program1.setAllowNonUniform(false);
program2.setAllowNonUniform(true);
program.updateNonUniformFlag((const Program **)inputPrograms, numInputPrograms);
EXPECT_FALSE(program.getAllowNonUniform());
pm1.setAllowNonUniform(true);
pm2.setAllowNonUniform(false);
pm.updateNonUniformFlag((const Program **)inputPrograms, numInputPrograms);
EXPECT_FALSE(pm.getAllowNonUniform());
program1.setAllowNonUniform(true);
program2.setAllowNonUniform(false);
program.updateNonUniformFlag((const Program **)inputPrograms, numInputPrograms);
EXPECT_FALSE(program.getAllowNonUniform());
pm1.setAllowNonUniform(true);
pm2.setAllowNonUniform(true);
pm.updateNonUniformFlag((const Program **)inputPrograms, numInputPrograms);
EXPECT_TRUE(pm.getAllowNonUniform());
program1.setAllowNonUniform(true);
program2.setAllowNonUniform(true);
program.updateNonUniformFlag((const Program **)inputPrograms, numInputPrograms);
EXPECT_TRUE(program.getAllowNonUniform());
}
class ProgramNonUniformTest : public ContextFixture,

View File

@@ -9,6 +9,7 @@
#include "shared/source/compiler_interface/compiler_interface.inl"
#include "opencl/test/unit_test/mocks/mock_cif.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "opencl/test/unit_test/mocks/mock_compilers.h"
#include "opencl/test/unit_test/mocks/mock_program.h"
@@ -20,7 +21,7 @@ using namespace NEO;
struct UpdateSpecConstantsTest : public ::testing::Test {
void SetUp() override {
mockProgram.reset(new MockProgram(executionEnvironment));
mockProgram.reset(new MockProgram(toClDeviceVector(device)));
mockProgram->specConstantsIds.reset(new MockCIFBuffer());
mockProgram->specConstantsSizes.reset(new MockCIFBuffer());
@@ -44,7 +45,7 @@ struct UpdateSpecConstantsTest : public ::testing::Test {
EXPECT_EQ(val2, static_cast<uint16_t>(values->at(id2)));
EXPECT_EQ(val3, static_cast<int>(values->at(id3)));
}
ExecutionEnvironment executionEnvironment;
MockClDevice device{new MockDevice()};
std::unique_ptr<MockProgram> mockProgram;
uint32_t id1 = 1u;

View File

@@ -94,6 +94,7 @@ std::vector<const char *> KernelNames{
class NoCompilerInterfaceRootDeviceEnvironment : public RootDeviceEnvironment {
public:
NoCompilerInterfaceRootDeviceEnvironment(ExecutionEnvironment &executionEnvironment) : RootDeviceEnvironment(executionEnvironment) {
*hwInfo = *defaultHwInfo;
}
CompilerInterface *getCompilerInterface() override {
@@ -103,13 +104,13 @@ class NoCompilerInterfaceRootDeviceEnvironment : public RootDeviceEnvironment {
class FailingGenBinaryProgram : public MockProgram {
public:
FailingGenBinaryProgram(ExecutionEnvironment &executionEnvironment) : MockProgram(executionEnvironment) {}
using MockProgram::MockProgram;
cl_int processGenBinary(uint32_t rootDeviceIndex) override { return CL_INVALID_BINARY; }
};
class SucceedingGenBinaryProgram : public MockProgram {
public:
SucceedingGenBinaryProgram(ExecutionEnvironment &executionEnvironment) : MockProgram(executionEnvironment) {}
using MockProgram::MockProgram;
cl_int processGenBinary(uint32_t rootDeviceIndex) override { return CL_SUCCESS; }
};
@@ -767,7 +768,7 @@ TEST_P(ProgramFromSourceTest, GivenSpecificParamatersWhenBuildingProgramThenSucc
auto executionEnvironment = device->getExecutionEnvironment();
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment = std::make_unique<NoCompilerInterfaceRootDeviceEnvironment>(*executionEnvironment);
std::swap(rootDeviceEnvironment, executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]);
auto p2 = std::make_unique<MockProgram>(*executionEnvironment);
auto p2 = std::make_unique<MockProgram>(toClDeviceVector(*device));
p2->setDevice(&device->getDevice());
retVal = p2->build(0, nullptr, nullptr, nullptr, nullptr, false);
EXPECT_EQ(CL_OUT_OF_HOST_MEMORY, retVal);
@@ -779,7 +780,7 @@ TEST_P(ProgramFromSourceTest, GivenSpecificParamatersWhenBuildingProgramThenSucc
EXPECT_EQ(CL_BUILD_PROGRAM_FAILURE, retVal);
// fail build - linked code is corrupted and cannot be postprocessed
auto p3 = std::make_unique<FailingGenBinaryProgram>(*executionEnvironment);
auto p3 = std::make_unique<FailingGenBinaryProgram>(toClDeviceVector(*device));
p3->setDevice(&device->getDevice());
std::string testFile;
size_t sourceSize;
@@ -880,7 +881,7 @@ TEST_P(ProgramFromSourceTest, WhenBuildingProgramWithOpenClC30ThenFeaturesOption
auto cip = new MockCompilerInterfaceCaptureBuildOptions();
auto pClDevice = pContext->getDevice(0);
pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
auto pProgram = std::make_unique<SucceedingGenBinaryProgram>(*pClDevice->getExecutionEnvironment());
auto pProgram = std::make_unique<SucceedingGenBinaryProgram>(toClDeviceVector(*pClDevice));
pProgram->setDevice(&pClDevice->getDevice());
pProgram->sourceCode = "__kernel mock() {}";
pProgram->createdFrom = Program::CreatedFrom::SOURCE;
@@ -894,7 +895,7 @@ TEST_P(ProgramFromSourceTest, WhenBuildingProgramWithOpenClC30ThenFeaturesOption
auto cip = new MockCompilerInterfaceCaptureBuildOptions();
auto pClDevice = pContext->getDevice(0);
pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
auto pProgram = std::make_unique<SucceedingGenBinaryProgram>(*pClDevice->getExecutionEnvironment());
auto pProgram = std::make_unique<SucceedingGenBinaryProgram>(toClDeviceVector(*pClDevice));
pProgram->setDevice(&pClDevice->getDevice());
pProgram->sourceCode = "__kernel mock() {}";
pProgram->createdFrom = Program::CreatedFrom::SOURCE;
@@ -929,7 +930,7 @@ TEST_P(ProgramFromSourceTest, WhenCompilingProgramWithOpenClC30ThenFeaturesOptio
auto pCompilerInterface = new MockCompilerInterfaceCaptureBuildOptions();
auto pClDevice = pContext->getDevice(0);
pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(pCompilerInterface);
auto pProgram = std::make_unique<SucceedingGenBinaryProgram>(*pClDevice->getExecutionEnvironment());
auto pProgram = std::make_unique<SucceedingGenBinaryProgram>(toClDeviceVector(*pClDevice));
pProgram->setDevice(&pClDevice->getDevice());
pProgram->sourceCode = "__kernel mock() {}";
pProgram->createdFrom = Program::CreatedFrom::SOURCE;
@@ -1128,7 +1129,7 @@ TEST_P(ProgramFromSourceTest, GivenSpecificParamatersWhenCompilingProgramThenSuc
auto executionEnvironment = device->getExecutionEnvironment();
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment = std::make_unique<NoCompilerInterfaceRootDeviceEnvironment>(*executionEnvironment);
std::swap(rootDeviceEnvironment, executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]);
auto p2 = std::make_unique<MockProgram>(*executionEnvironment);
auto p2 = std::make_unique<MockProgram>(toClDeviceVector(*device));
p2->setDevice(&device->getDevice());
retVal = p2->compile(0, nullptr, nullptr, 0, nullptr, nullptr, nullptr, nullptr);
EXPECT_EQ(CL_OUT_OF_HOST_MEMORY, retVal);
@@ -1154,7 +1155,7 @@ TEST_P(ProgramFromSourceTest, GivenFlagsWhenCompilingProgramThenBuildOptionsHave
auto cip = new MockCompilerInterfaceCaptureBuildOptions();
auto pDevice = pContext->getDevice(0);
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
auto program = std::make_unique<SucceedingGenBinaryProgram>(*pDevice->getExecutionEnvironment());
auto program = std::make_unique<SucceedingGenBinaryProgram>(toClDeviceVector(*pDevice));
program->setDevice(&pDevice->getDevice());
program->sourceCode = "__kernel mock() {}";
@@ -1165,7 +1166,9 @@ TEST_P(ProgramFromSourceTest, GivenFlagsWhenCompilingProgramThenBuildOptionsHave
// Check build options that were applied
EXPECT_TRUE(CompilerOptions::contains(cip->buildOptions, CompilerOptions::fastRelaxedMath)) << cip->buildOptions;
EXPECT_FALSE(CompilerOptions::contains(cip->buildInternalOptions, CompilerOptions::gtpinRera)) << cip->buildInternalOptions;
if (!pDevice->areSharedSystemAllocationsAllowed()) {
EXPECT_FALSE(CompilerOptions::contains(cip->buildInternalOptions, CompilerOptions::greaterThan4gbBuffersRequired)) << cip->buildInternalOptions;
}
EXPECT_TRUE(CompilerOptions::contains(cip->buildInternalOptions, pPlatform->getClDevice(0)->peekCompilerExtensions())) << cip->buildInternalOptions;
// Ask to build created program with NEO::CompilerOptions::gtpinRera and NEO::CompilerOptions::greaterThan4gbBuffersRequired flags.
@@ -1186,7 +1189,7 @@ TEST_P(ProgramFromSourceTest, GivenFlagsWhenCompilingProgramThenBuildOptionsHave
TEST_F(ProgramTests, GivenFlagsWhenLinkingProgramThenBuildOptionsHaveBeenApplied) {
auto cip = new MockCompilerInterfaceCaptureBuildOptions();
auto pProgram = std::make_unique<SucceedingGenBinaryProgram>(*pDevice->getExecutionEnvironment());
auto pProgram = std::make_unique<SucceedingGenBinaryProgram>(toClDeviceVector(*pClDevice));
pProgram->setDevice(pDevice);
pProgram->sourceCode = "__kernel mock() {}";
pProgram->createdFrom = Program::CreatedFrom::SOURCE;
@@ -1342,7 +1345,7 @@ TEST_P(ProgramFromSourceTest, GivenSpecificParamatersWhenLinkingProgramThenSucce
// fail linking - linked code is corrupted and cannot be postprocessed
auto device = static_cast<ClDevice *>(usedDevice);
auto p2 = std::make_unique<FailingGenBinaryProgram>(*device->getExecutionEnvironment());
auto p2 = std::make_unique<FailingGenBinaryProgram>(toClDeviceVector(*device));
p2->setDevice(&device->getDevice());
retVal = p2->link(0, nullptr, nullptr, 1, &program, nullptr, nullptr);
EXPECT_EQ(CL_INVALID_BINARY, retVal);
@@ -1381,7 +1384,7 @@ TEST_P(ProgramFromSourceTest, GivenInvalidOptionsWhenCreatingLibraryThenCorrectE
auto executionEnvironment = device->getExecutionEnvironment();
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment = std::make_unique<NoCompilerInterfaceRootDeviceEnvironment>(*executionEnvironment);
std::swap(rootDeviceEnvironment, executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]);
auto failingProgram = std::make_unique<MockProgram>(*executionEnvironment);
auto failingProgram = std::make_unique<MockProgram>(toClDeviceVector(*device));
failingProgram->setDevice(&device->getDevice());
// fail library creation - CompilerInterface cannot be obtained
@@ -1772,7 +1775,7 @@ TEST_F(ProgramTests, WhenProgramIsCreatedThenCorrectOclVersionIsInOptions) {
DebugManagerStateRestore restorer;
DebugManager.flags.DisableStatelessToStatefulOptimization.set(false);
MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
if (pClDevice->getEnabledClVersion() == 30) {
EXPECT_TRUE(CompilerOptions::contains(program.getInternalOptions(), "-ocl-version=300")) << program.getInternalOptions();
} else if (pClDevice->getEnabledClVersion() == 21) {
@@ -1791,7 +1794,7 @@ TEST_F(ProgramTests, GivenForcedClVersionWhenProgramIsCreatedThenCorrectOclOptio
for (auto &testedValue : testedValues) {
pClDevice->enabledClVersion = testedValue.first;
MockProgram program{*pDevice->getExecutionEnvironment(), pContext, false, pDevice};
MockProgram program{pContext, false, toClDeviceVector(*pClDevice)};
EXPECT_TRUE(CompilerOptions::contains(program.getInternalOptions(), testedValue.second));
}
}
@@ -1800,7 +1803,7 @@ TEST_F(ProgramTests, GivenStatelessToStatefulIsDisabledWhenProgramIsCreatedThenG
DebugManagerStateRestore restorer;
DebugManager.flags.DisableStatelessToStatefulOptimization.set(true);
MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
EXPECT_TRUE(CompilerOptions::contains(program.getInternalOptions(), NEO::CompilerOptions::greaterThan4gbBuffersRequired));
}
@@ -1811,14 +1814,14 @@ TEST_F(ProgramTests, WhenCreatingProgramThenBindlessIsEnabledOnlyIfDebugFlagIsEn
{
DebugManager.flags.UseBindlessMode.set(0);
MockProgram programNoBindless(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram programNoBindless(pContext, false, toClDeviceVector(*pClDevice));
EXPECT_FALSE(CompilerOptions::contains(programNoBindless.getInternalOptions(), CompilerOptions::bindlessBuffers)) << programNoBindless.getInternalOptions();
EXPECT_FALSE(CompilerOptions::contains(programNoBindless.getInternalOptions(), CompilerOptions::bindlessImages)) << programNoBindless.getInternalOptions();
}
{
DebugManager.flags.UseBindlessMode.set(1);
MockProgram programNoBindless(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram programNoBindless(pContext, false, toClDeviceVector(*pClDevice));
EXPECT_TRUE(CompilerOptions::contains(programNoBindless.getInternalOptions(), CompilerOptions::bindlessBuffers)) << programNoBindless.getInternalOptions();
EXPECT_TRUE(CompilerOptions::contains(programNoBindless.getInternalOptions(), CompilerOptions::bindlessImages)) << programNoBindless.getInternalOptions();
}
@@ -1827,7 +1830,7 @@ TEST_F(ProgramTests, WhenCreatingProgramThenBindlessIsEnabledOnlyIfDebugFlagIsEn
TEST_F(ProgramTests, givenDeviceThatSupportsSharedSystemMemoryAllocationWhenProgramIsCompiledThenItForcesStatelessCompilation) {
pClDevice->deviceInfo.sharedSystemMemCapabilities = CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ATOMIC_ACCESS_INTEL;
pClDevice->sharedDeviceInfo.sharedSystemAllocationsSupport = true;
MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
EXPECT_TRUE(CompilerOptions::contains(program.getInternalOptions().c_str(), CompilerOptions::greaterThan4gbBuffersRequired)) << program.getInternalOptions();
}
@@ -1838,7 +1841,7 @@ TEST_F(ProgramTests, GivenForce32BitAddressessWhenProgramIsCreatedThenGreaterTha
DebugManager.flags.DisableStatelessToStatefulOptimization.set(false);
if (pDevice) {
const_cast<DeviceInfo *>(&pDevice->getDeviceInfo())->force32BitAddressess = true;
MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
if (pDevice->areSharedSystemAllocationsAllowed()) {
EXPECT_TRUE(CompilerOptions::contains(program.getInternalOptions(), CompilerOptions::greaterThan4gbBuffersRequired)) << program.getInternalOptions();
} else {
@@ -1924,7 +1927,7 @@ TEST_F(ProgramTests, GivenContextWhenCreateProgramThenIncrementContextRefCount)
auto initialApiRefCount = pContext->getReference();
auto initialInternalRefCount = pContext->getRefInternalCount();
MockProgram *program = new MockProgram(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram *program = new MockProgram(pContext, false, toClDeviceVector(*pClDevice));
EXPECT_EQ(pContext->getReference(), initialApiRefCount);
EXPECT_EQ(pContext->getRefInternalCount(), initialInternalRefCount + 1);
@@ -2065,7 +2068,7 @@ TEST_F(ProgramTests, givenProgramFromGenBinaryWhenSLMSizeIsBiggerThenDeviceLimit
PatchTokensTestData::ValidProgramWithKernelUsingSlm patchtokensProgram;
patchtokensProgram.slmMutable->TotalInlineLocalMemorySize = static_cast<uint32_t>(pDevice->getDeviceInfo().localMemSize * 2);
patchtokensProgram.recalcTokPtr();
auto program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment(), nullptr, false, pDevice);
auto program = std::make_unique<MockProgram>(nullptr, false, toClDeviceVector(*pClDevice));
program->buildInfos[rootDeviceIndex].unpackedDeviceBinary = makeCopy(patchtokensProgram.storage.data(), patchtokensProgram.storage.size());
program->buildInfos[rootDeviceIndex].unpackedDeviceBinarySize = patchtokensProgram.storage.size();
auto retVal = program->processGenBinary(rootDeviceIndex);
@@ -2079,7 +2082,7 @@ TEST_F(ProgramTests, GivenNoCompilerInterfaceRootDeviceEnvironmentWhenRebuilding
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment = std::make_unique<NoCompilerInterfaceRootDeviceEnvironment>(*executionEnvironment);
rootDeviceEnvironment->setHwInfo(&pDevice->getHardwareInfo());
std::swap(rootDeviceEnvironment, executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
auto program = std::make_unique<MockProgram>(*executionEnvironment);
auto program = std::make_unique<MockProgram>(toClDeviceVector(*pDevice));
EXPECT_NE(nullptr, program);
program->setDevice(&pDevice->getDevice());
@@ -2104,7 +2107,7 @@ TEST_F(ProgramTests, GivenGtpinReraFlagWhenBuildingProgramThenCorrectOptionsAreS
auto cip = new MockCompilerInterfaceCaptureBuildOptions();
auto pDevice = pContext->getDevice(0);
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
auto program = std::make_unique<SucceedingGenBinaryProgram>(*pDevice->getExecutionEnvironment());
auto program = std::make_unique<SucceedingGenBinaryProgram>(toClDeviceVector(*pDevice));
program->setDevice(&pDevice->getDevice());
program->sourceCode = "__kernel mock() {}";
program->createdFrom = Program::CreatedFrom::SOURCE;
@@ -2133,7 +2136,7 @@ TEST_F(ProgramTests, GivenFailingGenBinaryProgramWhenRebuildingBinaryThenInvalid
cl_int retVal;
auto program = std::make_unique<FailingGenBinaryProgram>(*pDevice->getExecutionEnvironment());
auto program = std::make_unique<FailingGenBinaryProgram>(toClDeviceVector(*pClDevice));
EXPECT_NE(nullptr, program);
cl_device_id deviceId = pContext->getDevice(0);
ClDevice *pDevice = castToObject<ClDevice>(deviceId);
@@ -2156,7 +2159,7 @@ TEST_F(ProgramTests, GivenFailingGenBinaryProgramWhenRebuildingBinaryThenInvalid
}
TEST_F(ProgramTests, GivenZeroPrivateSizeInBlockWhenAllocateBlockProvateSurfacesCalledThenNoSurfaceIsCreated) {
MockProgram *program = new MockProgram(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram *program = new MockProgram(pContext, false, toClDeviceVector(*pClDevice));
uint32_t crossThreadOffsetBlock = 0;
@@ -2182,7 +2185,7 @@ TEST_F(ProgramTests, GivenZeroPrivateSizeInBlockWhenAllocateBlockProvateSurfaces
}
TEST_F(ProgramTests, GivenNonZeroPrivateSizeInBlockWhenAllocateBlockProvateSurfacesCalledThenSurfaceIsCreated) {
MockProgram *program = new MockProgram(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram *program = new MockProgram(pContext, false, toClDeviceVector(*pClDevice));
uint32_t crossThreadOffsetBlock = 0;
@@ -2208,7 +2211,7 @@ TEST_F(ProgramTests, GivenNonZeroPrivateSizeInBlockWhenAllocateBlockProvateSurfa
}
TEST_F(ProgramTests, GivenNonZeroPrivateSizeInBlockWhenAllocateBlockProvateSurfacesCalledThenSecondSurfaceIsNotCreated) {
MockProgram *program = new MockProgram(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram *program = new MockProgram(pContext, false, toClDeviceVector(*pClDevice));
uint32_t crossThreadOffsetBlock = 0;
@@ -2242,7 +2245,7 @@ TEST_F(ProgramTests, GivenNonZeroPrivateSizeInBlockWhenAllocateBlockProvateSurfa
}
TEST_F(ProgramTests, givenProgramWithBlockKernelsWhenfreeBlockResourcesisCalledThenFreeGraphhicsAllocationsFromBlockKernelManagerIsCalled) {
MockProgram *program = new MockProgram(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram *program = new MockProgram(pContext, false, toClDeviceVector(*pClDevice));
uint32_t crossThreadOffsetBlock = 0;
@@ -2283,13 +2286,13 @@ class Program32BitTests : public ProgramTests {
};
TEST_F(Program32BitTests, givenDeviceWithForce32BitAddressingOnWhenBuiltinIsCreatedThenNoFlagsArePassedAsInternalOptions) {
MockProgram program(*pDevice->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*pClDevice));
auto &internalOptions = program.getInternalOptions();
EXPECT_THAT(internalOptions, testing::HasSubstr(std::string("")));
}
TEST_F(Program32BitTests, givenDeviceWithForce32BitAddressingOnWhenProgramIsCreatedThen32bitFlagIsPassedAsInternalOption) {
MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
auto &internalOptions = program.getInternalOptions();
std::string s1 = internalOptions;
size_t pos = s1.find(NEO::CompilerOptions::arch32bit.data());
@@ -2301,7 +2304,7 @@ TEST_F(Program32BitTests, givenDeviceWithForce32BitAddressingOnWhenProgramIsCrea
}
TEST_F(ProgramTests, givenNewProgramTheStatelessToStatefulBufferOffsetOtimizationIsMatchingThePlatformEnablingStatus) {
MockProgram prog(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram prog(pContext, false, toClDeviceVector(*pClDevice));
auto &internalOpts = prog.getInternalOptions();
HardwareCapabilities hwCaps = {0};
@@ -2315,9 +2318,7 @@ TEST_F(ProgramTests, givenNewProgramTheStatelessToStatefulBufferOffsetOtimizatio
template <int32_t ErrCodeToReturn, bool spirv = true>
struct CreateProgramFromBinaryMock : public MockProgram {
CreateProgramFromBinaryMock(ExecutionEnvironment &executionEnvironment, Context *context, bool isBuiltIn, Device *device)
: MockProgram(executionEnvironment, context, isBuiltIn, nullptr) {
}
using MockProgram::MockProgram;
cl_int createProgramFromBinary(const void *pBinary,
size_t binarySize, uint32_t rootDeviceIndex) override {
@@ -2484,7 +2485,7 @@ TEST_F(ProgramTests, WhenLinkingTwoValidSpirvProgramsThenValidProgramIsReturned)
}
TEST_F(ProgramTests, givenSeparateBlockKernelsWhenNoParentAndSubgroupKernelsThenSeparateNoneKernel) {
MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
EXPECT_EQ(0u, program.getKernelInfoArray().size());
EXPECT_EQ(0u, program.getParentKernelInfoArray().size());
@@ -2497,7 +2498,7 @@ TEST_F(ProgramTests, givenSeparateBlockKernelsWhenNoParentAndSubgroupKernelsThen
}
TEST_F(ProgramTests, givenSeparateBlockKernelsWhenRegularKernelsThenSeparateNoneKernel) {
MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
auto pRegularKernel1Info = new KernelInfo();
pRegularKernel1Info->name = "regular_kernel_1";
@@ -2519,7 +2520,7 @@ TEST_F(ProgramTests, givenSeparateBlockKernelsWhenRegularKernelsThenSeparateNone
}
TEST_F(ProgramTests, givenSeparateBlockKernelsWhenChildLikeKernelWithoutParentKernelThenSeparateNoneKernel) {
MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
auto pParentKernelInfo = new KernelInfo();
pParentKernelInfo->name = "another_parent_kernel";
@@ -2543,7 +2544,7 @@ TEST_F(ProgramTests, givenSeparateBlockKernelsWhenChildLikeKernelWithoutParentKe
}
TEST_F(ProgramTests, givenSeparateBlockKernelsWhenChildLikeKernelWithoutSubgroupKernelThenSeparateNoneKernel) {
MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
auto pSubgroupKernelInfo = new KernelInfo();
pSubgroupKernelInfo->name = "another_subgroup_kernel";
@@ -2567,7 +2568,7 @@ TEST_F(ProgramTests, givenSeparateBlockKernelsWhenChildLikeKernelWithoutSubgroup
}
TEST_F(ProgramTests, givenSeparateBlockKernelsWhenParentKernelWithChildKernelThenSeparateChildKernel) {
MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
auto pParentKernelInfo = new KernelInfo();
pParentKernelInfo->name = "parent_kernel";
@@ -2591,7 +2592,7 @@ TEST_F(ProgramTests, givenSeparateBlockKernelsWhenParentKernelWithChildKernelThe
}
TEST_F(ProgramTests, givenSeparateBlockKernelsWhenSubgroupKernelWithChildKernelThenSeparateChildKernel) {
MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
auto pSubgroupKernelInfo = new KernelInfo();
pSubgroupKernelInfo->name = "subgroup_kernel";
@@ -2614,22 +2615,11 @@ TEST_F(ProgramTests, givenSeparateBlockKernelsWhenSubgroupKernelWithChildKernelT
EXPECT_EQ(0, strcmp("subgroup_kernel_dispatch_0", program.getBlockKernelManager()->getBlockKernelInfo(0)->name.c_str()));
}
TEST(SimpleProgramTests, givenDefaultProgramWhenSetDeviceIsCalledThenDeviceIsSet) {
ExecutionEnvironment executionEnvironment;
MockProgram program(executionEnvironment);
EXPECT_EQ(nullptr, program.getDevicePtr());
auto dummyDevice = (Device *)0x1337;
program.setDevice(dummyDevice);
EXPECT_EQ(dummyDevice, program.getDevicePtr());
program.setDevice(nullptr);
EXPECT_EQ(nullptr, program.getDevicePtr());
}
TEST(ProgramDestructionTests, givenProgramUsingDeviceWhenItIsDestroyedAfterPlatfromCleanupThenItIsCleanedUpProperly) {
initPlatform();
auto device = platform()->getClDevice(0);
MockContext *context = new MockContext(device, false);
MockProgram *pProgram = new MockProgram(*device->getExecutionEnvironment(), context, false, &device->getDevice());
MockProgram *pProgram = new MockProgram(context, false, toClDeviceVector(*device));
auto globalAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
pProgram->setGlobalSurface(globalAllocation);
@@ -2641,8 +2631,6 @@ TEST(ProgramDestructionTests, givenProgramUsingDeviceWhenItIsDestroyedAfterPlatf
}
TEST_F(ProgramTests, givenProgramWithSpirvWhenRebuildProgramIsCalledThenSpirvPathIsTaken) {
auto device = castToObject<ClDevice>(pContext->getDevice(0));
auto compilerInterface = new MockCompilerInterface();
auto compilerMain = new MockCIFMain();
compilerInterface->setFclMain(compilerMain);
@@ -2659,8 +2647,7 @@ TEST_F(ProgramTests, givenProgramWithSpirvWhenRebuildProgramIsCalledThenSpirvPat
gEnvironment->igcPushDebugVars(debugVars);
std::unique_ptr<void, void (*)(void *)> igcDebugVarsAutoPop{&gEnvironment, [](void *) { gEnvironment->igcPopDebugVars(); }};
auto program = clUniquePtr(new MockProgram(*pDevice->getExecutionEnvironment()));
program->setDevice(&device->getDevice());
auto program = clUniquePtr(new MockProgram(toClDeviceVector(*pClDevice)));
uint32_t spirv[16] = {0x03022307, 0x23471113, 0x17192329};
program->irBinary = makeCopy(spirv, sizeof(spirv));
program->irBinarySize = sizeof(spirv);
@@ -2690,7 +2677,7 @@ TEST_F(ProgramTests, whenRebuildingProgramThenStoreDeviceBinaryProperly) {
gEnvironment->igcPushDebugVars(debugVars);
std::unique_ptr<void, void (*)(void *)> igcDebugVarsAutoPop{&gEnvironment, [](void *) { gEnvironment->igcPopDebugVars(); }};
auto program = clUniquePtr(new MockProgram(*pDevice->getExecutionEnvironment()));
auto program = clUniquePtr(new MockProgram(toClDeviceVector(*pClDevice)));
program->setDevice(&device->getDevice());
uint32_t ir[16] = {0x03022307, 0x23471113, 0x17192329};
program->irBinary = makeCopy(ir, sizeof(ir));
@@ -2704,20 +2691,16 @@ TEST_F(ProgramTests, whenRebuildingProgramThenStoreDeviceBinaryProperly) {
}
TEST_F(ProgramTests, givenProgramWhenInternalOptionsArePassedThenTheyAreAddedToProgramInternalOptions) {
ExecutionEnvironment executionEnvironment;
MockProgram program(executionEnvironment);
MockProgram program(toClDeviceVector(*pClDevice));
program.getInternalOptions().erase();
EXPECT_EQ(nullptr, program.getDevicePtr());
std::string buildOptions = NEO::CompilerOptions::gtpinRera.str();
program.extractInternalOptions(buildOptions);
EXPECT_STREQ(program.getInternalOptions().c_str(), NEO::CompilerOptions::gtpinRera.data());
}
TEST_F(ProgramTests, givenProgramWhenUnknownInternalOptionsArePassedThenTheyAreNotAddedToProgramInternalOptions) {
ExecutionEnvironment executionEnvironment;
MockProgram program(executionEnvironment);
MockProgram program(toClDeviceVector(*pClDevice));
program.getInternalOptions().erase();
EXPECT_EQ(nullptr, program.getDevicePtr());
const char *internalOption = "-unknown-internal-options-123";
std::string buildOptions(internalOption);
program.extractInternalOptions(buildOptions);
@@ -2725,10 +2708,8 @@ TEST_F(ProgramTests, givenProgramWhenUnknownInternalOptionsArePassedThenTheyAreN
}
TEST_F(ProgramTests, givenProgramWhenAllInternalOptionsArePassedMixedWithUnknownInputThenTheyAreParsedCorrectly) {
ExecutionEnvironment executionEnvironment;
MockProgram program(executionEnvironment);
MockProgram program(toClDeviceVector(*pClDevice));
program.getInternalOptions().erase();
EXPECT_EQ(nullptr, program.getDevicePtr());
std::string buildOptions = CompilerOptions::concatenate("###", CompilerOptions::gtpinRera, "###", CompilerOptions::greaterThan4gbBuffersRequired, "###");
std::string expectedOutput = CompilerOptions::concatenate(CompilerOptions::gtpinRera, CompilerOptions::greaterThan4gbBuffersRequired);
program.extractInternalOptions(buildOptions);
@@ -2736,10 +2717,8 @@ TEST_F(ProgramTests, givenProgramWhenAllInternalOptionsArePassedMixedWithUnknown
}
TEST_F(ProgramTests, givenProgramWhenInternalOptionsArePassedWithValidValuesThenTheyAreAddedToProgramInternalOptions) {
ExecutionEnvironment executionEnvironment;
MockProgram program(executionEnvironment);
MockProgram program(toClDeviceVector(*pClDevice));
program.getInternalOptions().erase();
EXPECT_EQ(nullptr, program.getDevicePtr());
program.isFlagOptionOverride = false;
program.isOptionValueValidOverride = true;
@@ -2749,9 +2728,7 @@ TEST_F(ProgramTests, givenProgramWhenInternalOptionsArePassedWithValidValuesThen
}
TEST_F(ProgramTests, givenProgramWhenInternalOptionsArePassedWithInvalidValuesThenTheyAreNotAddedToProgramInternalOptions) {
ExecutionEnvironment executionEnvironment;
MockProgram program(executionEnvironment);
EXPECT_EQ(nullptr, program.getDevicePtr());
MockProgram program(toClDeviceVector(*pClDevice));
program.isFlagOptionOverride = false;
std::string buildOptions = CompilerOptions::concatenate(CompilerOptions::gtpinRera, "someValue");
@@ -2769,13 +2746,13 @@ TEST_F(ProgramTests, givenProgramWhenInternalOptionsArePassedWithInvalidValuesTh
class AdditionalOptionsMockProgram : public MockProgram {
public:
AdditionalOptionsMockProgram() : MockProgram(executionEnvironment) {}
AdditionalOptionsMockProgram() : MockProgram(toClDeviceVector(*(new MockClDevice(new MockDevice())))), device(this->clDevices[0]) {}
void applyAdditionalOptions() override {
applyAdditionalOptionsCalled++;
MockProgram::applyAdditionalOptions();
}
uint32_t applyAdditionalOptionsCalled = 0;
ExecutionEnvironment executionEnvironment;
std::unique_ptr<ClDevice> device;
};
TEST_F(ProgramTests, givenProgramWhenBuiltThenAdditionalOptionsAreApplied) {
@@ -2787,38 +2764,6 @@ TEST_F(ProgramTests, givenProgramWhenBuiltThenAdditionalOptionsAreApplied) {
EXPECT_EQ(1u, program.applyAdditionalOptionsCalled);
}
TEST_F(ProgramTests, WhenProgramIsCreatedThenItsDeviceIsProperlySet) {
auto wasValidClDeviceUsed = [](MockProgram &program) -> bool {
return (program.getInternalOptions().find(CompilerOptions::arch32bit.data()) != std::string::npos);
};
MockExecutionEnvironment executionEnvironment;
MockDevice mockDevice;
mockDevice.deviceInfo.force32BitAddressess = true;
auto pContextMockDevice = new MockDevice;
MockClDevice contextMockClDevice{pContextMockDevice};
MockContext mockContext{&contextMockClDevice};
MockProgram programWithDeviceGiven{executionEnvironment, &mockContext, false, &mockDevice};
EXPECT_EQ(&mockDevice, programWithDeviceGiven.pDevice);
MockProgram programWithDeviceFromContext{executionEnvironment, &mockContext, false, nullptr};
EXPECT_EQ(pContextMockDevice, programWithDeviceFromContext.pDevice);
MockProgram programWithDeviceWithoutSpecializedDevice{executionEnvironment, nullptr, false, &mockDevice};
EXPECT_FALSE(wasValidClDeviceUsed(programWithDeviceWithoutSpecializedDevice));
MockDevice invalidClDevice;
mockDevice.setSpecializedDevice(&invalidClDevice);
MockProgram programWithDeviceWithInvalidSpecializedDevice{executionEnvironment, nullptr, false, &mockDevice};
EXPECT_FALSE(wasValidClDeviceUsed(programWithDeviceWithInvalidSpecializedDevice));
MockClDevice validClDevice{new MockDevice};
validClDevice.sharedDeviceInfo.force32BitAddressess = true;
MockProgram programWithDeviceWithValidSpecializedDevice{executionEnvironment, nullptr, false, &validClDevice.getDevice()};
EXPECT_TRUE(wasValidClDeviceUsed(programWithDeviceWithValidSpecializedDevice));
}
TEST(CreateProgramFromBinaryTests, givenBinaryProgramWhenKernelRebulildIsForcedThenDeviceBinaryIsNotUsed) {
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.RebuildPrecompiledKernels.set(true);
@@ -2892,13 +2837,13 @@ struct SpecializationConstantRootDeviceEnvironemnt : public RootDeviceEnvironmen
};
struct setProgramSpecializationConstantTests : public ::testing::Test {
setProgramSpecializationConstantTests() : device(new MockDevice()) {}
void SetUp() override {
mockCompiler = new SpecializationConstantCompilerInterfaceMock();
auto rootDeviceEnvironment = device.getExecutionEnvironment()->rootDeviceEnvironments[0].get();
rootDeviceEnvironment->compilerInterface.reset(mockCompiler);
mockProgram.reset(new SpecializationConstantProgramMock(*device.getExecutionEnvironment()));
mockProgram.reset(new SpecializationConstantProgramMock(toClDeviceVector(device)));
mockProgram->isSpirV = true;
mockProgram->setDevice(&device);
EXPECT_FALSE(mockProgram->areSpecializationConstantsInitialized);
EXPECT_EQ(0, mockCompiler->counter);
@@ -2906,7 +2851,7 @@ struct setProgramSpecializationConstantTests : public ::testing::Test {
SpecializationConstantCompilerInterfaceMock *mockCompiler = nullptr;
std::unique_ptr<SpecializationConstantProgramMock> mockProgram;
MockDevice device;
MockClDevice device;
int specValue = 1;
};
@@ -2948,9 +2893,8 @@ TEST(setProgramSpecializationConstantTest, givenUninitializedCompilerinterfaceWh
auto executionEnvironment = new MockExecutionEnvironment();
executionEnvironment->rootDeviceEnvironments[0] = std::make_unique<NoCompilerInterfaceRootDeviceEnvironment>(*executionEnvironment);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
MockDevice mockDevice(executionEnvironment, 0);
SpecializationConstantProgramMock mockProgram(*executionEnvironment);
mockProgram.setDevice(&mockDevice);
MockClDevice mockDevice(new MockDevice{executionEnvironment, 0});
SpecializationConstantProgramMock mockProgram(toClDeviceVector(mockDevice));
mockProgram.isSpirV = true;
int specValue = 1;
@@ -3088,7 +3032,7 @@ TEST_F(ProgramBinTest, GivenDebugDataAvailableWhenLinkingProgramThenDebugDataIsS
using ProgramMultiRootDeviceTests = MultiRootDeviceFixture;
TEST_F(ProgramMultiRootDeviceTests, WhenPrivateSurfaceIsCreatedThenItHasCorrectRootDeviceIndex) {
auto program = std::make_unique<MockProgram>(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice());
auto program = std::make_unique<MockProgram>(context.get(), false, toClDeviceVector(*device));
auto privateSurfaceBlock = std::make_unique<SPatchAllocateStatelessPrivateSurface>();
privateSurfaceBlock->DataParamOffset = 0;
@@ -3149,9 +3093,9 @@ TEST(ProgramReplaceDeviceBinary, GivenBinaryZebinThenUseAsBothPackedAndUnpackedB
ZebinTestData::ValidEmptyProgram zebin;
std::unique_ptr<char[]> src = makeCopy(zebin.storage.data(), zebin.storage.size());
MockContext context;
auto device = &context.getDevice(0)->getDevice();
auto device = context.getDevice(0);
auto rootDeviceIndex = device->getRootDeviceIndex();
MockProgram program{*device->getExecutionEnvironment(), &context, false, device};
MockProgram program{&context, false, toClDeviceVector(*device)};
program.replaceDeviceBinary(std::move(src), zebin.storage.size(), rootDeviceIndex);
ASSERT_EQ(zebin.storage.size(), program.buildInfos[rootDeviceIndex].packedDeviceBinarySize);
ASSERT_EQ(zebin.storage.size(), program.buildInfos[rootDeviceIndex].unpackedDeviceBinarySize);

View File

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

View File

@@ -25,12 +25,12 @@
using namespace NEO;
TEST_F(ProgramTests, givenDeafultProgramObjectWhenKernelDebugEnabledIsQueriedThenFalseIsReturned) {
MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
EXPECT_FALSE(program.isKernelDebugEnabled());
}
TEST_F(ProgramTests, givenProgramObjectWhenEnableKernelDebugIsCalledThenProgramHasKernelDebugEnabled) {
MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false, pDevice);
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
program.enableKernelDebug();
EXPECT_TRUE(program.isKernelDebugEnabled());
}
@@ -43,7 +43,7 @@ TEST(ProgramFromBinary, givenBinaryWithDebugDataWhenCreatingProgramFromBinaryThe
retrieveBinaryKernelFilename(filePath, "-cl-kernel-debug-enable_", ".bin");
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto program = std::make_unique<MockProgram>(*device->getExecutionEnvironment());
auto program = std::make_unique<MockProgram>(toClDeviceVector(*device));
program->pDevice = &device->getDevice();
program->enableKernelDebug();
@@ -187,7 +187,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsLinke
cl_int retVal = pProgram->compile(1, &device, nullptr, 0, nullptr, nullptr, nullptr, nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
auto program = std::unique_ptr<GMockProgram>(new GMockProgram(*pContext->getDevice(0)->getExecutionEnvironment(), pContext, false, &pContext->getDevice(0)->getDevice()));
auto program = std::unique_ptr<GMockProgram>(new GMockProgram(pContext, false, toClDeviceVector(*pClDevice)));
program->enableKernelDebug();
EXPECT_CALL(*program, appendKernelDebugOptions()).Times(1);

View File

@@ -54,7 +54,7 @@ class SamplerSetArgFixture : public ClDeviceFixture {
pKernelInfo->kernelArgInfo[1].offsetHeap = 0x40;
pKernelInfo->kernelArgInfo[1].isSampler = true;
program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
pKernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice);
ASSERT_NE(nullptr, pKernel);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize());

View File

@@ -59,7 +59,7 @@ class MockSchedulerKernel : public SchedulerKernel {
TEST(SchedulerKernelTest, WhenSchedulerKernelIsCreatedThenLwsIs24) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
KernelInfo info;
MockSchedulerKernel kernel(&program, info, *device);
@@ -69,7 +69,7 @@ TEST(SchedulerKernelTest, WhenSchedulerKernelIsCreatedThenLwsIs24) {
TEST(SchedulerKernelTest, WhenSchedulerKernelIsCreatedThenGwsIs24) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
KernelInfo info;
MockSchedulerKernel kernel(&program, info, *device);
@@ -85,7 +85,7 @@ TEST(SchedulerKernelTest, WhenSchedulerKernelIsCreatedThenGwsIs24) {
TEST(SchedulerKernelTest, WhenSettingGwsThenGetGwsReturnedSetValue) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
KernelInfo info;
MockSchedulerKernel kernel(&program, info, *device);
@@ -98,7 +98,7 @@ TEST(SchedulerKernelTest, WhenSettingGwsThenGetGwsReturnedSetValue) {
TEST(SchedulerKernelTest, WhenSchedulerKernelIsCreatedThenCurbeSizeIsCorrect) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
KernelInfo info;
uint32_t crossTrheadDataSize = 32;
uint32_t dshSize = 48;
@@ -118,7 +118,7 @@ TEST(SchedulerKernelTest, WhenSchedulerKernelIsCreatedThenCurbeSizeIsCorrect) {
TEST(SchedulerKernelTest, WhenSettingArgsForSchedulerKernelThenAllocationsAreCorrect) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto context = clUniquePtr(new MockContext(device.get()));
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
auto program = clUniquePtr(new MockProgram(context.get(), false, toClDeviceVector(*device)));
program->setDevice(&device->getDevice());
std::unique_ptr<KernelInfo> info(nullptr);
KernelInfo *infoPtr = nullptr;
@@ -148,7 +148,7 @@ TEST(SchedulerKernelTest, WhenSettingArgsForSchedulerKernelThenAllocationsAreCor
TEST(SchedulerKernelTest, GivenNullDebugQueueWhenSettingArgsForSchedulerKernelThenAllocationsAreCorrect) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto context = clUniquePtr(new MockContext(device.get()));
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
auto program = clUniquePtr(new MockProgram(context.get(), false, toClDeviceVector(*device)));
program->setDevice(&device->getDevice());
std::unique_ptr<KernelInfo> info(nullptr);
@@ -179,8 +179,7 @@ TEST(SchedulerKernelTest, GivenNullDebugQueueWhenSettingArgsForSchedulerKernelTh
TEST(SchedulerKernelTest, givenGraphicsAllocationWithDifferentCpuAndGpuAddressesWhenCallSetArgsThenGpuAddressesAreTaken) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto context = clUniquePtr(new MockContext(device.get()));
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
program->setDevice(&device->getDevice());
auto program = clUniquePtr(new MockProgram(context.get(), false, toClDeviceVector(*device)));
std::unique_ptr<KernelInfo> info(nullptr);
KernelInfo *infoPtr = nullptr;
@@ -214,7 +213,7 @@ TEST(SchedulerKernelTest, GivenForceDispatchSchedulerWhenCreatingKernelReflectio
DebugManager.flags.ForceDispatchScheduler.set(true);
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto context = clUniquePtr(new MockContext(device.get()));
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
auto program = clUniquePtr(new MockProgram(context.get(), false, toClDeviceVector(*device)));
program->setDevice(&device->getDevice());
std::unique_ptr<KernelInfo> info(nullptr);
@@ -233,7 +232,7 @@ TEST(SchedulerKernelTest, GivenForceDispatchSchedulerWhenCreatingKernelReflectio
DebugManager.flags.ForceDispatchScheduler.set(true);
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto context = clUniquePtr(new MockContext(device.get()));
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
auto program = clUniquePtr(new MockProgram(context.get(), false, toClDeviceVector(*device)));
program->setDevice(&device->getDevice());
std::unique_ptr<KernelInfo> info(nullptr);
@@ -256,7 +255,7 @@ TEST(SchedulerKernelTest, GivenNoForceDispatchSchedulerWhenCreatingKernelReflect
DebugManager.flags.ForceDispatchScheduler.set(false);
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto context = clUniquePtr(new MockContext(device.get()));
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
auto program = clUniquePtr(new MockProgram(context.get(), false, toClDeviceVector(*device)));
program->setDevice(&device->getDevice());
std::unique_ptr<KernelInfo> info(nullptr);
@@ -271,7 +270,7 @@ TEST(SchedulerKernelTest, GivenNoForceDispatchSchedulerWhenCreatingKernelReflect
TEST(SchedulerKernelTest, GivenNullKernelInfoWhenGettingCurbeSizeThenSizeIsCorrect) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
KernelInfo info;
info.patchInfo.dataParameterStream = nullptr;
@@ -287,7 +286,7 @@ TEST(SchedulerKernelTest, givenForcedSchedulerGwsByDebugVariableWhenSchedulerKer
DebugManager.flags.SchedulerGWS.set(48);
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
KernelInfo info;
MockSchedulerKernel kernel(&program, info, *device);
@@ -300,7 +299,7 @@ TEST(SchedulerKernelTest, givenSimulationModeWhenSchedulerKernelIsCreatedThenGws
hwInfo.featureTable.ftrSimulationMode = true;
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
KernelInfo info;
MockSchedulerKernel kernel(&program, info, *device);
@@ -316,7 +315,7 @@ TEST(SchedulerKernelTest, givenForcedSchedulerGwsByDebugVariableAndSimulationMod
hwInfo.featureTable.ftrSimulationMode = true;
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
KernelInfo info;
MockSchedulerKernel kernel(&program, info, *device);

View File

@@ -347,7 +347,7 @@ TEST(FileLogger, GivenNullMdiWhenDumpingKernelsThenFileIsNotCreated) {
TEST(FileLogger, GivenDebugFunctionalityWhenDebugFlagIsDisabledThenDoNotDumpKernelArgsForMdi) {
auto kernelInfo = std::make_unique<KernelInfo>();
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
auto kernel = std::unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
auto multiDispatchInfo = std::unique_ptr<MockMultiDispatchInfo>(new MockMultiDispatchInfo(kernel.get()));
@@ -382,7 +382,7 @@ TEST(FileLogger, GivenDebugFunctionalityWhenDebugFlagIsDisabledThenDoNotDumpKern
TEST(FileLogger, GivenMdiWhenDumpingKernelArgsThenFileIsCreated) {
auto kernelInfo = std::make_unique<KernelInfo>();
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
auto kernel = std::unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
auto multiDispatchInfo = std::unique_ptr<MockMultiDispatchInfo>(new MockMultiDispatchInfo(kernel.get()));
@@ -427,7 +427,7 @@ TEST(FileLogger, GivenNullWhenDumpingKernelArgsThenFileIsNotCreated) {
TEST(FileLogger, GivenEmptyKernelWhenDumpingKernelArgsThenFileIsNotCreated) {
auto kernelInfo = std::make_unique<KernelInfo>();
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
auto kernel = std::unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
std::string testFile = "testfile";
@@ -443,7 +443,7 @@ TEST(FileLogger, GivenEmptyKernelWhenDumpingKernelArgsThenFileIsNotCreated) {
TEST(FileLogger, GivenImmediateWhenDumpingKernelArgsThenFileIsCreated) {
auto kernelInfo = std::make_unique<KernelInfo>();
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
auto kernel = std::unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
KernelArgPatchInfo kernelArgPatchInfo;
@@ -477,7 +477,7 @@ TEST(FileLogger, GivenImmediateZeroSizeWhenDumpingKernelArgsThenFileIsNotCreated
auto kernelInfo = std::make_unique<KernelInfo>();
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
auto kernel = std::unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
KernelArgPatchInfo kernelArgPatchInfo;
@@ -507,7 +507,7 @@ TEST(FileLogger, GivenLocalBufferWhenDumpingKernelArgsThenFileIsNotCreated) {
auto kernelInfo = std::make_unique<KernelInfo>();
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
MockProgram program(toClDeviceVector(*device));
auto kernel = std::unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
KernelArgPatchInfo kernelArgPatchInfo;
@@ -530,7 +530,7 @@ TEST(FileLogger, GivenBufferNotSetWhenDumpingKernelArgsThenFileIsNotCreated) {
auto kernelInfo = std::make_unique<KernelInfo>();
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto context = clUniquePtr(new MockContext(device.get()));
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
auto program = clUniquePtr(new MockProgram(context.get(), false, toClDeviceVector(*device)));
auto kernel = clUniquePtr(new MockKernel(program.get(), *kernelInfo, *device));
KernelArgPatchInfo kernelArgPatchInfo;
@@ -564,7 +564,7 @@ TEST(FileLogger, GivenBufferWhenDumpingKernelArgsThenFileIsCreated) {
cl_mem clObj = buffer;
auto kernelInfo = std::make_unique<KernelInfo>();
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
auto program = clUniquePtr(new MockProgram(context.get(), false, toClDeviceVector(*device)));
auto kernel = clUniquePtr(new MockKernel(program.get(), *kernelInfo, *device));
KernelArgPatchInfo kernelArgPatchInfo;
@@ -603,7 +603,7 @@ TEST(FileLogger, GivenSamplerWhenDumpingKernelArgsThenFileIsNotCreated) {
auto kernelInfo = std::make_unique<KernelInfo>();
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto context = clUniquePtr(new MockContext(device.get()));
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
auto program = clUniquePtr(new MockProgram(context.get(), false, toClDeviceVector(*device)));
auto kernel = clUniquePtr(new MockKernel(program.get(), *kernelInfo, *device));
KernelArgPatchInfo kernelArgPatchInfo;
@@ -631,7 +631,7 @@ TEST(FileLogger, GivenImageNotSetWhenDumpingKernelArgsThenFileIsNotCreated) {
auto kernelInfo = std::make_unique<KernelInfo>();
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto context = clUniquePtr(new MockContext(device.get()));
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
auto program = clUniquePtr(new MockProgram(context.get(), false, toClDeviceVector(*device)));
auto kernel = clUniquePtr(new MockKernel(program.get(), *kernelInfo, *device));
char surfaceStateHeap[0x80];

View File

@@ -314,7 +314,6 @@ TEST(CompilerInterfaceCachedTests, GivenCachedBinaryWhenBuildingThenSuccessIsRet
TEST(CompilerInterfaceCachedTests, givenKernelWithoutIncludesAndBinaryInCacheWhenCompilationRequestedThenFCLIsNotCalled) {
MockClDevice device{new MockDevice};
MockContext context(&device, true);
MockProgram program(*device.getExecutionEnvironment(), &context, false, nullptr);
TranslationInput inputArgs{IGC::CodeType::oclC, IGC::CodeType::oclGenBin};
auto src = "__kernel k() {}";
@@ -347,7 +346,6 @@ TEST(CompilerInterfaceCachedTests, givenKernelWithoutIncludesAndBinaryInCacheWhe
TEST(CompilerInterfaceCachedTests, givenKernelWithIncludesAndBinaryInCacheWhenCompilationRequestedThenFCLIsCalled) {
MockClDevice device{new MockDevice};
MockContext context(&device, true);
MockProgram program(*device.getExecutionEnvironment(), &context, false, nullptr);
TranslationInput inputArgs{IGC::CodeType::oclC, IGC::CodeType::oclGenBin};
auto src = "#include \"file.h\"\n__kernel k() {}";

View File

@@ -31,7 +31,6 @@ void DevicePreemptionTests::SetUp() {
device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
executionEnvironment.reset(new SPatchExecutionEnvironment);
memset(executionEnvironment.get(), 0, sizeof(SPatchExecutionEnvironment));
program = std::make_unique<MockProgram>(*device->getExecutionEnvironment());
ASSERT_NE(nullptr, device);

View File

@@ -45,7 +45,6 @@ class DevicePreemptionTests : public ::testing::Test {
std::unique_ptr<NEO::MockDevice> device;
std::unique_ptr<DebugManagerStateRestore> dbgRestore;
std::unique_ptr<iOpenCL::SPatchExecutionEnvironment> executionEnvironment;
std::unique_ptr<NEO::MockProgram> program;
};
struct PreemptionTestHwDetails {