fix: reduce types for tagSize and tagCount within TagAllocator

Related-To: NEO-16444

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2025-11-14 15:12:27 +00:00
committed by Compute-Runtime-Automation
parent 133421a5e9
commit 7660b29bbb
16 changed files with 29 additions and 30 deletions

View File

@@ -79,7 +79,7 @@ NEO::TagAllocatorBase *Device::getFillPatternAllocator() {
if (!this->fillPatternAllocator.get()) { if (!this->fillPatternAllocator.get()) {
RootDeviceIndicesContainer rootDeviceIndices = {getNEODevice()->getRootDeviceIndex()}; RootDeviceIndicesContainer rootDeviceIndices = {getNEODevice()->getRootDeviceIndex()};
fillPatternAllocator = std::make_unique<NEO::TagAllocator<NEO::FillPaternNodeType>>(rootDeviceIndices, getNEODevice()->getMemoryManager(), MemoryConstants::pageSize2M / MemoryConstants::cacheLineSize, fillPatternAllocator = std::make_unique<NEO::TagAllocator<NEO::FillPaternNodeType>>(rootDeviceIndices, getNEODevice()->getMemoryManager(), static_cast<uint32_t>(MemoryConstants::pageSize2M / MemoryConstants::cacheLineSize),
MemoryConstants::cacheLineSize, MemoryConstants::cacheLineSize, 0, false, false, getNEODevice()->getDeviceBitfield()); MemoryConstants::cacheLineSize, MemoryConstants::cacheLineSize, 0, false, false, getNEODevice()->getDeviceBitfield());
} }
} }
@@ -123,4 +123,4 @@ ze_result_t Device::getPriorityLevels(int32_t *lowestPriority, int32_t *highestP
return ZE_RESULT_SUCCESS; return ZE_RESULT_SUCCESS;
} }
} // namespace L0 } // namespace L0

View File

@@ -113,7 +113,7 @@ class L0GfxCoreHelper : public NEO::ApiGfxCoreHelper {
virtual uint64_t getIpSamplingIpMask() const = 0; virtual uint64_t getIpSamplingIpMask() const = 0;
virtual bool synchronizedDispatchSupported() const = 0; virtual bool synchronizedDispatchSupported() const = 0;
virtual bool implicitSynchronizedDispatchForCooperativeKernelsAllowed() const = 0; virtual bool implicitSynchronizedDispatchForCooperativeKernelsAllowed() const = 0;
virtual std::unique_ptr<NEO::TagAllocatorBase> getInOrderTimestampAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, NEO::MemoryManager *memoryManager, size_t initialTagCount, size_t packetsCountPerElement, size_t tagAlignment, virtual std::unique_ptr<NEO::TagAllocatorBase> getInOrderTimestampAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, NEO::MemoryManager *memoryManager, uint32_t initialTagCount, size_t packetsCountPerElement, size_t tagAlignment,
NEO::DeviceBitfield deviceBitfield) const = 0; NEO::DeviceBitfield deviceBitfield) const = 0;
virtual uint64_t getOaTimestampValidBits() const = 0; virtual uint64_t getOaTimestampValidBits() const = 0;
virtual CopyOffloadMode getDefaultCopyOffloadMode(bool additionalBlitPropertiesSupported) const = 0; virtual CopyOffloadMode getDefaultCopyOffloadMode(bool additionalBlitPropertiesSupported) const = 0;
@@ -174,7 +174,7 @@ class L0GfxCoreHelperHw : public L0GfxCoreHelper {
uint64_t getIpSamplingIpMask() const override; uint64_t getIpSamplingIpMask() const override;
bool synchronizedDispatchSupported() const override; bool synchronizedDispatchSupported() const override;
bool implicitSynchronizedDispatchForCooperativeKernelsAllowed() const override; bool implicitSynchronizedDispatchForCooperativeKernelsAllowed() const override;
std::unique_ptr<NEO::TagAllocatorBase> getInOrderTimestampAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, NEO::MemoryManager *memoryManager, size_t initialTagCount, size_t packetsCountPerElement, size_t tagAlignment, std::unique_ptr<NEO::TagAllocatorBase> getInOrderTimestampAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, NEO::MemoryManager *memoryManager, uint32_t initialTagCount, size_t packetsCountPerElement, size_t tagAlignment,
NEO::DeviceBitfield deviceBitfield) const override; NEO::DeviceBitfield deviceBitfield) const override;
uint64_t getOaTimestampValidBits() const override; uint64_t getOaTimestampValidBits() const override;
CopyOffloadMode getDefaultCopyOffloadMode(bool additionalBlitPropertiesSupported) const override; CopyOffloadMode getDefaultCopyOffloadMode(bool additionalBlitPropertiesSupported) const override;

View File

@@ -75,7 +75,7 @@ bool L0GfxCoreHelperHw<Family>::implicitSynchronizedDispatchForCooperativeKernel
} }
template <typename Family> template <typename Family>
std::unique_ptr<NEO::TagAllocatorBase> L0GfxCoreHelperHw<Family>::getInOrderTimestampAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, NEO::MemoryManager *memoryManager, size_t initialTagCount, size_t packetsCountPerElement, std::unique_ptr<NEO::TagAllocatorBase> L0GfxCoreHelperHw<Family>::getInOrderTimestampAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, NEO::MemoryManager *memoryManager, uint32_t initialTagCount, size_t packetsCountPerElement,
size_t tagAlignment, NEO::DeviceBitfield deviceBitfield) const { size_t tagAlignment, NEO::DeviceBitfield deviceBitfield) const {
using TimestampPacketType = typename Family::TimestampPacketType; using TimestampPacketType = typename Family::TimestampPacketType;

View File

@@ -1076,7 +1076,7 @@ TagAllocatorBase *CommandStreamReceiver::getEventPerfCountAllocator(const uint32
return perfCounterAllocator.get(); return perfCounterAllocator.get();
} }
size_t CommandStreamReceiver::getPreferredTagPoolSize() const { uint32_t CommandStreamReceiver::getPreferredTagPoolSize() const {
if (debugManager.flags.DisableTimestampPacketOptimizations.get()) { if (debugManager.flags.DisableTimestampPacketOptimizations.get()) {
return 1; return 1;
} }

View File

@@ -285,7 +285,7 @@ class CommandStreamReceiver : NEO::NonCopyableAndNonMovableClass {
AllocationsList &getDeferredAllocations(); AllocationsList &getDeferredAllocations();
InternalAllocationStorage *getInternalAllocationStorage() const { return internalAllocationStorage.get(); } InternalAllocationStorage *getInternalAllocationStorage() const { return internalAllocationStorage.get(); }
MOCKABLE_VIRTUAL bool createAllocationForHostSurface(HostPtrSurface &surface, bool requiresL3Flush); MOCKABLE_VIRTUAL bool createAllocationForHostSurface(HostPtrSurface &surface, bool requiresL3Flush);
virtual size_t getPreferredTagPoolSize() const; virtual uint32_t getPreferredTagPoolSize() const;
virtual void fillReusableAllocationsList(); virtual void fillReusableAllocationsList();
virtual void setupContext(OsContext &osContext) { this->osContext = &osContext; } virtual void setupContext(OsContext &osContext) { this->osContext = &osContext; }
OsContext &getOsContext() const { return *osContext; } OsContext &getOsContext() const { return *osContext; }

View File

@@ -61,7 +61,7 @@ class CommandStreamReceiverSimulatedCommonHw : public CommandStreamReceiverHw<Gf
void makeNonResident(GraphicsAllocation &gfxAllocation) override; void makeNonResident(GraphicsAllocation &gfxAllocation) override;
size_t getPreferredTagPoolSize() const override { return 1; } uint32_t getPreferredTagPoolSize() const override { return 1; }
aub_stream::AubManager *aubManager = nullptr; aub_stream::AubManager *aubManager = nullptr;
std::unique_ptr<HardwareContextController> hardwareContextController; std::unique_ptr<HardwareContextController> hardwareContextController;

View File

@@ -43,7 +43,7 @@ class CommandStreamReceiverWithAUBDump : public BaseCSR {
WaitStatus waitForTaskCountWithKmdNotifyFallback(TaskCountType taskCountToWait, FlushStamp flushStampToWait, WaitStatus waitForTaskCountWithKmdNotifyFallback(TaskCountType taskCountToWait, FlushStamp flushStampToWait,
bool useQuickKmdSleep, QueueThrottle throttle) override; bool useQuickKmdSleep, QueueThrottle throttle) override;
size_t getPreferredTagPoolSize() const override { return 1; } uint32_t getPreferredTagPoolSize() const override { return 1; }
void addAubComment(const char *comment) override; void addAubComment(const char *comment) override;

View File

@@ -138,7 +138,7 @@ class GfxCoreHelper {
virtual uint32_t getPlanarYuvMaxHeight() const = 0; virtual uint32_t getPlanarYuvMaxHeight() const = 0;
virtual size_t getPreemptionAllocationAlignment() const = 0; virtual size_t getPreemptionAllocationAlignment() const = 0;
virtual std::unique_ptr<TagAllocatorBase> createTimestampPacketAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memoryManager, virtual std::unique_ptr<TagAllocatorBase> createTimestampPacketAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memoryManager,
size_t initialTagCount, CommandStreamReceiverType csrType, uint32_t initialTagCount, CommandStreamReceiverType csrType,
DeviceBitfield deviceBitfield) const = 0; DeviceBitfield deviceBitfield) const = 0;
virtual size_t getTimestampPacketAllocatorAlignment() const = 0; virtual size_t getTimestampPacketAllocatorAlignment() const = 0;
virtual size_t getSingleTimestampPacketSize() const = 0; virtual size_t getSingleTimestampPacketSize() const = 0;
@@ -404,7 +404,7 @@ class GfxCoreHelperHw : public GfxCoreHelper {
size_t getPreemptionAllocationAlignment() const override; size_t getPreemptionAllocationAlignment() const override;
std::unique_ptr<TagAllocatorBase> createTimestampPacketAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memoryManager, std::unique_ptr<TagAllocatorBase> createTimestampPacketAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memoryManager,
size_t initialTagCount, CommandStreamReceiverType csrType, uint32_t initialTagCount, CommandStreamReceiverType csrType,
DeviceBitfield deviceBitfield) const override; DeviceBitfield deviceBitfield) const override;
size_t getTimestampPacketAllocatorAlignment() const override; size_t getTimestampPacketAllocatorAlignment() const override;

View File

@@ -505,7 +505,7 @@ uint32_t GfxCoreHelperHw<GfxFamily>::getNativeVectorWidthHalf(uint32_t vectorWid
template <typename GfxFamily> template <typename GfxFamily>
std::unique_ptr<TagAllocatorBase> GfxCoreHelperHw<GfxFamily>::createTimestampPacketAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memoryManager, std::unique_ptr<TagAllocatorBase> GfxCoreHelperHw<GfxFamily>::createTimestampPacketAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memoryManager,
size_t initialTagCount, CommandStreamReceiverType csrType, DeviceBitfield deviceBitfield) const { uint32_t initialTagCount, CommandStreamReceiverType csrType, DeviceBitfield deviceBitfield) const {
bool doNotReleaseNodes = (csrType > CommandStreamReceiverType::hardware) || bool doNotReleaseNodes = (csrType > CommandStreamReceiverType::hardware) ||
debugManager.flags.DisableTimestampPacketOptimizations.get(); debugManager.flags.DisableTimestampPacketOptimizations.get();

View File

@@ -29,7 +29,7 @@ class DeviceAllocNodeType {
public: public:
using ValueT = uint64_t; using ValueT = uint64_t;
static constexpr size_t defaultAllocatorTagCount = 128; static constexpr uint32_t defaultAllocatorTagCount = 128;
static constexpr AllocationType getAllocationType() { return deviceAlloc ? NEO::AllocationType::gpuTimestampDeviceBuffer : NEO::AllocationType::timestampPacketTagBuffer; } static constexpr AllocationType getAllocationType() { return deviceAlloc ? NEO::AllocationType::gpuTimestampDeviceBuffer : NEO::AllocationType::timestampPacketTagBuffer; }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021-2023 Intel Corporation * Copyright (C) 2021-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -12,10 +12,9 @@
namespace NEO { namespace NEO {
TagAllocatorBase::TagAllocatorBase(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memMngr, size_t tagCount, size_t tagAlignment, size_t tagSize, bool doNotReleaseNodes, DeviceBitfield deviceBitfield) TagAllocatorBase::TagAllocatorBase(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memMngr, uint32_t tagCount, size_t tagAlignment, size_t tagSize, bool doNotReleaseNodes, DeviceBitfield deviceBitfield)
: deviceBitfield(deviceBitfield), rootDeviceIndices(rootDeviceIndices), memoryManager(memMngr), tagCount(tagCount), tagSize(tagSize), doNotReleaseNodes(doNotReleaseNodes) { : deviceBitfield(deviceBitfield), rootDeviceIndices(rootDeviceIndices), memoryManager(memMngr), tagCount(tagCount), tagSize(static_cast<uint32_t>(alignUp(tagSize, tagAlignment))), doNotReleaseNodes(doNotReleaseNodes) {
this->tagSize = alignUp(tagSize, tagAlignment);
maxRootDeviceIndex = *std::max_element(std::begin(rootDeviceIndices), std::end(rootDeviceIndices)); maxRootDeviceIndex = *std::max_element(std::begin(rootDeviceIndices), std::end(rootDeviceIndices));
} }

View File

@@ -156,7 +156,7 @@ class TagAllocatorBase {
protected: protected:
TagAllocatorBase() = delete; TagAllocatorBase() = delete;
TagAllocatorBase(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memMngr, size_t tagCount, TagAllocatorBase(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memMngr, uint32_t tagCount,
size_t tagAlignment, size_t tagSize, bool doNotReleaseNodes, size_t tagAlignment, size_t tagSize, bool doNotReleaseNodes,
DeviceBitfield deviceBitfield); DeviceBitfield deviceBitfield);
@@ -173,8 +173,8 @@ class TagAllocatorBase {
RootDeviceIndicesContainer rootDeviceIndices; RootDeviceIndicesContainer rootDeviceIndices;
uint32_t maxRootDeviceIndex = 0; uint32_t maxRootDeviceIndex = 0;
MemoryManager *memoryManager; MemoryManager *memoryManager;
size_t tagCount; const uint32_t tagCount;
size_t tagSize; const uint32_t tagSize;
bool doNotReleaseNodes = false; bool doNotReleaseNodes = false;
std::mutex allocatorMutex; std::mutex allocatorMutex;
@@ -186,7 +186,7 @@ class TagAllocator : public TagAllocatorBase {
using NodeType = TagNode<TagType>; using NodeType = TagNode<TagType>;
using ValueT = typename TagType::ValueT; using ValueT = typename TagType::ValueT;
TagAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memMngr, size_t tagCount, TagAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memMngr, uint32_t tagCount,
size_t tagAlignment, size_t tagSize, ValueT initialValue, bool doNotReleaseNodes, bool initializeTags, DeviceBitfield deviceBitfield); size_t tagAlignment, size_t tagSize, ValueT initialValue, bool doNotReleaseNodes, bool initializeTags, DeviceBitfield deviceBitfield);
TagNodeBase *getTag() override; TagNodeBase *getTag() override;

View File

@@ -13,7 +13,7 @@
namespace NEO { namespace NEO {
template <typename TagType> template <typename TagType>
TagAllocator<TagType>::TagAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memMngr, size_t tagCount, size_t tagAlignment, TagAllocator<TagType>::TagAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memMngr, uint32_t tagCount, size_t tagAlignment,
size_t tagSize, ValueT initialValue, bool doNotReleaseNodes, bool initializeTags, DeviceBitfield deviceBitfield) size_t tagSize, ValueT initialValue, bool doNotReleaseNodes, bool initializeTags, DeviceBitfield deviceBitfield)
: TagAllocatorBase(rootDeviceIndices, memMngr, tagCount, tagAlignment, tagSize, doNotReleaseNodes, deviceBitfield), initialValue(initialValue), initializeTags(initializeTags) { : TagAllocatorBase(rootDeviceIndices, memMngr, tagCount, tagAlignment, tagSize, doNotReleaseNodes, deviceBitfield), initialValue(initialValue), initializeTags(initializeTags) {

View File

@@ -296,7 +296,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily> {
return BaseClass::writeMemory(gfxAllocation, isChunkCopy, gpuVaChunkOffset, chunkSize); return BaseClass::writeMemory(gfxAllocation, isChunkCopy, gpuVaChunkOffset, chunkSize);
} }
size_t getPreferredTagPoolSize() const override { uint32_t getPreferredTagPoolSize() const override {
return BaseClass::getPreferredTagPoolSize() + 1; return BaseClass::getPreferredTagPoolSize() + 1;
} }
void setPreemptionAllocation(GraphicsAllocation *allocation) { this->preemptionAllocation = allocation; } void setPreemptionAllocation(GraphicsAllocation *allocation) { this->preemptionAllocation = allocation; }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2024 Intel Corporation * Copyright (C) 2019-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -19,16 +19,16 @@ class MockTagAllocator : public TagAllocator<TagType> {
using BaseClass::usedTags; using BaseClass::usedTags;
using NodeType = typename BaseClass::NodeType; using NodeType = typename BaseClass::NodeType;
MockTagAllocator(uint32_t rootDeviceIndex, MemoryManager *memoryManager, size_t tagCount, MockTagAllocator(uint32_t rootDeviceIndex, MemoryManager *memoryManager, uint32_t tagCount,
size_t tagAlignment, size_t tagSize, bool doNotReleaseNodes, DeviceBitfield deviceBitfield) size_t tagAlignment, size_t tagSize, bool doNotReleaseNodes, DeviceBitfield deviceBitfield)
: BaseClass(RootDeviceIndicesContainer({rootDeviceIndex}), memoryManager, tagCount, tagAlignment, tagSize, NEO::TimestampPacketConstants::initValue, doNotReleaseNodes, true, deviceBitfield) { : BaseClass(RootDeviceIndicesContainer({rootDeviceIndex}), memoryManager, tagCount, tagAlignment, tagSize, NEO::TimestampPacketConstants::initValue, doNotReleaseNodes, true, deviceBitfield) {
} }
MockTagAllocator(uint32_t rootDeviceIndex, MemoryManager *memoryManager, size_t tagCount = 10) MockTagAllocator(uint32_t rootDeviceIndex, MemoryManager *memoryManager, uint32_t tagCount = 10)
: MockTagAllocator(rootDeviceIndex, memoryManager, tagCount, MemoryConstants::cacheLineSize, sizeof(TagType), false, mockDeviceBitfield) { : MockTagAllocator(rootDeviceIndex, memoryManager, tagCount, MemoryConstants::cacheLineSize, sizeof(TagType), false, mockDeviceBitfield) {
} }
MockTagAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memoryManager, size_t tagCount = 10) MockTagAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memoryManager, uint32_t tagCount = 10)
: BaseClass(rootDeviceIndices, memoryManager, tagCount, MemoryConstants::cacheLineSize, sizeof(TagType), NEO::TimestampPacketConstants::initValue, false, true, mockDeviceBitfield) {} : BaseClass(rootDeviceIndices, memoryManager, tagCount, MemoryConstants::cacheLineSize, sizeof(TagType), NEO::TimestampPacketConstants::initValue, false, true, mockDeviceBitfield) {}
void returnTag(TagNodeBase *node) override { void returnTag(TagNodeBase *node) override {

View File

@@ -93,16 +93,16 @@ class MockTagAllocator : public TagAllocator<TagType> {
using BaseClass::usedTags; using BaseClass::usedTags;
using BaseClass::TagAllocatorBase::cleanUpResources; using BaseClass::TagAllocatorBase::cleanUpResources;
MockTagAllocator(uint32_t rootDeviceIndex, MemoryManager *memoryManager, size_t tagCount, MockTagAllocator(uint32_t rootDeviceIndex, MemoryManager *memoryManager, uint32_t tagCount,
size_t tagAlignment, size_t tagSize, bool doNotReleaseNodes, DeviceBitfield deviceBitfield) size_t tagAlignment, size_t tagSize, bool doNotReleaseNodes, DeviceBitfield deviceBitfield)
: BaseClass(RootDeviceIndicesContainer{rootDeviceIndex}, memoryManager, tagCount, tagAlignment, tagSize, 0, doNotReleaseNodes, true, deviceBitfield) { : BaseClass(RootDeviceIndicesContainer{rootDeviceIndex}, memoryManager, tagCount, tagAlignment, tagSize, 0, doNotReleaseNodes, true, deviceBitfield) {
} }
MockTagAllocator(MemoryManager *memMngr, size_t tagCount, size_t tagAlignment, bool disableCompletionCheck, DeviceBitfield deviceBitfield) MockTagAllocator(MemoryManager *memMngr, uint32_t tagCount, size_t tagAlignment, bool disableCompletionCheck, DeviceBitfield deviceBitfield)
: MockTagAllocator(0, memMngr, tagCount, tagAlignment, sizeof(TagType), disableCompletionCheck, deviceBitfield) { : MockTagAllocator(0, memMngr, tagCount, tagAlignment, sizeof(TagType), disableCompletionCheck, deviceBitfield) {
} }
MockTagAllocator(MemoryManager *memMngr, size_t tagCount, size_t tagAlignment, DeviceBitfield deviceBitfield) MockTagAllocator(MemoryManager *memMngr, uint32_t tagCount, size_t tagAlignment, DeviceBitfield deviceBitfield)
: MockTagAllocator(memMngr, tagCount, tagAlignment, false, deviceBitfield) { : MockTagAllocator(memMngr, tagCount, tagAlignment, false, deviceBitfield) {
} }