fix: offset cpu address when writing chunk in simulated csr

- not only gpuAddress is offset but also cpu address with data needs
to be offset while writing memory.

Related-To: GSD-6604

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2023-10-23 12:34:38 +00:00
committed by Compute-Runtime-Automation
parent 8da4a9cbc7
commit 52b0f32688
3 changed files with 9 additions and 1 deletions

View File

@@ -101,6 +101,7 @@ class CommandStreamReceiverSimulatedHw : public CommandStreamReceiverSimulatedCo
if (isChunkCopy) {
gpuAddress += gpuVaChunkOffset;
cpuAddress = ptrOffset(cpuAddress, static_cast<uintptr_t>(gpuVaChunkOffset));
allocSize = chunkSize;
}

View File

@@ -448,6 +448,7 @@ bool TbxCommandStreamReceiverHw<GfxFamily>::writeMemory(GraphicsAllocation &gfxA
} else {
if (isChunkCopy) {
gpuAddress += gpuVaChunkOffset;
cpuAddress = ptrOffset(cpuAddress, static_cast<uintptr_t>(gpuVaChunkOffset));
size = chunkSize;
}
writeMemory(gpuAddress, cpuAddress, size, this->getMemoryBank(&gfxAllocation), this->getPPGTTAdditionalBits(&gfxAllocation));

View File

@@ -91,7 +91,7 @@ HWTEST_F(AubCsrTest, givenAUBDumpForceAllToLocalMemoryWhenGettingAddressSpaceFor
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
}
HWTEST_F(AubCsrTest, WhenWriteWithAubManagerIsCalledThenAubManagerIsInvokedWithCorrectHint) {
HWTEST_F(AubCsrTest, WhenWriteWithAubManagerIsCalledThenAubManagerIsInvokedWithCorrectHintAndParams) {
auto hwInfo = *NEO::defaultHwInfo.get();
std::unique_ptr<ExecutionEnvironment> executionEnvironment(new ExecutionEnvironment);
@@ -122,9 +122,15 @@ HWTEST_F(AubCsrTest, WhenWriteWithAubManagerIsCalledThenAubManagerIsInvokedWithC
auto allocation2 = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, true, MemoryConstants::pageSize, AllocationType::LINEAR_STREAM});
aubManager.storeAllocationParams = true;
aubCsr->writeMemoryWithAubManager(*allocation2, true, 1, 1);
EXPECT_TRUE(aubManager.writeMemory2Called);
EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, aubManager.hintToWriteMemory);
ASSERT_EQ(1u, aubManager.storedAllocationParams.size());
EXPECT_EQ(ptrOffset(allocation2->getUnderlyingBuffer(), 1), aubManager.storedAllocationParams[0].memory);
EXPECT_EQ(ptrOffset(allocation2->getGpuAddress(), 1), aubManager.storedAllocationParams[0].gfxAddress);
EXPECT_EQ(1u, aubManager.storedAllocationParams[0].size);
executionEnvironment->memoryManager->freeGraphicsMemory(allocation);
executionEnvironment->memoryManager->freeGraphicsMemory(allocation2);