mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 05:56:36 +08:00
Move TSP creation to HwHelper
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
1414247ed4
commit
a6c6290c09
@@ -667,15 +667,6 @@ TEST_F(CommandStreamReceiverTest, whenGettingEventPerfCountAllocatorThenSameTagA
|
|||||||
EXPECT_EQ(allocator2, allocator);
|
EXPECT_EQ(allocator2, allocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(CommandStreamReceiverTest, givenCsrWhenAskingForTimestampPacketAlignmentThenReturnFourCachelines) {
|
|
||||||
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
|
||||||
EXPECT_EQ(nullptr, csr.timestampPacketAllocator.get());
|
|
||||||
|
|
||||||
constexpr auto expectedAlignment = MemoryConstants::cacheLineSize * 4;
|
|
||||||
|
|
||||||
EXPECT_EQ(expectedAlignment, csr.getTimestampPacketAllocatorAlignment());
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(CommandStreamReceiverTest, givenUltCommandStreamReceiverWhenAddAubCommentIsCalledThenCallAddAubCommentOnCsr) {
|
HWTEST_F(CommandStreamReceiverTest, givenUltCommandStreamReceiverWhenAddAubCommentIsCalledThenCallAddAubCommentOnCsr) {
|
||||||
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||||
csr.addAubComment("message");
|
csr.addAubComment("message");
|
||||||
|
|||||||
@@ -73,6 +73,14 @@ TEST_F(HwHelperTest, WhenGettingHelperThenValidHelperReturned) {
|
|||||||
EXPECT_NE(nullptr, &helper);
|
EXPECT_NE(nullptr, &helper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWTEST_F(HwHelperTest, givenHwHelperWhenAskingForTimestampPacketAlignmentThenReturnFourCachelines) {
|
||||||
|
auto &helper = HwHelper::get(renderCoreFamily);
|
||||||
|
|
||||||
|
constexpr auto expectedAlignment = MemoryConstants::cacheLineSize * 4;
|
||||||
|
|
||||||
|
EXPECT_EQ(expectedAlignment, helper.getTimestampPacketAllocatorAlignment());
|
||||||
|
}
|
||||||
|
|
||||||
HWTEST_F(HwHelperTest, SetRenderSurfaceStateForBufferIsCalledThenSetL1CachePolicyIsCalled) {
|
HWTEST_F(HwHelperTest, SetRenderSurfaceStateForBufferIsCalledThenSetL1CachePolicyIsCalled) {
|
||||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||||
using SURFACE_TYPE = typename RENDER_SURFACE_STATE::SURFACE_TYPE;
|
using SURFACE_TYPE = typename RENDER_SURFACE_STATE::SURFACE_TYPE;
|
||||||
|
|||||||
@@ -406,27 +406,17 @@ HWTEST_F(TimestampPacketTests, givenDebugFlagSetWhenCreatingAllocatorThenUseCorr
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(TimestampPacketTests, givenTagAlignmentWhenCreatingAllocatorThenGpuAddressIsAligned) {
|
HWTEST_F(TimestampPacketTests, givenTagAlignmentWhenCreatingAllocatorThenGpuAddressIsAligned) {
|
||||||
class MyCsr : public CommandStreamReceiverHw<FamilyType> {
|
auto csr = executionEnvironment->memoryManager->getRegisteredEngines()[0].commandStreamReceiver;
|
||||||
public:
|
|
||||||
using CommandStreamReceiverHw<FamilyType>::CommandStreamReceiverHw;
|
|
||||||
size_t getTimestampPacketAllocatorAlignment() const override {
|
|
||||||
return alignment;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t alignment = 4096;
|
auto &hwHelper = HwHelper::get(device->getHardwareInfo().platform.eRenderCoreFamily);
|
||||||
};
|
|
||||||
OsContext &osContext = *executionEnvironment->memoryManager->getRegisteredEngines()[0].osContext;
|
|
||||||
|
|
||||||
MyCsr csr(*executionEnvironment, 0, osContext.getDeviceBitfield());
|
auto allocator = csr->getTimestampPacketAllocator();
|
||||||
csr.setupContext(osContext);
|
|
||||||
|
|
||||||
auto allocator = csr.getTimestampPacketAllocator();
|
|
||||||
|
|
||||||
auto tag1 = allocator->getTag();
|
auto tag1 = allocator->getTag();
|
||||||
auto tag2 = allocator->getTag();
|
auto tag2 = allocator->getTag();
|
||||||
|
|
||||||
EXPECT_TRUE(isAligned(tag1->getGpuAddress(), csr.alignment));
|
EXPECT_TRUE(isAligned(tag1->getGpuAddress(), hwHelper.getTimestampPacketAllocatorAlignment()));
|
||||||
EXPECT_TRUE(isAligned(tag2->getGpuAddress(), csr.alignment));
|
EXPECT_TRUE(isAligned(tag2->getGpuAddress(), hwHelper.getTimestampPacketAllocatorAlignment()));
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(TimestampPacketTests, givenDebugFlagSetWhenCreatingTimestampPacketAllocatorThenDisableReusingAndLimitPoolSize) {
|
HWTEST_F(TimestampPacketTests, givenDebugFlagSetWhenCreatingTimestampPacketAllocatorThenDisableReusingAndLimitPoolSize) {
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
|||||||
using BaseClass::getCmdSizeForPrologue;
|
using BaseClass::getCmdSizeForPrologue;
|
||||||
using BaseClass::getScratchPatchAddress;
|
using BaseClass::getScratchPatchAddress;
|
||||||
using BaseClass::getScratchSpaceController;
|
using BaseClass::getScratchSpaceController;
|
||||||
using BaseClass::getTimestampPacketAllocatorAlignment;
|
|
||||||
using BaseClass::indirectHeap;
|
using BaseClass::indirectHeap;
|
||||||
using BaseClass::iohState;
|
using BaseClass::iohState;
|
||||||
using BaseClass::isBlitterDirectSubmissionEnabled;
|
using BaseClass::isBlitterDirectSubmissionEnabled;
|
||||||
|
|||||||
@@ -160,11 +160,6 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
|||||||
bool checkPlatformSupportsNewResourceImplicitFlush() const;
|
bool checkPlatformSupportsNewResourceImplicitFlush() const;
|
||||||
bool checkPlatformSupportsGpuIdleImplicitFlush() const;
|
bool checkPlatformSupportsGpuIdleImplicitFlush() const;
|
||||||
|
|
||||||
MOCKABLE_VIRTUAL size_t getTimestampPacketAllocatorAlignment() const;
|
|
||||||
|
|
||||||
template <typename SizeT>
|
|
||||||
std::unique_ptr<TagAllocatorBase> createTimestampPacketAllocator();
|
|
||||||
|
|
||||||
HeapDirtyState dshState;
|
HeapDirtyState dshState;
|
||||||
HeapDirtyState iohState;
|
HeapDirtyState iohState;
|
||||||
HeapDirtyState sshState;
|
HeapDirtyState sshState;
|
||||||
|
|||||||
@@ -1375,45 +1375,15 @@ size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForPerDssBackedBuffer(const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
|
||||||
template <typename TagSizeT>
|
|
||||||
std::unique_ptr<TagAllocatorBase> CommandStreamReceiverHw<GfxFamily>::createTimestampPacketAllocator() {
|
|
||||||
// dont release nodes in aub/tbx mode, to avoid removing semaphores optimization or reusing returned tags
|
|
||||||
bool doNotReleaseNodes = (getType() > CommandStreamReceiverType::CSR_HW) ||
|
|
||||||
DebugManager.flags.DisableTimestampPacketOptimizations.get();
|
|
||||||
|
|
||||||
using TimestampPacketsT = TimestampPackets<TagSizeT>;
|
|
||||||
|
|
||||||
std::vector<uint32_t> rootDeviceIndices = {rootDeviceIndex};
|
|
||||||
|
|
||||||
auto allocator = new TagAllocator<TimestampPacketsT>(
|
|
||||||
rootDeviceIndices, getMemoryManager(), getPreferredTagPoolSize(), getTimestampPacketAllocatorAlignment(),
|
|
||||||
sizeof(TimestampPacketsT), doNotReleaseNodes, osContext->getDeviceBitfield());
|
|
||||||
|
|
||||||
return std::unique_ptr<TagAllocatorBase>(allocator);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
TagAllocatorBase *CommandStreamReceiverHw<GfxFamily>::getTimestampPacketAllocator() {
|
TagAllocatorBase *CommandStreamReceiverHw<GfxFamily>::getTimestampPacketAllocator() {
|
||||||
if (timestampPacketAllocator.get() == nullptr) {
|
if (timestampPacketAllocator.get() == nullptr) {
|
||||||
if (DebugManager.flags.OverrideTimestampPacketSize.get() != -1) {
|
auto &hwHelper = HwHelper::get(peekHwInfo().platform.eRenderCoreFamily);
|
||||||
if (DebugManager.flags.OverrideTimestampPacketSize.get() == 4) {
|
const std::vector<uint32_t> rootDeviceIndices = {rootDeviceIndex};
|
||||||
timestampPacketAllocator = createTimestampPacketAllocator<uint32_t>();
|
|
||||||
} else if (DebugManager.flags.OverrideTimestampPacketSize.get() == 8) {
|
timestampPacketAllocator = hwHelper.createTimestampPacketAllocator(rootDeviceIndices, getMemoryManager(), getPreferredTagPoolSize(), getType(), osContext->getDeviceBitfield());
|
||||||
timestampPacketAllocator = createTimestampPacketAllocator<uint64_t>();
|
|
||||||
} else {
|
|
||||||
UNRECOVERABLE_IF(true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
timestampPacketAllocator = createTimestampPacketAllocator<typename GfxFamily::TimestampPacketType>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return timestampPacketAllocator.get();
|
return timestampPacketAllocator.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
|
||||||
size_t CommandStreamReceiverHw<GfxFamily>::getTimestampPacketAllocatorAlignment() const {
|
|
||||||
return MemoryConstants::cacheLineSize * 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "shared/source/commands/bxml_generator_glue.h"
|
#include "shared/source/commands/bxml_generator_glue.h"
|
||||||
#include "shared/source/helpers/aux_translation.h"
|
#include "shared/source/helpers/aux_translation.h"
|
||||||
#include "shared/source/helpers/engine_node_helper.h"
|
#include "shared/source/helpers/engine_node_helper.h"
|
||||||
|
#include "shared/source/helpers/options.h"
|
||||||
#include "shared/source/utilities/stackvec.h"
|
#include "shared/source/utilities/stackvec.h"
|
||||||
|
|
||||||
#include "aub_mem_dump.h"
|
#include "aub_mem_dump.h"
|
||||||
@@ -26,6 +27,7 @@
|
|||||||
namespace NEO {
|
namespace NEO {
|
||||||
class GmmHelper;
|
class GmmHelper;
|
||||||
class GraphicsAllocation;
|
class GraphicsAllocation;
|
||||||
|
class TagAllocatorBase;
|
||||||
struct AllocationData;
|
struct AllocationData;
|
||||||
struct AllocationProperties;
|
struct AllocationProperties;
|
||||||
struct EngineControl;
|
struct EngineControl;
|
||||||
@@ -147,6 +149,10 @@ class HwHelper {
|
|||||||
virtual uint32_t getPlanarYuvMaxHeight() const = 0;
|
virtual uint32_t getPlanarYuvMaxHeight() const = 0;
|
||||||
virtual bool isBlitterForImagesSupported(const HardwareInfo &hwInfo) const = 0;
|
virtual bool isBlitterForImagesSupported(const HardwareInfo &hwInfo) const = 0;
|
||||||
virtual size_t getPreemptionAllocationAlignment() const = 0;
|
virtual size_t getPreemptionAllocationAlignment() const = 0;
|
||||||
|
virtual std::unique_ptr<TagAllocatorBase> createTimestampPacketAllocator(const std::vector<uint32_t> &rootDeviceIndices, MemoryManager *memoryManager,
|
||||||
|
size_t initialTagCount, CommandStreamReceiverType csrType,
|
||||||
|
DeviceBitfield deviceBitfield) const = 0;
|
||||||
|
virtual size_t getTimestampPacketAllocatorAlignment() const = 0;
|
||||||
|
|
||||||
static uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo);
|
static uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo);
|
||||||
static uint32_t getEnginesCount(const HardwareInfo &hwInfo);
|
static uint32_t getEnginesCount(const HardwareInfo &hwInfo);
|
||||||
@@ -370,6 +376,11 @@ class HwHelperHw : public HwHelper {
|
|||||||
|
|
||||||
size_t getPreemptionAllocationAlignment() const override;
|
size_t getPreemptionAllocationAlignment() const override;
|
||||||
|
|
||||||
|
std::unique_ptr<TagAllocatorBase> createTimestampPacketAllocator(const std::vector<uint32_t> &rootDeviceIndices, MemoryManager *memoryManager,
|
||||||
|
size_t initialTagCount, CommandStreamReceiverType csrType,
|
||||||
|
DeviceBitfield deviceBitfield) const override;
|
||||||
|
size_t getTimestampPacketAllocatorAlignment() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override;
|
LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override;
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,11 @@
|
|||||||
#include "shared/source/helpers/hw_helper.h"
|
#include "shared/source/helpers/hw_helper.h"
|
||||||
#include "shared/source/helpers/hw_info.h"
|
#include "shared/source/helpers/hw_info.h"
|
||||||
#include "shared/source/helpers/preamble.h"
|
#include "shared/source/helpers/preamble.h"
|
||||||
|
#include "shared/source/helpers/timestamp_packet.h"
|
||||||
#include "shared/source/memory_manager/allocation_properties.h"
|
#include "shared/source/memory_manager/allocation_properties.h"
|
||||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||||
#include "shared/source/os_interface/os_interface.h"
|
#include "shared/source/os_interface/os_interface.h"
|
||||||
|
#include "shared/source/utilities/tag_allocator.h"
|
||||||
|
|
||||||
#include "aub_mem_dump.h"
|
#include "aub_mem_dump.h"
|
||||||
#include "pipe_control_args.h"
|
#include "pipe_control_args.h"
|
||||||
@@ -460,6 +462,37 @@ bool HwHelperHw<GfxFamily>::additionalKernelExecInfoSupported(const HardwareInfo
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename GfxFamily>
|
||||||
|
std::unique_ptr<TagAllocatorBase> HwHelperHw<GfxFamily>::createTimestampPacketAllocator(const std::vector<uint32_t> &rootDeviceIndices, MemoryManager *memoryManager,
|
||||||
|
size_t initialTagCount, CommandStreamReceiverType csrType, DeviceBitfield deviceBitfield) const {
|
||||||
|
bool doNotReleaseNodes = (csrType > CommandStreamReceiverType::CSR_HW) ||
|
||||||
|
DebugManager.flags.DisableTimestampPacketOptimizations.get();
|
||||||
|
|
||||||
|
auto tagAlignment = getTimestampPacketAllocatorAlignment();
|
||||||
|
|
||||||
|
if (DebugManager.flags.OverrideTimestampPacketSize.get() != -1) {
|
||||||
|
if (DebugManager.flags.OverrideTimestampPacketSize.get() == 4) {
|
||||||
|
using TimestampPackets32T = TimestampPackets<uint32_t>;
|
||||||
|
return std::make_unique<TagAllocator<TimestampPackets32T>>(rootDeviceIndices, memoryManager, initialTagCount, tagAlignment, sizeof(TimestampPackets32T), doNotReleaseNodes, deviceBitfield);
|
||||||
|
} else if (DebugManager.flags.OverrideTimestampPacketSize.get() == 8) {
|
||||||
|
using TimestampPackets64T = TimestampPackets<uint64_t>;
|
||||||
|
return std::make_unique<TagAllocator<TimestampPackets64T>>(rootDeviceIndices, memoryManager, initialTagCount, tagAlignment, sizeof(TimestampPackets64T), doNotReleaseNodes, deviceBitfield);
|
||||||
|
} else {
|
||||||
|
UNRECOVERABLE_IF(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
using TimestampPacketType = typename GfxFamily::TimestampPacketType;
|
||||||
|
using TimestampPacketsT = TimestampPackets<TimestampPacketType>;
|
||||||
|
|
||||||
|
return std::make_unique<TagAllocator<TimestampPacketsT>>(rootDeviceIndices, memoryManager, initialTagCount, tagAlignment, sizeof(TimestampPacketsT), doNotReleaseNodes, deviceBitfield);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename GfxFamily>
|
||||||
|
size_t HwHelperHw<GfxFamily>::getTimestampPacketAllocatorAlignment() const {
|
||||||
|
return MemoryConstants::cacheLineSize * 4;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
LocalMemoryAccessMode HwHelperHw<GfxFamily>::getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const {
|
LocalMemoryAccessMode HwHelperHw<GfxFamily>::getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const {
|
||||||
switch (static_cast<LocalMemoryAccessMode>(DebugManager.flags.ForceLocalMemoryAccessMode.get())) {
|
switch (static_cast<LocalMemoryAccessMode>(DebugManager.flags.ForceLocalMemoryAccessMode.get())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user