mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-31 20:13:04 +08:00
Remove MockProgram::setDevice
Related-To: NEO-5001 Change-Id: I42ed743311de085f365d321ad30c983f48db8bf8 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
63d5c2b42a
commit
a977ee6c15
@@ -764,7 +764,6 @@ TEST_P(ProgramFromSourceTest, GivenSpecificParamatersWhenBuildingProgramThenSucc
|
||||
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment = std::make_unique<NoCompilerInterfaceRootDeviceEnvironment>(*executionEnvironment);
|
||||
std::swap(rootDeviceEnvironment, executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]);
|
||||
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);
|
||||
p2.reset(nullptr);
|
||||
@@ -776,7 +775,6 @@ TEST_P(ProgramFromSourceTest, GivenSpecificParamatersWhenBuildingProgramThenSucc
|
||||
|
||||
// fail build - linked code is corrupted and cannot be postprocessed
|
||||
auto p3 = std::make_unique<FailingGenBinaryProgram>(toClDeviceVector(*device));
|
||||
p3->setDevice(&device->getDevice());
|
||||
std::string testFile;
|
||||
size_t sourceSize;
|
||||
testFile.append(clFiles);
|
||||
@@ -877,7 +875,6 @@ TEST_P(ProgramFromSourceTest, WhenBuildingProgramWithOpenClC30ThenFeaturesOption
|
||||
auto pClDevice = pContext->getDevice(0);
|
||||
pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
|
||||
auto pProgram = std::make_unique<SucceedingGenBinaryProgram>(toClDeviceVector(*pClDevice));
|
||||
pProgram->setDevice(&pClDevice->getDevice());
|
||||
pProgram->sourceCode = "__kernel mock() {}";
|
||||
pProgram->createdFrom = Program::CreatedFrom::SOURCE;
|
||||
|
||||
@@ -891,7 +888,6 @@ TEST_P(ProgramFromSourceTest, WhenBuildingProgramWithOpenClC30ThenFeaturesOption
|
||||
auto pClDevice = pContext->getDevice(0);
|
||||
pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
|
||||
auto pProgram = std::make_unique<SucceedingGenBinaryProgram>(toClDeviceVector(*pClDevice));
|
||||
pProgram->setDevice(&pClDevice->getDevice());
|
||||
pProgram->sourceCode = "__kernel mock() {}";
|
||||
pProgram->createdFrom = Program::CreatedFrom::SOURCE;
|
||||
|
||||
@@ -926,7 +922,6 @@ TEST_P(ProgramFromSourceTest, WhenCompilingProgramWithOpenClC30ThenFeaturesOptio
|
||||
auto pClDevice = pContext->getDevice(0);
|
||||
pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(pCompilerInterface);
|
||||
auto pProgram = std::make_unique<SucceedingGenBinaryProgram>(toClDeviceVector(*pClDevice));
|
||||
pProgram->setDevice(&pClDevice->getDevice());
|
||||
pProgram->sourceCode = "__kernel mock() {}";
|
||||
pProgram->createdFrom = Program::CreatedFrom::SOURCE;
|
||||
|
||||
@@ -1125,7 +1120,6 @@ TEST_P(ProgramFromSourceTest, GivenSpecificParamatersWhenCompilingProgramThenSuc
|
||||
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment = std::make_unique<NoCompilerInterfaceRootDeviceEnvironment>(*executionEnvironment);
|
||||
std::swap(rootDeviceEnvironment, executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]);
|
||||
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);
|
||||
p2.reset(nullptr);
|
||||
@@ -1151,7 +1145,6 @@ TEST_P(ProgramFromSourceTest, GivenFlagsWhenCompilingProgramThenBuildOptionsHave
|
||||
auto pDevice = pContext->getDevice(0);
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
|
||||
auto program = std::make_unique<SucceedingGenBinaryProgram>(toClDeviceVector(*pDevice));
|
||||
program->setDevice(&pDevice->getDevice());
|
||||
program->sourceCode = "__kernel mock() {}";
|
||||
|
||||
// Ask to build created program without NEO::CompilerOptions::gtpinRera and NEO::CompilerOptions::greaterThan4gbBuffersRequired flags.
|
||||
@@ -1185,7 +1178,6 @@ TEST_P(ProgramFromSourceTest, GivenFlagsWhenCompilingProgramThenBuildOptionsHave
|
||||
TEST_F(ProgramTests, GivenFlagsWhenLinkingProgramThenBuildOptionsHaveBeenApplied) {
|
||||
auto cip = new MockCompilerInterfaceCaptureBuildOptions();
|
||||
auto pProgram = std::make_unique<SucceedingGenBinaryProgram>(toClDeviceVector(*pClDevice));
|
||||
pProgram->setDevice(pDevice);
|
||||
pProgram->sourceCode = "__kernel mock() {}";
|
||||
pProgram->createdFrom = Program::CreatedFrom::SOURCE;
|
||||
|
||||
@@ -1341,7 +1333,6 @@ 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>(toClDeviceVector(*device));
|
||||
p2->setDevice(&device->getDevice());
|
||||
retVal = p2->link(0, nullptr, nullptr, 1, &program, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_INVALID_BINARY, retVal);
|
||||
p2.reset(nullptr);
|
||||
@@ -1380,7 +1371,6 @@ TEST_P(ProgramFromSourceTest, GivenInvalidOptionsWhenCreatingLibraryThenCorrectE
|
||||
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment = std::make_unique<NoCompilerInterfaceRootDeviceEnvironment>(*executionEnvironment);
|
||||
std::swap(rootDeviceEnvironment, executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]);
|
||||
auto failingProgram = std::make_unique<MockProgram>(toClDeviceVector(*device));
|
||||
failingProgram->setDevice(&device->getDevice());
|
||||
|
||||
// fail library creation - CompilerInterface cannot be obtained
|
||||
retVal = failingProgram->link(0, nullptr, CompilerOptions::createLibrary.data(), 1, &program, nullptr, nullptr);
|
||||
@@ -2078,7 +2068,6 @@ TEST_F(ProgramTests, GivenNoCompilerInterfaceRootDeviceEnvironmentWhenRebuilding
|
||||
std::swap(rootDeviceEnvironment, executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
|
||||
auto program = std::make_unique<MockProgram>(toClDeviceVector(*pDevice));
|
||||
EXPECT_NE(nullptr, program);
|
||||
program->setDevice(&pDevice->getDevice());
|
||||
|
||||
// Load a binary program file
|
||||
std::string filePath;
|
||||
@@ -2102,7 +2091,6 @@ TEST_F(ProgramTests, GivenGtpinReraFlagWhenBuildingProgramThenCorrectOptionsAreS
|
||||
auto pDevice = pContext->getDevice(0);
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
|
||||
auto program = std::make_unique<SucceedingGenBinaryProgram>(toClDeviceVector(*pDevice));
|
||||
program->setDevice(&pDevice->getDevice());
|
||||
program->sourceCode = "__kernel mock() {}";
|
||||
program->createdFrom = Program::CreatedFrom::SOURCE;
|
||||
|
||||
@@ -2132,9 +2120,6 @@ TEST_F(ProgramTests, GivenFailingGenBinaryProgramWhenRebuildingBinaryThenInvalid
|
||||
|
||||
auto program = std::make_unique<FailingGenBinaryProgram>(toClDeviceVector(*pClDevice));
|
||||
EXPECT_NE(nullptr, program);
|
||||
cl_device_id deviceId = pContext->getDevice(0);
|
||||
ClDevice *pDevice = castToObject<ClDevice>(deviceId);
|
||||
program->setDevice(&pDevice->getDevice());
|
||||
|
||||
// Load a binary program file
|
||||
std::string filePath;
|
||||
@@ -2655,8 +2640,6 @@ TEST_F(ProgramTests, givenProgramWithSpirvWhenRebuildProgramIsCalledThenSpirvPat
|
||||
}
|
||||
|
||||
TEST_F(ProgramTests, whenRebuildingProgramThenStoreDeviceBinaryProperly) {
|
||||
auto device = castToObject<ClDevice>(pContext->getDevice(0));
|
||||
|
||||
auto compilerInterface = new MockCompilerInterface();
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->compilerInterface.reset(compilerInterface);
|
||||
auto compilerMain = new MockCIFMain();
|
||||
@@ -2671,7 +2654,6 @@ TEST_F(ProgramTests, whenRebuildingProgramThenStoreDeviceBinaryProperly) {
|
||||
std::unique_ptr<void, void (*)(void *)> igcDebugVarsAutoPop{&gEnvironment, [](void *) { gEnvironment->igcPopDebugVars(); }};
|
||||
|
||||
auto program = clUniquePtr(new MockProgram(toClDeviceVector(*pClDevice)));
|
||||
program->setDevice(&device->getDevice());
|
||||
uint32_t ir[16] = {0x03022307, 0x23471113, 0x17192329};
|
||||
program->irBinary = makeCopy(ir, sizeof(ir));
|
||||
program->irBinarySize = sizeof(ir);
|
||||
@@ -2739,18 +2721,16 @@ TEST_F(ProgramTests, givenProgramWhenInternalOptionsArePassedWithInvalidValuesTh
|
||||
|
||||
class AdditionalOptionsMockProgram : public MockProgram {
|
||||
public:
|
||||
AdditionalOptionsMockProgram() : MockProgram(toClDeviceVector(*(new MockClDevice(new MockDevice())))), device(this->clDevices[0]) {}
|
||||
using MockProgram::MockProgram;
|
||||
void applyAdditionalOptions() override {
|
||||
applyAdditionalOptionsCalled++;
|
||||
MockProgram::applyAdditionalOptions();
|
||||
}
|
||||
uint32_t applyAdditionalOptionsCalled = 0;
|
||||
std::unique_ptr<ClDevice> device;
|
||||
};
|
||||
|
||||
TEST_F(ProgramTests, givenProgramWhenBuiltThenAdditionalOptionsAreApplied) {
|
||||
AdditionalOptionsMockProgram program;
|
||||
program.setDevice(pDevice);
|
||||
AdditionalOptionsMockProgram program(toClDeviceVector(*pClDevice));
|
||||
cl_device_id device = pClDevice;
|
||||
|
||||
program.build(1, &device, nullptr, nullptr, nullptr, false);
|
||||
|
||||
Reference in New Issue
Block a user