Create dedicated allocation for global fence purposes

Related-To: NEO-3216

Change-Id: I0483a99ea1095c7a10b1318f51569e479386cac4
Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
This commit is contained in:
Milczarek, Slawomir
2020-02-05 20:00:08 +01:00
committed by sys_ocldev
parent 004ea3946d
commit 8560b2b262
16 changed files with 99 additions and 1 deletions

View File

@@ -304,6 +304,29 @@ HWTEST_F(DeviceHwTest, givenHwHelperInputWhenInitializingCsrThenCreatePageTableM
EXPECT_EQ(csr2.needsPageTableManager(defaultEngineType), csr2.createPageTableManagerCalled);
}
HWTEST_F(DeviceHwTest, givenDeviceCreationWhenCsrFailsToCreateGlobalSyncAllocationThenReturnNull) {
class MockUltCsrThatFailsToCreateGlobalFenceAllocation : public UltCommandStreamReceiver<FamilyType> {
public:
MockUltCsrThatFailsToCreateGlobalFenceAllocation(ExecutionEnvironment &executionEnvironment)
: UltCommandStreamReceiver<FamilyType>(executionEnvironment, 0) {}
bool createGlobalFenceAllocation() override {
return false;
}
};
class MockDeviceThatFailsToCreateGlobalFenceAllocation : public MockDevice {
public:
MockDeviceThatFailsToCreateGlobalFenceAllocation(ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex)
: MockDevice(executionEnvironment, deviceIndex) {}
std::unique_ptr<CommandStreamReceiver> createCommandStreamReceiver() const override {
return std::make_unique<MockUltCsrThatFailsToCreateGlobalFenceAllocation>(*executionEnvironment);
}
};
auto executionEnvironment = platform()->peekExecutionEnvironment();
auto mockDevice(MockDevice::create<MockDeviceThatFailsToCreateGlobalFenceAllocation>(executionEnvironment, 0));
EXPECT_EQ(nullptr, mockDevice);
}
TEST(DeviceGenEngineTest, givenHwCsrModeWhenGetEngineThenDedicatedForInternalUsageEngineIsReturned) {
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));