diff --git a/level_zero/core/source/device/device.cpp b/level_zero/core/source/device/device.cpp index d438f1f70e..9355021065 100644 --- a/level_zero/core/source/device/device.cpp +++ b/level_zero/core/source/device/device.cpp @@ -79,7 +79,7 @@ NEO::TagAllocatorBase *Device::getFillPatternAllocator() { if (!this->fillPatternAllocator.get()) { RootDeviceIndicesContainer rootDeviceIndices = {getNEODevice()->getRootDeviceIndex()}; - fillPatternAllocator = std::make_unique>(rootDeviceIndices, getNEODevice()->getMemoryManager(), MemoryConstants::pageSize2M / MemoryConstants::cacheLineSize, + fillPatternAllocator = std::make_unique>(rootDeviceIndices, getNEODevice()->getMemoryManager(), static_cast(MemoryConstants::pageSize2M / MemoryConstants::cacheLineSize), 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; } -} // namespace L0 \ No newline at end of file +} // namespace L0 diff --git a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h index 7ae50893bb..1c6a298e27 100644 --- a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h +++ b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h @@ -113,7 +113,7 @@ class L0GfxCoreHelper : public NEO::ApiGfxCoreHelper { virtual uint64_t getIpSamplingIpMask() const = 0; virtual bool synchronizedDispatchSupported() const = 0; virtual bool implicitSynchronizedDispatchForCooperativeKernelsAllowed() const = 0; - virtual std::unique_ptr getInOrderTimestampAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, NEO::MemoryManager *memoryManager, size_t initialTagCount, size_t packetsCountPerElement, size_t tagAlignment, + virtual std::unique_ptr getInOrderTimestampAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, NEO::MemoryManager *memoryManager, uint32_t initialTagCount, size_t packetsCountPerElement, size_t tagAlignment, NEO::DeviceBitfield deviceBitfield) const = 0; virtual uint64_t getOaTimestampValidBits() const = 0; virtual CopyOffloadMode getDefaultCopyOffloadMode(bool additionalBlitPropertiesSupported) const = 0; @@ -174,7 +174,7 @@ class L0GfxCoreHelperHw : public L0GfxCoreHelper { uint64_t getIpSamplingIpMask() const override; bool synchronizedDispatchSupported() const override; bool implicitSynchronizedDispatchForCooperativeKernelsAllowed() const override; - std::unique_ptr getInOrderTimestampAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, NEO::MemoryManager *memoryManager, size_t initialTagCount, size_t packetsCountPerElement, size_t tagAlignment, + std::unique_ptr getInOrderTimestampAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, NEO::MemoryManager *memoryManager, uint32_t initialTagCount, size_t packetsCountPerElement, size_t tagAlignment, NEO::DeviceBitfield deviceBitfield) const override; uint64_t getOaTimestampValidBits() const override; CopyOffloadMode getDefaultCopyOffloadMode(bool additionalBlitPropertiesSupported) const override; diff --git a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_base.inl b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_base.inl index b4321a6816..dc38efa850 100644 --- a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_base.inl +++ b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_base.inl @@ -75,7 +75,7 @@ bool L0GfxCoreHelperHw::implicitSynchronizedDispatchForCooperativeKernel } template -std::unique_ptr L0GfxCoreHelperHw::getInOrderTimestampAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, NEO::MemoryManager *memoryManager, size_t initialTagCount, size_t packetsCountPerElement, +std::unique_ptr L0GfxCoreHelperHw::getInOrderTimestampAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, NEO::MemoryManager *memoryManager, uint32_t initialTagCount, size_t packetsCountPerElement, size_t tagAlignment, NEO::DeviceBitfield deviceBitfield) const { using TimestampPacketType = typename Family::TimestampPacketType; diff --git a/shared/source/command_stream/command_stream_receiver.cpp b/shared/source/command_stream/command_stream_receiver.cpp index 1c65b63eb4..747336eb13 100644 --- a/shared/source/command_stream/command_stream_receiver.cpp +++ b/shared/source/command_stream/command_stream_receiver.cpp @@ -1076,7 +1076,7 @@ TagAllocatorBase *CommandStreamReceiver::getEventPerfCountAllocator(const uint32 return perfCounterAllocator.get(); } -size_t CommandStreamReceiver::getPreferredTagPoolSize() const { +uint32_t CommandStreamReceiver::getPreferredTagPoolSize() const { if (debugManager.flags.DisableTimestampPacketOptimizations.get()) { return 1; } diff --git a/shared/source/command_stream/command_stream_receiver.h b/shared/source/command_stream/command_stream_receiver.h index b69f7979b4..605a647028 100644 --- a/shared/source/command_stream/command_stream_receiver.h +++ b/shared/source/command_stream/command_stream_receiver.h @@ -285,7 +285,7 @@ class CommandStreamReceiver : NEO::NonCopyableAndNonMovableClass { AllocationsList &getDeferredAllocations(); InternalAllocationStorage *getInternalAllocationStorage() const { return internalAllocationStorage.get(); } MOCKABLE_VIRTUAL bool createAllocationForHostSurface(HostPtrSurface &surface, bool requiresL3Flush); - virtual size_t getPreferredTagPoolSize() const; + virtual uint32_t getPreferredTagPoolSize() const; virtual void fillReusableAllocationsList(); virtual void setupContext(OsContext &osContext) { this->osContext = &osContext; } OsContext &getOsContext() const { return *osContext; } diff --git a/shared/source/command_stream/command_stream_receiver_simulated_common_hw.h b/shared/source/command_stream/command_stream_receiver_simulated_common_hw.h index 92af28f860..7c3b3cd2a0 100644 --- a/shared/source/command_stream/command_stream_receiver_simulated_common_hw.h +++ b/shared/source/command_stream/command_stream_receiver_simulated_common_hw.h @@ -61,7 +61,7 @@ class CommandStreamReceiverSimulatedCommonHw : public CommandStreamReceiverHw hardwareContextController; diff --git a/shared/source/command_stream/command_stream_receiver_with_aub_dump.h b/shared/source/command_stream/command_stream_receiver_with_aub_dump.h index d95c8cf9e2..094003ccf5 100644 --- a/shared/source/command_stream/command_stream_receiver_with_aub_dump.h +++ b/shared/source/command_stream/command_stream_receiver_with_aub_dump.h @@ -43,7 +43,7 @@ class CommandStreamReceiverWithAUBDump : public BaseCSR { WaitStatus waitForTaskCountWithKmdNotifyFallback(TaskCountType taskCountToWait, FlushStamp flushStampToWait, 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; diff --git a/shared/source/helpers/gfx_core_helper.h b/shared/source/helpers/gfx_core_helper.h index 912ba938bf..8cf7285c2d 100644 --- a/shared/source/helpers/gfx_core_helper.h +++ b/shared/source/helpers/gfx_core_helper.h @@ -138,7 +138,7 @@ class GfxCoreHelper { virtual uint32_t getPlanarYuvMaxHeight() const = 0; virtual size_t getPreemptionAllocationAlignment() const = 0; virtual std::unique_ptr createTimestampPacketAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memoryManager, - size_t initialTagCount, CommandStreamReceiverType csrType, + uint32_t initialTagCount, CommandStreamReceiverType csrType, DeviceBitfield deviceBitfield) const = 0; virtual size_t getTimestampPacketAllocatorAlignment() const = 0; virtual size_t getSingleTimestampPacketSize() const = 0; @@ -404,7 +404,7 @@ class GfxCoreHelperHw : public GfxCoreHelper { size_t getPreemptionAllocationAlignment() const override; std::unique_ptr createTimestampPacketAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memoryManager, - size_t initialTagCount, CommandStreamReceiverType csrType, + uint32_t initialTagCount, CommandStreamReceiverType csrType, DeviceBitfield deviceBitfield) const override; size_t getTimestampPacketAllocatorAlignment() const override; diff --git a/shared/source/helpers/gfx_core_helper_base.inl b/shared/source/helpers/gfx_core_helper_base.inl index 7926cf99a7..380f03eea3 100644 --- a/shared/source/helpers/gfx_core_helper_base.inl +++ b/shared/source/helpers/gfx_core_helper_base.inl @@ -505,7 +505,7 @@ uint32_t GfxCoreHelperHw::getNativeVectorWidthHalf(uint32_t vectorWid template std::unique_ptr GfxCoreHelperHw::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) || debugManager.flags.DisableTimestampPacketOptimizations.get(); diff --git a/shared/source/helpers/in_order_cmd_helpers.h b/shared/source/helpers/in_order_cmd_helpers.h index 42187a0afe..258e023c3c 100644 --- a/shared/source/helpers/in_order_cmd_helpers.h +++ b/shared/source/helpers/in_order_cmd_helpers.h @@ -29,7 +29,7 @@ class DeviceAllocNodeType { public: 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; } diff --git a/shared/source/utilities/tag_allocator.cpp b/shared/source/utilities/tag_allocator.cpp index ff574c8081..efaff5b635 100644 --- a/shared/source/utilities/tag_allocator.cpp +++ b/shared/source/utilities/tag_allocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -12,10 +12,9 @@ namespace NEO { -TagAllocatorBase::TagAllocatorBase(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memMngr, size_t tagCount, size_t tagAlignment, size_t tagSize, bool doNotReleaseNodes, DeviceBitfield deviceBitfield) - : deviceBitfield(deviceBitfield), rootDeviceIndices(rootDeviceIndices), memoryManager(memMngr), tagCount(tagCount), tagSize(tagSize), doNotReleaseNodes(doNotReleaseNodes) { +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(static_cast(alignUp(tagSize, tagAlignment))), doNotReleaseNodes(doNotReleaseNodes) { - this->tagSize = alignUp(tagSize, tagAlignment); maxRootDeviceIndex = *std::max_element(std::begin(rootDeviceIndices), std::end(rootDeviceIndices)); } diff --git a/shared/source/utilities/tag_allocator.h b/shared/source/utilities/tag_allocator.h index 848e6951a9..b518bd51b6 100644 --- a/shared/source/utilities/tag_allocator.h +++ b/shared/source/utilities/tag_allocator.h @@ -156,7 +156,7 @@ class TagAllocatorBase { protected: 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, DeviceBitfield deviceBitfield); @@ -173,8 +173,8 @@ class TagAllocatorBase { RootDeviceIndicesContainer rootDeviceIndices; uint32_t maxRootDeviceIndex = 0; MemoryManager *memoryManager; - size_t tagCount; - size_t tagSize; + const uint32_t tagCount; + const uint32_t tagSize; bool doNotReleaseNodes = false; std::mutex allocatorMutex; @@ -186,7 +186,7 @@ class TagAllocator : public TagAllocatorBase { using NodeType = TagNode; 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); TagNodeBase *getTag() override; diff --git a/shared/source/utilities/tag_allocator.inl b/shared/source/utilities/tag_allocator.inl index 5afe1c996a..e23c17c969 100644 --- a/shared/source/utilities/tag_allocator.inl +++ b/shared/source/utilities/tag_allocator.inl @@ -13,7 +13,7 @@ namespace NEO { template -TagAllocator::TagAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memMngr, size_t tagCount, size_t tagAlignment, +TagAllocator::TagAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memMngr, uint32_t tagCount, size_t tagAlignment, size_t tagSize, ValueT initialValue, bool doNotReleaseNodes, bool initializeTags, DeviceBitfield deviceBitfield) : TagAllocatorBase(rootDeviceIndices, memMngr, tagCount, tagAlignment, tagSize, doNotReleaseNodes, deviceBitfield), initialValue(initialValue), initializeTags(initializeTags) { diff --git a/shared/test/common/libult/ult_command_stream_receiver.h b/shared/test/common/libult/ult_command_stream_receiver.h index 92b0fbfe4c..2faa8733e9 100644 --- a/shared/test/common/libult/ult_command_stream_receiver.h +++ b/shared/test/common/libult/ult_command_stream_receiver.h @@ -296,7 +296,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw { return BaseClass::writeMemory(gfxAllocation, isChunkCopy, gpuVaChunkOffset, chunkSize); } - size_t getPreferredTagPoolSize() const override { + uint32_t getPreferredTagPoolSize() const override { return BaseClass::getPreferredTagPoolSize() + 1; } void setPreemptionAllocation(GraphicsAllocation *allocation) { this->preemptionAllocation = allocation; } diff --git a/shared/test/common/mocks/mock_timestamp_container.h b/shared/test/common/mocks/mock_timestamp_container.h index 4bb5681d35..595b215bc7 100644 --- a/shared/test/common/mocks/mock_timestamp_container.h +++ b/shared/test/common/mocks/mock_timestamp_container.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 Intel Corporation + * Copyright (C) 2019-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,16 +19,16 @@ class MockTagAllocator : public TagAllocator { using BaseClass::usedTags; 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) : 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(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) {} void returnTag(TagNodeBase *node) override { diff --git a/shared/test/unit_test/utilities/tag_allocator_tests.cpp b/shared/test/unit_test/utilities/tag_allocator_tests.cpp index c135baaad6..a8322990ef 100644 --- a/shared/test/unit_test/utilities/tag_allocator_tests.cpp +++ b/shared/test/unit_test/utilities/tag_allocator_tests.cpp @@ -93,16 +93,16 @@ class MockTagAllocator : public TagAllocator { using BaseClass::usedTags; 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) : 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(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) { }