mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-11 16:45:25 +08:00
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:
committed by
Compute-Runtime-Automation
parent
84a7438ff2
commit
a65d50b0dc
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user