Move TSP creation to HwHelper

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2021-05-14 10:20:32 +00:00
committed by Compute-Runtime-Automation
parent 1414247ed4
commit a6c6290c09
8 changed files with 61 additions and 64 deletions

View File

@@ -667,15 +667,6 @@ TEST_F(CommandStreamReceiverTest, whenGettingEventPerfCountAllocatorThenSameTagA
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) {
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
csr.addAubComment("message");

View File

@@ -73,6 +73,14 @@ TEST_F(HwHelperTest, WhenGettingHelperThenValidHelperReturned) {
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) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
using SURFACE_TYPE = typename RENDER_SURFACE_STATE::SURFACE_TYPE;

View File

@@ -406,27 +406,17 @@ HWTEST_F(TimestampPacketTests, givenDebugFlagSetWhenCreatingAllocatorThenUseCorr
}
HWTEST_F(TimestampPacketTests, givenTagAlignmentWhenCreatingAllocatorThenGpuAddressIsAligned) {
class MyCsr : public CommandStreamReceiverHw<FamilyType> {
public:
using CommandStreamReceiverHw<FamilyType>::CommandStreamReceiverHw;
size_t getTimestampPacketAllocatorAlignment() const override {
return alignment;
}
auto csr = executionEnvironment->memoryManager->getRegisteredEngines()[0].commandStreamReceiver;
size_t alignment = 4096;
};
OsContext &osContext = *executionEnvironment->memoryManager->getRegisteredEngines()[0].osContext;
auto &hwHelper = HwHelper::get(device->getHardwareInfo().platform.eRenderCoreFamily);
MyCsr csr(*executionEnvironment, 0, osContext.getDeviceBitfield());
csr.setupContext(osContext);
auto allocator = csr.getTimestampPacketAllocator();
auto allocator = csr->getTimestampPacketAllocator();
auto tag1 = allocator->getTag();
auto tag2 = allocator->getTag();
EXPECT_TRUE(isAligned(tag1->getGpuAddress(), csr.alignment));
EXPECT_TRUE(isAligned(tag2->getGpuAddress(), csr.alignment));
EXPECT_TRUE(isAligned(tag1->getGpuAddress(), hwHelper.getTimestampPacketAllocatorAlignment()));
EXPECT_TRUE(isAligned(tag2->getGpuAddress(), hwHelper.getTimestampPacketAllocatorAlignment()));
}
HWTEST_F(TimestampPacketTests, givenDebugFlagSetWhenCreatingTimestampPacketAllocatorThenDisableReusingAndLimitPoolSize) {

View File

@@ -37,7 +37,6 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
using BaseClass::getCmdSizeForPrologue;
using BaseClass::getScratchPatchAddress;
using BaseClass::getScratchSpaceController;
using BaseClass::getTimestampPacketAllocatorAlignment;
using BaseClass::indirectHeap;
using BaseClass::iohState;
using BaseClass::isBlitterDirectSubmissionEnabled;