Add timestamp buffer allocation type to aub one time writeable

Related-To: NEO-7765

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2023-03-02 21:59:09 +00:00
committed by Compute-Runtime-Automation
parent 84a7438ff2
commit a65d50b0dc
4 changed files with 62 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -33,6 +33,7 @@ class AubHelper : public NonCopyableOrMovableClass {
case AllocationType::EXTERNAL_HOST_PTR:
case AllocationType::MAP_ALLOCATION:
case AllocationType::SVM_GPU:
case AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER:
return true;
default:
return false;

View File

@@ -1030,3 +1030,33 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWithHardwar
EXPECT_TRUE(mockHardwareContext->writeMMIOCalled);
}
HWTEST_F(AubCommandStreamReceiverTests, givenTimestampBufferAllocationWhenAubWriteMemoryIsCalledForAllocationThenItIsOneTimeWriteable) {
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", false, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
aubCsr->setupContext(*pDevice->getDefaultEngine().osContext);
aubCsr->initializeEngine();
MemoryManager *memoryManager = aubCsr->getMemoryManager();
ASSERT_NE(nullptr, memoryManager);
size_t alignedSize = MemoryConstants::pageSize64k;
AllocationType allocationType = NEO::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER;
AllocationProperties allocationProperties{pDevice->getRootDeviceIndex(),
true,
alignedSize,
allocationType,
false,
false,
pDevice->getDeviceBitfield()};
auto timestampAllocation = memoryManager->allocateGraphicsMemoryWithProperties(allocationProperties);
ASSERT_NE(nullptr, timestampAllocation);
timestampAllocation->setAubWritable(true, GraphicsAllocation::defaultBank);
EXPECT_TRUE(aubCsr->writeMemory(*timestampAllocation));
EXPECT_FALSE(timestampAllocation->isAubWritable(GraphicsAllocation::defaultBank));
memoryManager->freeGraphicsMemory(timestampAllocation);
}

View File

@@ -1081,3 +1081,31 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWhenDumpAllocationIsCalle
memoryManager->freeGraphicsMemory(gfxAllocation);
}
HWTEST_F(TbxCommandStreamTests, givenTimestampBufferAllocationWhenTbxWriteMemoryIsCalledForAllocationThenItIsOneTimeWriteable) {
TbxCommandStreamReceiverHw<FamilyType> *tbxCsr = (TbxCommandStreamReceiverHw<FamilyType> *)pCommandStreamReceiver;
tbxCsr->initializeEngine();
MemoryManager *memoryManager = tbxCsr->getMemoryManager();
ASSERT_NE(nullptr, memoryManager);
size_t alignedSize = MemoryConstants::pageSize64k;
AllocationType allocationType = NEO::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER;
AllocationProperties allocationProperties{pDevice->getRootDeviceIndex(),
true,
alignedSize,
allocationType,
false,
false,
pDevice->getDeviceBitfield()};
auto timestampAllocation = memoryManager->allocateGraphicsMemoryWithProperties(allocationProperties);
ASSERT_NE(nullptr, timestampAllocation);
timestampAllocation->setTbxWritable(true, GraphicsAllocation::defaultBank);
EXPECT_TRUE(tbxCsr->writeMemory(*timestampAllocation));
EXPECT_FALSE(timestampAllocation->isTbxWritable(GraphicsAllocation::defaultBank));
memoryManager->freeGraphicsMemory(timestampAllocation);
}