mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Disable TimestampPacket optimizations in Aub/Tbx mode
Avoid removing semaphores and reusing returned tags Change-Id: Ic26167953c5d5a9ccceaae49f4921af11a375fab Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
54f65c0243
commit
0527c9113c
@ -416,21 +416,28 @@ bool CommandStreamReceiver::createAllocationForHostSurface(HostPtrSurface &surfa
|
||||
|
||||
TagAllocator<HwTimeStamps> *CommandStreamReceiver::getEventTsAllocator() {
|
||||
if (profilingTimeStampAllocator.get() == nullptr) {
|
||||
profilingTimeStampAllocator = std::make_unique<TagAllocator<HwTimeStamps>>(rootDeviceIndex, getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize);
|
||||
profilingTimeStampAllocator = std::make_unique<TagAllocator<HwTimeStamps>>(
|
||||
rootDeviceIndex, getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize, sizeof(HwTimeStamps), false);
|
||||
}
|
||||
return profilingTimeStampAllocator.get();
|
||||
}
|
||||
|
||||
TagAllocator<HwPerfCounter> *CommandStreamReceiver::getEventPerfCountAllocator(const uint32_t tagSize) {
|
||||
if (perfCounterAllocator.get() == nullptr) {
|
||||
perfCounterAllocator = std::make_unique<TagAllocator<HwPerfCounter>>(rootDeviceIndex, getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize, tagSize);
|
||||
perfCounterAllocator = std::make_unique<TagAllocator<HwPerfCounter>>(
|
||||
rootDeviceIndex, getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize, tagSize, false);
|
||||
}
|
||||
return perfCounterAllocator.get();
|
||||
}
|
||||
|
||||
TagAllocator<TimestampPacketStorage> *CommandStreamReceiver::getTimestampPacketAllocator() {
|
||||
if (timestampPacketAllocator.get() == nullptr) {
|
||||
timestampPacketAllocator = std::make_unique<TagAllocator<TimestampPacketStorage>>(rootDeviceIndex, getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize);
|
||||
// dont release nodes in aub/tbx mode, to avoid removing semaphores optimization or reusing returned tags
|
||||
bool doNotReleaseNodes = (getType() > CommandStreamReceiverType::CSR_HW);
|
||||
|
||||
timestampPacketAllocator = std::make_unique<TagAllocator<TimestampPacketStorage>>(
|
||||
rootDeviceIndex, getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize,
|
||||
sizeof(TimestampPacketStorage), doNotReleaseNodes);
|
||||
}
|
||||
return timestampPacketAllocator.get();
|
||||
}
|
||||
|
@ -29,6 +29,13 @@ class CommandStreamReceiverWithAUBDump : public BaseCSR {
|
||||
AubSubCaptureStatus checkAndActivateAubSubCapture(const MultiDispatchInfo &dispatchInfo) override;
|
||||
void setupContext(OsContext &osContext) override;
|
||||
|
||||
CommandStreamReceiverType getType() override {
|
||||
if (BaseCSR::getType() == CommandStreamReceiverType::CSR_TBX) {
|
||||
return CommandStreamReceiverType::CSR_TBX_WITH_AUB;
|
||||
}
|
||||
return CommandStreamReceiverType::CSR_HW_WITH_AUB;
|
||||
}
|
||||
|
||||
std::unique_ptr<CommandStreamReceiver> aubCSR;
|
||||
};
|
||||
|
||||
|
@ -21,7 +21,7 @@ struct HwTimeStamps {
|
||||
GlobalCompleteTS = 0;
|
||||
ContextCompleteTS = 0;
|
||||
}
|
||||
bool canBeReleased() const { return true; }
|
||||
bool isCompleted() const { return true; }
|
||||
static GraphicsAllocation::AllocationType getAllocationType() {
|
||||
return GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ struct HwPerfCounter {
|
||||
static GraphicsAllocation::AllocationType getAllocationType() {
|
||||
return GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER;
|
||||
}
|
||||
bool canBeReleased() const { return true; }
|
||||
bool isCompleted() const { return true; }
|
||||
|
||||
// Gpu report size is not known during compile time.
|
||||
// Such information will be provided by metrics library dll.
|
||||
|
@ -33,7 +33,7 @@ void TimestampPacketContainer::resolveDependencies(bool clearAllDependencies) {
|
||||
std::vector<Node *> pendingNodes;
|
||||
|
||||
for (auto node : timestampPacketNodes) {
|
||||
if (node->tagForCpuAccess->canBeReleased() || clearAllDependencies) {
|
||||
if (node->canBeReleased() || clearAllDependencies) {
|
||||
node->returnTag();
|
||||
} else {
|
||||
pendingNodes.push_back(node);
|
||||
|
@ -42,17 +42,13 @@ struct TimestampPacketStorage {
|
||||
return GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER;
|
||||
}
|
||||
|
||||
bool canBeReleased() const {
|
||||
return isCompleted() && implicitDependenciesCount.load() == 0;
|
||||
}
|
||||
|
||||
bool isCompleted() const {
|
||||
for (uint32_t i = 0; i < packetsUsed; i++) {
|
||||
if ((packets[i].contextEnd & 1) || (packets[i].globalEnd & 1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return implicitDependenciesCount.load() == 0;
|
||||
}
|
||||
|
||||
void initialize() {
|
||||
|
@ -36,11 +36,20 @@ struct TagNode : public IDNode<TagNode<TagType>> {
|
||||
allocator->returnTag(this);
|
||||
}
|
||||
|
||||
bool canBeReleased() const {
|
||||
return !doNotReleaseNodes && tagForCpuAccess->isCompleted();
|
||||
}
|
||||
|
||||
void setDoNotReleaseNodes(bool doNotRelease) {
|
||||
doNotReleaseNodes = doNotRelease;
|
||||
}
|
||||
|
||||
protected:
|
||||
TagAllocator<TagType> *allocator = nullptr;
|
||||
GraphicsAllocation *gfxAllocation = nullptr;
|
||||
uint64_t gpuAddress = 0;
|
||||
std::atomic<uint32_t> refCount{0};
|
||||
bool doNotReleaseNodes = false;
|
||||
|
||||
template <typename TagType2>
|
||||
friend class TagAllocator;
|
||||
@ -52,10 +61,11 @@ class TagAllocator {
|
||||
using NodeType = TagNode<TagType>;
|
||||
|
||||
TagAllocator(uint32_t rootDeviceIndex, MemoryManager *memMngr, size_t tagCount,
|
||||
size_t tagAlignment, size_t tagSize = sizeof(TagType)) : rootDeviceIndex(rootDeviceIndex),
|
||||
memoryManager(memMngr),
|
||||
tagCount(tagCount),
|
||||
tagAlignment(tagAlignment) {
|
||||
size_t tagAlignment, size_t tagSize, bool doNotReleaseNodes) : rootDeviceIndex(rootDeviceIndex),
|
||||
memoryManager(memMngr),
|
||||
tagCount(tagCount),
|
||||
tagAlignment(tagAlignment),
|
||||
doNotReleaseNodes(doNotReleaseNodes) {
|
||||
|
||||
this->tagSize = alignUp(tagSize, tagAlignment);
|
||||
populateFreeTags();
|
||||
@ -95,7 +105,7 @@ class TagAllocator {
|
||||
|
||||
MOCKABLE_VIRTUAL void returnTag(NodeType *node) {
|
||||
if (node->refCount.fetch_sub(1) == 1) {
|
||||
if (node->tagForCpuAccess->canBeReleased()) {
|
||||
if (node->canBeReleased()) {
|
||||
returnTagToFreePool(node);
|
||||
} else {
|
||||
returnTagToDeferredPool(node);
|
||||
@ -115,6 +125,7 @@ class TagAllocator {
|
||||
size_t tagCount;
|
||||
size_t tagAlignment;
|
||||
size_t tagSize;
|
||||
bool doNotReleaseNodes = false;
|
||||
|
||||
std::mutex allocatorMutex;
|
||||
|
||||
@ -150,6 +161,7 @@ class TagAllocator {
|
||||
nodesMemory[i].gfxAllocation = graphicsAllocation;
|
||||
nodesMemory[i].tagForCpuAccess = reinterpret_cast<TagType *>(Start);
|
||||
nodesMemory[i].gpuAddress = gpuBaseAddress + (i * tagSize);
|
||||
nodesMemory[i].setDoNotReleaseNodes(doNotReleaseNodes);
|
||||
freeTags.pushTailOne(nodesMemory[i]);
|
||||
Start += tagSize;
|
||||
}
|
||||
@ -165,7 +177,7 @@ class TagAllocator {
|
||||
|
||||
while (currentNode != nullptr) {
|
||||
auto nextNode = currentNode->next;
|
||||
if (currentNode->tagForCpuAccess->canBeReleased()) {
|
||||
if (currentNode->canBeReleased()) {
|
||||
pendingFreeTags.pushFrontOne(*currentNode);
|
||||
} else {
|
||||
pendingDeferredTags.pushFrontOne(*currentNode);
|
||||
|
@ -1367,7 +1367,8 @@ HWTEST_P(ProfilingCommandsTest, givenKernelWhenProfilingCommandStartIsTakenThenT
|
||||
bool checkForStart = GetParam();
|
||||
|
||||
auto &cmdStream = pCmdQ->getCS(0);
|
||||
TagAllocator<HwTimeStamps> timeStampAllocator(pDevice->getRootDeviceIndex(), this->pDevice->getMemoryManager(), 10, MemoryConstants::cacheLineSize);
|
||||
TagAllocator<HwTimeStamps> timeStampAllocator(pDevice->getRootDeviceIndex(), this->pDevice->getMemoryManager(), 10,
|
||||
MemoryConstants::cacheLineSize, sizeof(HwTimeStamps), false);
|
||||
|
||||
auto hwTimeStamp1 = timeStampAllocator.getTag();
|
||||
ASSERT_NE(nullptr, hwTimeStamp1);
|
||||
|
@ -7,14 +7,17 @@
|
||||
|
||||
#include "core/command_stream/preemption.h"
|
||||
#include "core/helpers/hw_helper.h"
|
||||
#include "runtime/command_stream/aub_command_stream_receiver_hw.h"
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.inl"
|
||||
#include "runtime/command_stream/tbx_command_stream_receiver_hw.h"
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
#include "runtime/helpers/dispatch_info.h"
|
||||
#include "runtime/helpers/flush_stamp.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/os_interface/os_context.h"
|
||||
#include "runtime/platform/platform.h"
|
||||
#include "runtime/utilities/tag_allocator.h"
|
||||
#include "test.h"
|
||||
#include "unit_tests/fixtures/mock_aub_center_fixture.h"
|
||||
#include "unit_tests/libult/ult_command_stream_receiver.h"
|
||||
@ -127,6 +130,7 @@ struct CommandStreamReceiverWithAubDumpTest : public ::testing::TestWithParam<bo
|
||||
MockAubCenterFixture::TearDown();
|
||||
delete csrWithAubDump;
|
||||
}
|
||||
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
MyMockCsrWithAubDump<MyMockCsr> *csrWithAubDump;
|
||||
MemoryManager *memoryManager;
|
||||
@ -159,6 +163,7 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenAubManagerAvailableWhe
|
||||
|
||||
CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>> csrWithAubDump("aubfile", *executionEnvironment, 0);
|
||||
ASSERT_EQ(nullptr, csrWithAubDump.aubCSR);
|
||||
EXPECT_EQ(CommandStreamReceiverType::CSR_TBX_WITH_AUB, csrWithAubDump.getType());
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenAubManagerAvailableWhenHwCsrWithAubDumpIsCreatedThenAubCsrIsCreated) {
|
||||
@ -173,6 +178,46 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenAubManagerAvailableWhe
|
||||
|
||||
CommandStreamReceiverWithAUBDump<UltCommandStreamReceiver<FamilyType>> csrWithAubDump("aubfile", *executionEnvironment, 0);
|
||||
ASSERT_NE(nullptr, csrWithAubDump.aubCSR);
|
||||
EXPECT_EQ(CommandStreamReceiverType::CSR_HW_WITH_AUB, csrWithAubDump.getType());
|
||||
}
|
||||
|
||||
struct CommandStreamReceiverTagTests : public ::testing::Test {
|
||||
template <typename CsrT, typename... Args>
|
||||
bool isTimestampPacketNodeReleasable(Args &&... args) {
|
||||
CsrT csr(std::forward<Args>(args)...);
|
||||
auto allocator = csr.getTimestampPacketAllocator();
|
||||
auto tag = allocator->getTag();
|
||||
memset(tag->tagForCpuAccess->packets, 0, sizeof(TimestampPacketStorage::Packet) * TimestampPacketSizeControl::preferredPacketCount);
|
||||
EXPECT_TRUE(tag->tagForCpuAccess->isCompleted());
|
||||
|
||||
bool canBeReleased = tag->canBeReleased();
|
||||
allocator->returnTag(tag);
|
||||
|
||||
return canBeReleased;
|
||||
};
|
||||
|
||||
void SetUp() {
|
||||
MockAubManager *mockManager = new MockAubManager();
|
||||
MockAubCenter *mockAubCenter = new MockAubCenter(*platformDevices, false, fileName, CommandStreamReceiverType::CSR_HW_WITH_AUB);
|
||||
mockAubCenter->aubManager = std::unique_ptr<MockAubManager>(mockManager);
|
||||
|
||||
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
}
|
||||
|
||||
const std::string fileName = "file_name.aub";
|
||||
ExecutionEnvironment *executionEnvironment = nullptr;
|
||||
};
|
||||
|
||||
HWTEST_F(CommandStreamReceiverTagTests, givenCsrTypeWhenCreatingTimestampPacketAllocatorThenSetDefaultCompletionCheckType) {
|
||||
using AubWithHw = CommandStreamReceiverWithAUBDump<UltCommandStreamReceiver<FamilyType>>;
|
||||
using AubWithTbx = CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>>;
|
||||
|
||||
EXPECT_TRUE(isTimestampPacketNodeReleasable<CommandStreamReceiverHw<FamilyType>>(*executionEnvironment, 0));
|
||||
EXPECT_FALSE(isTimestampPacketNodeReleasable<AUBCommandStreamReceiverHw<FamilyType>>(fileName, false, *executionEnvironment, 0));
|
||||
EXPECT_FALSE(isTimestampPacketNodeReleasable<AubWithHw>(fileName, *executionEnvironment, 0));
|
||||
EXPECT_FALSE(isTimestampPacketNodeReleasable<AubWithTbx>(fileName, *executionEnvironment, 0));
|
||||
}
|
||||
|
||||
using SimulatedCsrTest = ::testing::Test;
|
||||
|
@ -1118,7 +1118,7 @@ TEST_F(EventTest, getHwTimeStampsReturnsValidPointer) {
|
||||
ASSERT_EQ(0ULL, timeStamps->GlobalCompleteTS);
|
||||
ASSERT_EQ(0ULL, timeStamps->ContextCompleteTS);
|
||||
|
||||
EXPECT_TRUE(timeStamps->canBeReleased());
|
||||
EXPECT_TRUE(timeStamps->isCompleted());
|
||||
|
||||
HwTimeStamps *timeStamps2 = event->getHwTimeStampNode()->tagForCpuAccess;
|
||||
ASSERT_EQ(timeStamps, timeStamps2);
|
||||
|
@ -147,25 +147,25 @@ HWTEST_F(TimestampPacketTests, givenTagNodeWithPacketsUsed2WhenSemaphoreAndAtomi
|
||||
verifyMiAtomic<FamilyType>(genCmdCast<MI_ATOMIC *>(*it++), &mockNode);
|
||||
}
|
||||
|
||||
TEST_F(TimestampPacketSimpleTests, whenEndTagIsNotOneThenCanBeReleased) {
|
||||
TEST_F(TimestampPacketSimpleTests, whenEndTagIsNotOneThenMarkAsCompleted) {
|
||||
TimestampPacketStorage timestampPacketStorage;
|
||||
auto &packet = timestampPacketStorage.packets[0];
|
||||
|
||||
packet.contextEnd = 1;
|
||||
packet.globalEnd = 1;
|
||||
EXPECT_FALSE(timestampPacketStorage.canBeReleased());
|
||||
EXPECT_FALSE(timestampPacketStorage.isCompleted());
|
||||
|
||||
packet.contextEnd = 1;
|
||||
packet.globalEnd = 0;
|
||||
EXPECT_FALSE(timestampPacketStorage.canBeReleased());
|
||||
EXPECT_FALSE(timestampPacketStorage.isCompleted());
|
||||
|
||||
packet.contextEnd = 0;
|
||||
packet.globalEnd = 1;
|
||||
EXPECT_FALSE(timestampPacketStorage.canBeReleased());
|
||||
EXPECT_FALSE(timestampPacketStorage.isCompleted());
|
||||
|
||||
packet.contextEnd = 0;
|
||||
packet.globalEnd = 0;
|
||||
EXPECT_TRUE(timestampPacketStorage.canBeReleased());
|
||||
EXPECT_TRUE(timestampPacketStorage.isCompleted());
|
||||
}
|
||||
|
||||
TEST_F(TimestampPacketSimpleTests, givenTimestampPacketContainerWhenMovedTheMoveAllNodes) {
|
||||
@ -239,9 +239,9 @@ TEST_F(TimestampPacketSimpleTests, givenImplicitDependencyWhenEndTagIsWrittenThe
|
||||
timestampPacketStorage.packets[0].contextEnd = 0;
|
||||
timestampPacketStorage.packets[0].globalEnd = 0;
|
||||
timestampPacketStorage.implicitDependenciesCount.store(1);
|
||||
EXPECT_FALSE(timestampPacketStorage.canBeReleased());
|
||||
EXPECT_FALSE(timestampPacketStorage.isCompleted());
|
||||
timestampPacketStorage.implicitDependenciesCount.store(0);
|
||||
EXPECT_TRUE(timestampPacketStorage.canBeReleased());
|
||||
EXPECT_TRUE(timestampPacketStorage.isCompleted());
|
||||
}
|
||||
|
||||
TEST_F(TimestampPacketSimpleTests, whenNewTagIsTakenThenReinitialize) {
|
||||
@ -1319,7 +1319,8 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingWithOmitTim
|
||||
}
|
||||
|
||||
HWTEST_F(TimestampPacketTests, givenEventsWaitlistFromDifferentDevicesWhenEnqueueingThenMakeAllTimestampsResident) {
|
||||
TagAllocator<TimestampPacketStorage> tagAllocator(device->getRootDeviceIndex(), executionEnvironment->memoryManager.get(), 1, 1);
|
||||
TagAllocator<TimestampPacketStorage> tagAllocator(device->getRootDeviceIndex(), executionEnvironment->memoryManager.get(), 1, 1,
|
||||
sizeof(TimestampPacketStorage), false);
|
||||
auto device2 = std::unique_ptr<MockDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
|
||||
|
||||
auto &ultCsr = device->getUltCommandStreamReceiver<FamilyType>();
|
||||
@ -1354,7 +1355,8 @@ HWTEST_F(TimestampPacketTests, givenEventsWaitlistFromDifferentDevicesWhenEnqueu
|
||||
}
|
||||
|
||||
HWTEST_F(TimestampPacketTests, givenEventsWaitlistFromDifferentCSRsWhenEnqueueingThenMakeAllTimestampsResident) {
|
||||
TagAllocator<TimestampPacketStorage> tagAllocator(device->getRootDeviceIndex(), executionEnvironment->memoryManager.get(), 1, 1);
|
||||
TagAllocator<TimestampPacketStorage> tagAllocator(device->getRootDeviceIndex(), executionEnvironment->memoryManager.get(), 1, 1,
|
||||
sizeof(TimestampPacketStorage), false);
|
||||
|
||||
auto &ultCsr = device->getUltCommandStreamReceiver<FamilyType>();
|
||||
ultCsr.timestampPacketWriteEnabled = true;
|
||||
|
@ -1193,7 +1193,9 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenInputAndOutputTimestampPacketWhenBlitCal
|
||||
auto &cmdQueueCsr = static_cast<UltCommandStreamReceiver<FamilyType> &>(cmdQ->getGpgpuCommandStreamReceiver());
|
||||
auto memoryManager = cmdQueueCsr.getMemoryManager();
|
||||
cmdQueueCsr.timestampPacketAllocator = std::make_unique<TagAllocator<TimestampPacketStorage>>(device->getRootDeviceIndex(), memoryManager, 1,
|
||||
MemoryConstants::cacheLineSize);
|
||||
MemoryConstants::cacheLineSize,
|
||||
sizeof(TimestampPacketStorage),
|
||||
false);
|
||||
|
||||
auto buffer = clUniquePtr<Buffer>(Buffer::create(bcsMockContext.get(), CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
buffer->forceDisallowCPUCopy = true;
|
||||
|
@ -18,7 +18,8 @@ class MockTagAllocator : public TagAllocator<TagType> {
|
||||
using BaseClass::usedTags;
|
||||
using NodeType = typename BaseClass::NodeType;
|
||||
|
||||
MockTagAllocator(uint32_t rootDeviceIndex, MemoryManager *memoryManager, size_t tagCount = 10) : BaseClass(rootDeviceIndex, memoryManager, tagCount, 10) {}
|
||||
MockTagAllocator(uint32_t rootDeviceIndex, MemoryManager *memoryManager, size_t tagCount = 10)
|
||||
: BaseClass(rootDeviceIndex, memoryManager, tagCount, MemoryConstants::cacheLineSize, sizeof(TagType), false) {}
|
||||
|
||||
void returnTag(NodeType *node) override {
|
||||
releaseReferenceNodes.push_back(node);
|
||||
@ -48,4 +49,4 @@ class MockTimestampPacketContainer : public TimestampPacketContainer {
|
||||
return timestampPacketNodes.at(position);
|
||||
}
|
||||
};
|
||||
} // namespace NEO
|
||||
} // namespace NEO
|
||||
|
@ -492,7 +492,7 @@ TEST_F(PerformanceCountersMetricsLibraryTest, getHwPerfCounterReturnsValidPointe
|
||||
ASSERT_NE(nullptr, perfCounter);
|
||||
|
||||
ASSERT_EQ(0ULL, perfCounter->report[0]);
|
||||
EXPECT_TRUE(perfCounter->canBeReleased());
|
||||
EXPECT_TRUE(perfCounter->isCompleted());
|
||||
|
||||
HwPerfCounter *perfCounter2 = event->getHwPerfCounterNode()->tagForCpuAccess;
|
||||
ASSERT_EQ(perfCounter, perfCounter2);
|
||||
|
@ -834,7 +834,8 @@ struct FixedGpuAddressTagAllocator : TagAllocator<TagType> {
|
||||
};
|
||||
|
||||
FixedGpuAddressTagAllocator(CommandStreamReceiver &csr, uint64_t gpuAddress)
|
||||
: TagAllocator<TagType>(0, csr.getMemoryManager(), csr.getPreferredTagPoolSize(), MemoryConstants::cacheLineSize) {
|
||||
: TagAllocator<TagType>(0, csr.getMemoryManager(), csr.getPreferredTagPoolSize(), MemoryConstants::cacheLineSize,
|
||||
sizeof(TagType), false) {
|
||||
auto tag = reinterpret_cast<MockTagNode *>(this->freeTags.peekHead());
|
||||
tag->setGpuAddress(gpuAddress);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ struct TimeStamps {
|
||||
static GraphicsAllocation::AllocationType getAllocationType() {
|
||||
return GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER;
|
||||
}
|
||||
bool canBeReleased() const { return release; }
|
||||
bool isCompleted() const { return release; }
|
||||
bool release;
|
||||
uint64_t start;
|
||||
uint64_t end;
|
||||
@ -40,12 +40,18 @@ class MockTagAllocator : public TagAllocator<TagType> {
|
||||
|
||||
public:
|
||||
using BaseClass::deferredTags;
|
||||
using BaseClass::doNotReleaseNodes;
|
||||
using BaseClass::freeTags;
|
||||
using BaseClass::populateFreeTags;
|
||||
using BaseClass::releaseDeferredTags;
|
||||
using BaseClass::usedTags;
|
||||
|
||||
MockTagAllocator(MemoryManager *memMngr, size_t tagCount, size_t tagAlignment) : BaseClass(0, memMngr, tagCount, tagAlignment) {
|
||||
MockTagAllocator(MemoryManager *memMngr, size_t tagCount, size_t tagAlignment, bool disableCompletionCheck)
|
||||
: BaseClass(0, memMngr, tagCount, tagAlignment, sizeof(TagType), disableCompletionCheck) {
|
||||
}
|
||||
|
||||
MockTagAllocator(MemoryManager *memMngr, size_t tagCount, size_t tagAlignment)
|
||||
: MockTagAllocator(memMngr, tagCount, tagAlignment, false) {
|
||||
}
|
||||
|
||||
GraphicsAllocation *getGraphicsAllocation(size_t id = 0) {
|
||||
@ -315,6 +321,37 @@ TEST_F(TagAllocatorTest, givenNotReadyTagWhenReturnedThenMoveToDeferredList) {
|
||||
EXPECT_TRUE(tagAllocator.freeTags.peekIsEmpty());
|
||||
}
|
||||
|
||||
TEST_F(TagAllocatorTest, givenTagNodeWhenCompletionCheckIsDisabledThenStatusIsMarkedAsNotReady) {
|
||||
MockTagAllocator<TimeStamps> tagAllocator(memoryManager, 1, 1);
|
||||
EXPECT_FALSE(tagAllocator.doNotReleaseNodes);
|
||||
auto node = tagAllocator.getTag();
|
||||
|
||||
EXPECT_TRUE(node->canBeReleased());
|
||||
|
||||
node->setDoNotReleaseNodes(true);
|
||||
EXPECT_FALSE(node->canBeReleased());
|
||||
|
||||
tagAllocator.returnTag(node);
|
||||
EXPECT_FALSE(tagAllocator.deferredTags.peekIsEmpty());
|
||||
EXPECT_TRUE(tagAllocator.freeTags.peekIsEmpty());
|
||||
}
|
||||
|
||||
TEST_F(TagAllocatorTest, givenTagAllocatorWhenDisabledCompletionCheckThenNodeInheritsItsState) {
|
||||
MockTagAllocator<TimeStamps> tagAllocator(memoryManager, 1, 1, true);
|
||||
EXPECT_TRUE(tagAllocator.doNotReleaseNodes);
|
||||
|
||||
auto node = tagAllocator.getTag();
|
||||
|
||||
EXPECT_FALSE(node->canBeReleased());
|
||||
|
||||
node->setDoNotReleaseNodes(false);
|
||||
EXPECT_TRUE(node->canBeReleased());
|
||||
|
||||
tagAllocator.returnTag(node);
|
||||
EXPECT_TRUE(tagAllocator.deferredTags.peekIsEmpty());
|
||||
EXPECT_FALSE(tagAllocator.freeTags.peekIsEmpty());
|
||||
}
|
||||
|
||||
TEST_F(TagAllocatorTest, givenReadyTagWhenReturnedThenMoveToFreeList) {
|
||||
MockTagAllocator<TimeStamps> tagAllocator(memoryManager, 1, 1);
|
||||
auto node = tagAllocator.getTag();
|
||||
@ -365,9 +402,9 @@ TEST_F(TagAllocatorTest, givenTagsOnDeferredListWhenReleasingItThenMoveReadyTags
|
||||
}
|
||||
|
||||
TEST_F(TagAllocatorTest, givenTagAllocatorWhenGraphicsAllocationIsCreatedThenSetValidllocationType) {
|
||||
TagAllocator<TimestampPacketStorage> timestampPacketAllocator(0, memoryManager, 1, 1);
|
||||
TagAllocator<HwTimeStamps> hwTimeStampsAllocator(0, memoryManager, 1, 1);
|
||||
TagAllocator<HwPerfCounter> hwPerfCounterAllocator(0, memoryManager, 1, 1);
|
||||
TagAllocator<TimestampPacketStorage> timestampPacketAllocator(0, memoryManager, 1, 1, sizeof(TimestampPacketStorage), false);
|
||||
TagAllocator<HwTimeStamps> hwTimeStampsAllocator(0, memoryManager, 1, 1, sizeof(HwTimeStamps), false);
|
||||
TagAllocator<HwPerfCounter> hwPerfCounterAllocator(0, memoryManager, 1, 1, sizeof(HwPerfCounter), false);
|
||||
|
||||
auto timestampPacketTag = timestampPacketAllocator.getTag();
|
||||
auto hwTimeStampsTag = hwTimeStampsAllocator.getTag();
|
||||
|
Reference in New Issue
Block a user