Add timestamp allocations to residency container

Change-Id: I0b7c41b3dd59d576cdf360fe022b7a812394a4c9
Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
Maciej Dziuban 2020-09-15 11:59:55 +02:00 committed by sys_ocldev
parent 97ec64d22c
commit 69af210d1d
2 changed files with 17 additions and 0 deletions

View File

@ -1456,6 +1456,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWriteGlobalTimestamp(
CommandListCoreFamily<gfxCoreFamily>::appendSignalEvent(hSignalEvent);
}
auto allocationStruct = getAlignedAllocation(this->device, dstptr, sizeof(uint64_t));
commandContainer.addToResidencyContainer(allocationStruct.alloc);
return ZE_RESULT_SUCCESS;
}

View File

@ -192,6 +192,20 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenAppendWriteGlobalTimestampCalle
EXPECT_EQ(POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_TIMESTAMP, cmd->getPostSyncOperation());
}
HWTEST2_F(CommandListCreate, givenCommandListWhenAppendWriteGlobalTimestampCalledThenTimestampAllocationIsInsideResidencyContainer, Platforms) {
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, false));
uint64_t timestampAddress = 0x12345678555500;
uint64_t *dstptr = reinterpret_cast<uint64_t *>(timestampAddress);
commandList->appendWriteGlobalTimestamp(dstptr, nullptr, 0, nullptr);
auto &commandContainer = commandList->commandContainer;
auto &residencyContainer = commandContainer.getResidencyContainer();
const bool addressIsInContainer = std::any_of(residencyContainer.begin(), residencyContainer.end(), [timestampAddress](NEO::GraphicsAllocation *alloc) {
return alloc->getGpuAddress() == timestampAddress;
});
EXPECT_TRUE(addressIsInContainer);
}
HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenAppendWriteGlobalTimestampReturnsSuccess, Platforms) {
Mock<CommandQueue> cmdQueue;
uint64_t timestampAddress = 0x12345678555500;