Skip to content

Commit 74432a3

Browse files
fix: use correct memoryBanks when makeResident is called in aub mode
Related-To: NEO-12869 Signed-off-by: Mateusz Hoppe <[email protected]>
1 parent cb3463d commit 74432a3

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

shared/source/os_interface/aub_memory_operations_handler.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ MemoryOperationsStatus AubMemoryOperationsHandler::makeResident(Device *device,
4242
continue;
4343
}
4444

45+
auto memoryBanks = static_cast<uint32_t>(getMemoryBanksBitfield(allocation, device).to_ulong());
4546
uint64_t gpuAddress = device ? device->getGmmHelper()->decanonize(allocation->getGpuAddress()) : allocation->getGpuAddress();
4647
aub_stream::AllocationParams params(gpuAddress,
4748
allocation->getUnderlyingBuffer(),
4849
allocation->getUnderlyingBufferSize(),
49-
allocation->storageInfo.getMemoryBanks(),
50+
memoryBanks,
5051
hint,
5152
allocation->getUsedPageSize());
5253

shared/test/unit_test/os_interface/aub_memory_operations_handler_tests.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,27 @@ TEST_F(AubMemoryOperationsHandlerTests, givenLocalMemoryAndNonLocalMemoryAllocat
305305
device->getDefaultEngine().commandStreamReceiver = oldCsr;
306306
}
307307

308+
TEST_F(AubMemoryOperationsHandlerTests, givenNonLocalMemoryAllocationWithStorageInfoNonZeroWhenMakeResidentCalledThenSystemMemoryBankIsPassedToWriteMemory) {
309+
auto executionEnvironment = device->getExecutionEnvironment();
310+
executionEnvironment->prepareRootDeviceEnvironments(1);
311+
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(&hardwareInfo);
312+
executionEnvironment->initializeMemoryManager();
313+
314+
MemoryAllocation allocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
315+
MemoryConstants::pageSize, 0, MemoryPool::system64KBPages, false, false, MemoryManager::maxOsContextCount);
316+
allocation.storageInfo.memoryBanks = 0x3u;
317+
MockAubManager aubManager;
318+
aubManager.storeAllocationParams = true;
319+
getMemoryOperationsHandler()->setAubManager(&aubManager);
320+
auto memoryOperationsInterface = getMemoryOperationsHandler();
321+
322+
allocPtr = &allocation;
323+
memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
324+
325+
EXPECT_TRUE(aubManager.writeMemory2Called);
326+
EXPECT_EQ(0u, aubManager.storedAllocationParams[0].memoryBanks);
327+
}
328+
308329
TEST_F(AubMemoryOperationsHandlerTests, givenLocalMemoryNoncloneableAllocationWithManyBanksWhenGetMemoryBanksBitfieldThenSingleMemoryBankIsReturned) {
309330
auto executionEnvironment = device->getExecutionEnvironment();
310331
executionEnvironment->prepareRootDeviceEnvironments(1);

0 commit comments

Comments
 (0)