Adjust GmmHelper to be HW aware

Related-To: NEO-6523
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2022-06-08 08:23:02 +00:00
committed by Compute-Runtime-Automation
parent 6d43e96dee
commit c229ace4df
77 changed files with 264 additions and 31 deletions

View File

@ -329,6 +329,8 @@ using WddmPreemptionHeaderTests = ::Test<WddmPreemptionHeaderFixture>;
TEST_F(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOffWhenWorkloadIsSubmittedThenHeaderDoesntHavePreemptionFieldSet) {
hwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(hwInfo);
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto csr = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(*executionEnvironment, 0, 1);
executionEnvironment->memoryManager.reset(new MemoryManagerCreate<WddmMemoryManager>(false, false, *executionEnvironment));
csr->overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
@ -352,6 +354,8 @@ TEST_F(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIs
TEST_F(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOnWhenWorkloadIsSubmittedThenHeaderDoesHavePreemptionFieldSet) {
hwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(hwInfo);
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto csr = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(*executionEnvironment, 0, 1);
executionEnvironment->memoryManager.reset(new MemoryManagerCreate<WddmMemoryManager>(false, false, *executionEnvironment));
csr->overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
@ -376,6 +380,8 @@ TEST_F(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIs
TEST_F(WddmPreemptionHeaderTests, givenDeviceSupportingPreemptionWhenCommandStreamReceiverIsCreatedThenHeaderContainsPreemptionFieldSet) {
hwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(hwInfo);
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto commandStreamReceiver = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(*executionEnvironment, 0, 1);
auto commandHeader = commandStreamReceiver->commandBufferHeader;
auto header = reinterpret_cast<COMMAND_BUFFER_HEADER *>(commandHeader);
@ -385,6 +391,8 @@ TEST_F(WddmPreemptionHeaderTests, givenDeviceSupportingPreemptionWhenCommandStre
TEST_F(WddmPreemptionHeaderTests, givenDevicenotSupportingPreemptionWhenCommandStreamReceiverIsCreatedThenHeaderPreemptionFieldIsNotSet) {
hwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(hwInfo);
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto commandStreamReceiver = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(*executionEnvironment, 0, 1);
auto commandHeader = commandStreamReceiver->commandBufferHeader;
auto header = reinterpret_cast<COMMAND_BUFFER_HEADER *>(commandHeader);

View File

@ -55,6 +55,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenShareableAllocationWhenAllocateInDevice
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
hwInfo.featureTable.flags.ftrLocalMemory = true;
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo);
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
memoryManager = std::make_unique<MockWddmMemoryManager>(false, localMemoryEnabled, *executionEnvironment);
MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Error;
@ -87,6 +88,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenShareableAllocationWhenAllocateGraphics
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
hwInfo.featureTable.flags.ftrLocalMemory = true;
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo);
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
memoryManager = std::make_unique<MockWddmMemoryManager>(false, localMemoryEnabled, *executionEnvironment);
AllocationProperties properties{mockRootDeviceIndex, MemoryConstants::pageSize, AllocationType::SVM_GPU, mockDeviceBitfield};

View File

@ -486,6 +486,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValuesOnMultipleEnginesRegi
executionEnvironment->prepareRootDeviceEnvironments(2u);
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[i]->initGmm();
}
const uint32_t rootDeviceIndex = 1;
DeviceBitfield deviceBitfield(2);
@ -522,6 +523,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSomeOfMultipleEngine
executionEnvironment->prepareRootDeviceEnvironments(2u);
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[i]->initGmm();
}
DeviceBitfield deviceBitfield(2);
std::unique_ptr<CommandStreamReceiver> csr(createCommandStream(*executionEnvironment, rootDeviceIndex, deviceBitfield));
@ -1891,6 +1893,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWhenC
executionEnvironment->prepareRootDeviceEnvironments(3u);
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[i]->initGmm();
}
executionEnvironment->initializeMemoryManager();
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
@ -1915,6 +1918,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWithE
executionEnvironment->prepareRootDeviceEnvironments(3u);
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[i]->initGmm();
}
executionEnvironment->initializeMemoryManager();
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {