mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Tests update: create memory manager for command stream receiver
Change-Id: I89b577759d6da112049a8b0135ae488f2849c140 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
47a0c43ad3
commit
1635bef9a8
@@ -81,6 +81,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenItIsCre
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseAubStream.set(false);
|
||||
MockExecutionEnvironment executionEnvironment(platformDevices[0], false);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, executionEnvironment);
|
||||
ASSERT_NE(nullptr, aubCsr);
|
||||
@@ -208,6 +209,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
|
||||
DebugManager.flags.AUBDumpSubCaptureMode.set(static_cast<int32_t>(AubSubCaptureManager::SubCaptureMode::Filter));
|
||||
std::string fileName = "file_name.aub";
|
||||
MockExecutionEnvironment executionEnvironment(platformDevices[0]);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(static_cast<AUBCommandStreamReceiverHw<FamilyType> *>(AUBCommandStreamReceiver::create(fileName, true, executionEnvironment)));
|
||||
EXPECT_NE(nullptr, aubCsr);
|
||||
EXPECT_FALSE(aubCsr->isFileOpen());
|
||||
|
||||
@@ -701,6 +701,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenEngineI
|
||||
auto engineInstance = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances()[0];
|
||||
MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false);
|
||||
MockExecutionEnvironment executionEnvironment(platformDevices[0]);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
auto aubCsr = std::make_unique<MockAubCsrToTestDumpContext<FamilyType>>("", true, executionEnvironment);
|
||||
EXPECT_NE(nullptr, aubCsr);
|
||||
|
||||
@@ -46,6 +46,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenInitFileIsCalledWi
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithoutAubManagerWhenInitFileIsCalledWithInvalidFileNameThenFileIsNotOpened) {
|
||||
MockExecutionEnvironment executionEnvironment(platformDevices[0]);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, executionEnvironment);
|
||||
std::string invalidFileName = "";
|
||||
aubCsr->aubManager = nullptr;
|
||||
|
||||
@@ -241,6 +241,7 @@ HWTEST_F(CommandStreamReceiverTest, givenCsrWhenAllocateHeapMemoryIsCalledThenHe
|
||||
|
||||
TEST(CommandStreamReceiverSimpleTest, givenCSRWithoutTagAllocationWhenGetTagAllocationIsCalledThenNullptrIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
MockCommandStreamReceiver csr(executionEnvironment);
|
||||
EXPECT_EQ(nullptr, csr.getTagAllocation());
|
||||
}
|
||||
@@ -301,14 +302,6 @@ HWTEST_F(CommandStreamReceiverTest, givenUltCommandStreamReceiverWhenAddAubComme
|
||||
EXPECT_TRUE(csr.addAubCommentCalled);
|
||||
}
|
||||
|
||||
TEST(CommandStreamReceiverSimpleTest, givenCSRWithTagAllocationSetWhenGetTagAllocationIsCalledThenCorrectAllocationIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
MockCommandStreamReceiver csr(executionEnvironment);
|
||||
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
|
||||
csr.setTagAllocation(&allocation);
|
||||
EXPECT_EQ(&allocation, csr.getTagAllocation());
|
||||
}
|
||||
|
||||
TEST(CommandStreamReceiverSimpleTest, givenCommandStreamReceiverWhenItIsDestroyedThenItDestroysTagAllocation) {
|
||||
struct MockGraphicsAllocationWithDestructorTracing : public MockGraphicsAllocation {
|
||||
using MockGraphicsAllocation::MockGraphicsAllocation;
|
||||
@@ -364,6 +357,7 @@ TEST(CommandStreamReceiverSimpleTest, givenNullHardwareDebugModeWhenInitializeTa
|
||||
|
||||
TEST(CommandStreamReceiverSimpleTest, givenVariousDataSetsWhenVerifyingMemoryThenCorrectValueIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
MockCommandStreamReceiver csr(executionEnvironment);
|
||||
|
||||
constexpr size_t setSize = 6;
|
||||
@@ -619,6 +613,7 @@ HWTEST_P(CommandStreamReceiverWithAubSubCaptureTest, givenCommandStreamReceiverW
|
||||
bool isActive = status.second;
|
||||
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
MyMockCsr mockCsr(executionEnvironment);
|
||||
|
||||
mockCsr.programForAubSubCapture(wasActiveInPreviousEnqueue, isActive);
|
||||
|
||||
@@ -108,12 +108,12 @@ struct CommandStreamReceiverWithAubDumpTest : public ::testing::TestWithParam<bo
|
||||
void SetUp() override {
|
||||
MockAubCenterFixture::SetUp();
|
||||
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
createAubCSR = GetParam();
|
||||
csrWithAubDump = new MyMockCsrWithAubDump<MyMockCsr>(createAubCSR, *executionEnvironment);
|
||||
ASSERT_NE(nullptr, csrWithAubDump);
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
memoryManager = executionEnvironment->memoryManager.get();
|
||||
ASSERT_NE(nullptr, memoryManager);
|
||||
createAubCSR = GetParam();
|
||||
csrWithAubDump = new MyMockCsrWithAubDump<MyMockCsr>(createAubCSR, *executionEnvironment);
|
||||
ASSERT_NE(nullptr, csrWithAubDump);
|
||||
|
||||
auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(csrWithAubDump,
|
||||
getChosenEngineType(DEFAULT_TEST_PLATFORM::hwInfo), 1,
|
||||
@@ -135,6 +135,7 @@ using CommandStreamReceiverWithAubDumpSimpleTest = Test<MockAubCenterFixture>;
|
||||
|
||||
HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenCsrWithAubDumpWhenSettingOsContextThenReplicateItToAubCsr) {
|
||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
|
||||
CommandStreamReceiverWithAUBDump<UltCommandStreamReceiver<FamilyType>> csrWithAubDump("aubfile", *executionEnvironment);
|
||||
MockOsContext osContext(0, 1, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances()[0],
|
||||
@@ -147,6 +148,7 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenCsrWithAubDumpWhenSett
|
||||
|
||||
HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenAubManagerAvailableWhenTbxCsrWithAubDumpIsCreatedThenAubCsrIsNotCreated) {
|
||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
std::string fileName = "file_name.aub";
|
||||
MockAubManager *mockManager = new MockAubManager();
|
||||
MockAubCenter *mockAubCenter = new MockAubCenter(*platformDevices, false, fileName, CommandStreamReceiverType::CSR_TBX_WITH_AUB);
|
||||
@@ -164,6 +166,7 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenAubManagerAvailableWhe
|
||||
mockAubCenter->aubManager = std::unique_ptr<MockAubManager>(mockManager);
|
||||
|
||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
executionEnvironment->aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
|
||||
CommandStreamReceiverWithAUBDump<UltCommandStreamReceiver<FamilyType>> csrWithAubDump("aubfile", *executionEnvironment);
|
||||
@@ -173,6 +176,7 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenAubManagerAvailableWhe
|
||||
HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenNullAubManagerAvailableWhenTbxCsrWithAubDumpIsCreatedThenAubCsrIsCreated) {
|
||||
MockAubCenter *mockAubCenter = new MockAubCenter();
|
||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
executionEnvironment->aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
|
||||
CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>> csrWithAubDump("aubfile", *executionEnvironment);
|
||||
@@ -183,6 +187,7 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenAubManagerNotAvailable
|
||||
std::string fileName = "file_name.aub";
|
||||
|
||||
MockExecutionEnvironment executionEnvironment(platformDevices[0]);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
CommandStreamReceiverWithAUBDump<UltCommandStreamReceiver<FamilyType>> csrWithAubDump("aubfile", executionEnvironment);
|
||||
ASSERT_NE(nullptr, csrWithAubDump.aubCSR);
|
||||
}
|
||||
|
||||
@@ -153,6 +153,7 @@ TEST(TbxCommandStreamReceiverTest, givenTbxCommandStreamReceiverWhenItIsCreatedW
|
||||
|
||||
TEST(TbxCommandStreamReceiverTest, givenTbxCommandStreamReceiverWhenTypeIsCheckedThenTbxCsrIsReturned) {
|
||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
std::unique_ptr<CommandStreamReceiver> csr(TbxCommandStreamReceiver::create("", false, *executionEnvironment));
|
||||
EXPECT_NE(nullptr, csr);
|
||||
EXPECT_EQ(CommandStreamReceiverType::CSR_TBX, csr->getType());
|
||||
@@ -433,6 +434,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenItIsCreatedWith
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.UseAubStream.set(false);
|
||||
MockExecutionEnvironment executionEnvironment(platformDevices[0], false);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
auto tbxCsr = std::make_unique<TbxCommandStreamReceiverHw<FamilyType>>(executionEnvironment);
|
||||
EXPECT_EQ(nullptr, executionEnvironment.aubCenter->getAubManager());
|
||||
@@ -567,6 +569,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenItIsQueriedForPreferredTagPoolSiz
|
||||
HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpThenFileNameIsExtendedWithSystemInfo) {
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.setHwInfo(*platformDevices);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
setMockAubCenter(&executionEnvironment, CommandStreamReceiverType::CSR_TBX);
|
||||
|
||||
@@ -579,6 +582,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpThenFileNameIsE
|
||||
HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpThenOpenIsCalledOnAubManagerToOpenFileStream) {
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.setHwInfo(*platformDevices);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
std::unique_ptr<TbxCommandStreamReceiverHw<FamilyType>> tbxCsrWithAubDump(reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(
|
||||
TbxCommandStreamReceiver::create("aubfile", true, executionEnvironment)));
|
||||
@@ -588,6 +592,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpThenOpenIsCalle
|
||||
HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpSeveralTimesThenOpenIsCalledOnAubManagerOnceOnly) {
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices, true);
|
||||
executionEnvironment.setHwInfo(*platformDevices);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
auto tbxCsrWithAubDump1 = std::unique_ptr<TbxCommandStreamReceiverHw<FamilyType>>(reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(
|
||||
TbxCommandStreamReceiverHw<FamilyType>::create("aubfile", true, executionEnvironment)));
|
||||
|
||||
@@ -112,12 +112,14 @@ TEST(ExecutionEnvironment, givenDeviceWhenItIsDestroyedThenMemoryManagerIsStillA
|
||||
|
||||
TEST(ExecutionEnvironment, givenExecutionEnvironmentWhenInitializeCommandStreamReceiverIsCalledThenItIsInitalized) {
|
||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
executionEnvironment->initializeCommandStreamReceiver(0, 0);
|
||||
EXPECT_NE(nullptr, executionEnvironment->commandStreamReceivers[0][0]);
|
||||
}
|
||||
|
||||
TEST(ExecutionEnvironment, givenExecutionEnvironmentWhenInitializeIsCalledWithDifferentDeviceIndexesThenInternalStorageIsResized) {
|
||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
EXPECT_EQ(0u, executionEnvironment->commandStreamReceivers.size());
|
||||
executionEnvironment->initializeCommandStreamReceiver(0, 0);
|
||||
EXPECT_EQ(1u, executionEnvironment->commandStreamReceivers.size());
|
||||
@@ -129,6 +131,7 @@ TEST(ExecutionEnvironment, givenExecutionEnvironmentWhenInitializeIsCalledWithDi
|
||||
|
||||
TEST(ExecutionEnvironment, givenExecutionEnvironmentWhenInitializeIsCalledMultipleTimesForTheSameIndexThenCommandStreamReceiverIsReused) {
|
||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
EXPECT_EQ(0u, executionEnvironment->commandStreamReceivers.size());
|
||||
executionEnvironment->initializeCommandStreamReceiver(0, 1);
|
||||
|
||||
@@ -271,6 +274,7 @@ HWTEST_F(ExecutionEnvironmentHw, givenHwHelperInputWhenInitializingCsrThenCreate
|
||||
localHwInfo.capabilityTable.ftrRenderCompressedImages = false;
|
||||
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
executionEnvironment.setHwInfo(&localHwInfo);
|
||||
executionEnvironment.initializeCommandStreamReceiver(0, 0);
|
||||
auto csr0 = static_cast<UltCommandStreamReceiver<FamilyType> *>(executionEnvironment.commandStreamReceivers[0][0].get());
|
||||
|
||||
@@ -16,6 +16,7 @@ typedef ::testing::Test Gen8CoherencyRequirements;
|
||||
|
||||
GEN8TEST_F(Gen8CoherencyRequirements, noCoherencyProgramming) {
|
||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
CommandStreamReceiverHw<BDWFamily> csr(*executionEnvironment);
|
||||
LinearStream stream;
|
||||
DispatchFlags flags = {};
|
||||
|
||||
@@ -16,6 +16,7 @@ typedef ::testing::Test Gen9CoherencyRequirements;
|
||||
|
||||
GEN9TEST_F(Gen9CoherencyRequirements, noCoherencyProgramming) {
|
||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
CommandStreamReceiverHw<SKLFamily> csr(*executionEnvironment);
|
||||
LinearStream stream;
|
||||
DispatchFlags flags = {};
|
||||
|
||||
@@ -458,6 +458,7 @@ class CommandStreamReceiverMock : public CommandStreamReceiver {
|
||||
using BaseClass::CommandStreamReceiver;
|
||||
CommandStreamReceiverMock() : BaseClass(*(new ExecutionEnvironment)) {
|
||||
this->mockExecutionEnvironment.reset(&this->executionEnvironment);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
}
|
||||
|
||||
void makeResident(GraphicsAllocation &graphicsAllocation) override {
|
||||
|
||||
@@ -147,6 +147,7 @@ TEST_F(DeviceCommandStreamTest, CreateWddmCSR) {
|
||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->osInterface->get()->setWddm(static_cast<WddmMock *>(wddm));
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
std::unique_ptr<WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>> csr(static_cast<WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> *>(WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>::create(false, *executionEnvironment)));
|
||||
EXPECT_NE(nullptr, csr);
|
||||
auto wddmFromCsr = csr->peekWddm();
|
||||
@@ -158,6 +159,7 @@ TEST_F(DeviceCommandStreamTest, CreateWddmCSRWithAubDump) {
|
||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->osInterface->get()->setWddm(static_cast<WddmMock *>(wddm));
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
std::unique_ptr<WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>> csr(static_cast<WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> *>(WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>::create(true, *executionEnvironment)));
|
||||
EXPECT_NE(nullptr, csr);
|
||||
auto wddmFromCsr = csr->peekWddm();
|
||||
|
||||
Reference in New Issue
Block a user