Enable RelaxedOrdering for XE_HPC Immediate cmd lists

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>

Related-To: NEO-7458
This commit is contained in:
Dunajski, Bartosz
2022-11-30 10:30:31 +00:00
committed by Compute-Runtime-Automation
parent 43ddabd8e6
commit 3b91cc1b50
11 changed files with 187 additions and 39 deletions

View File

@@ -9,6 +9,7 @@
#include "shared/source/command_stream/submissions_aggregator.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/direct_submission/dispatchers/render_dispatcher.h"
#include "shared/source/direct_submission/relaxed_ordering_helper.h"
#include "shared/source/helpers/flush_stamp.h"
#include "shared/source/utilities/cpu_info.h"
#include "shared/test/common/cmd_parse/hw_parse.h"
@@ -131,8 +132,13 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWithoutCompletionFenceAlloca
EXPECT_TRUE(ret);
EXPECT_EQ(nullptr, directSubmission.completionFenceAllocation);
size_t expectedAllocationsCnt = 3;
if (HwHelperHw<FamilyType>::get().isRelaxedOrderingSupported()) {
expectedAllocationsCnt += 2;
}
EXPECT_EQ(1, mockMemoryOperations->makeResidentCalledCount);
ASSERT_EQ(3u, mockMemoryOperations->gfxAllocationsForMakeResident.size());
ASSERT_EQ(expectedAllocationsCnt, mockMemoryOperations->gfxAllocationsForMakeResident.size());
EXPECT_EQ(directSubmission.ringBuffers[0].ringBuffer, mockMemoryOperations->gfxAllocationsForMakeResident[0]);
EXPECT_EQ(directSubmission.ringBuffers[1].ringBuffer, mockMemoryOperations->gfxAllocationsForMakeResident[1]);
EXPECT_EQ(directSubmission.semaphores, mockMemoryOperations->gfxAllocationsForMakeResident[2]);
@@ -157,8 +163,13 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWithCompletionFenceAllocatio
EXPECT_TRUE(ret);
EXPECT_EQ(&completionFenceAllocation, directSubmission.completionFenceAllocation);
size_t expectedAllocationsCnt = 4;
if (HwHelperHw<FamilyType>::get().isRelaxedOrderingSupported()) {
expectedAllocationsCnt += 2;
}
EXPECT_EQ(1, mockMemoryOperations->makeResidentCalledCount);
ASSERT_EQ(4u, mockMemoryOperations->gfxAllocationsForMakeResident.size());
ASSERT_EQ(expectedAllocationsCnt, mockMemoryOperations->gfxAllocationsForMakeResident.size());
EXPECT_EQ(directSubmission.ringBuffers[0].ringBuffer, mockMemoryOperations->gfxAllocationsForMakeResident[0]);
EXPECT_EQ(directSubmission.ringBuffers[1].ringBuffer, mockMemoryOperations->gfxAllocationsForMakeResident[1]);
EXPECT_EQ(directSubmission.semaphores, mockMemoryOperations->gfxAllocationsForMakeResident[2]);
@@ -356,6 +367,9 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionStartWhenRingIsNotStartedAnd
if (directSubmission.miMemFenceRequired) {
requiredSize += directSubmission.getSizeSystemMemoryFenceAddress();
}
if (directSubmission.isRelaxedOrderingEnabled()) {
requiredSize += RelaxedOrderingHelper::getSizeRegistersInit<FamilyType>();
}
directSubmission.ringCommandStream.getSpace(directSubmission.ringCommandStream.getAvailableSpace() - requiredSize);
@@ -510,7 +524,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenGetDispatchSizeThenExpec
Dispatcher::getSizeCacheFlush(*directSubmission.hwInfo) +
Dispatcher::getSizeMonitorFence(*directSubmission.hwInfo) +
directSubmission.getSizeSemaphoreSection(false);
size_t actualSize = directSubmission.getSizeDispatch(false);
size_t actualSize = directSubmission.getSizeDispatch(false, false);
EXPECT_EQ(expectedSize, actualSize);
}
@@ -526,7 +541,7 @@ HWTEST_F(DirectSubmissionTest,
Dispatcher::getSizeCacheFlush(*directSubmission.hwInfo) +
Dispatcher::getSizeMonitorFence(*directSubmission.hwInfo) +
directSubmission.getSizeSemaphoreSection(false);
size_t actualSize = directSubmission.getSizeDispatch(false);
size_t actualSize = directSubmission.getSizeDispatch(false, false);
EXPECT_EQ(expectedSize, actualSize);
}
@@ -541,7 +556,7 @@ HWTEST_F(DirectSubmissionTest,
size_t expectedSize = Dispatcher::getSizeCacheFlush(*directSubmission.hwInfo) +
Dispatcher::getSizeMonitorFence(*directSubmission.hwInfo) +
directSubmission.getSizeSemaphoreSection(false);
size_t actualSize = directSubmission.getSizeDispatch(false);
size_t actualSize = directSubmission.getSizeDispatch(false, false);
EXPECT_EQ(expectedSize, actualSize);
}
@@ -554,7 +569,8 @@ HWTEST_F(DirectSubmissionTest,
size_t expectedSize = directSubmission.getSizeStartSection() +
Dispatcher::getSizeMonitorFence(*directSubmission.hwInfo) +
directSubmission.getSizeSemaphoreSection(false);
size_t actualSize = directSubmission.getSizeDispatch(false);
size_t actualSize = directSubmission.getSizeDispatch(false, false);
EXPECT_EQ(expectedSize, actualSize);
}
@@ -568,7 +584,8 @@ HWTEST_F(DirectSubmissionTest,
size_t expectedSize = directSubmission.getSizeStartSection() +
Dispatcher::getSizeCacheFlush(*directSubmission.hwInfo) +
directSubmission.getSizeSemaphoreSection(false);
size_t actualSize = directSubmission.getSizeDispatch(false);
size_t actualSize = directSubmission.getSizeDispatch(false, false);
EXPECT_EQ(expectedSize, actualSize);
}
@@ -810,6 +827,9 @@ HWTEST_F(DirectSubmissionTest,
if (directSubmission.miMemFenceRequired) {
expectedSize += directSubmission.getSizeSystemMemoryFenceAddress();
}
if (directSubmission.isRelaxedOrderingEnabled()) {
expectedSize += RelaxedOrderingHelper::getSizeReturnPtrRegs<FamilyType>();
}
EXPECT_EQ(expectedSize, directSubmission.ringCommandStream.getUsed());
}
@@ -881,11 +901,14 @@ HWTEST_F(DirectSubmissionTest,
size_t expectedSize = Dispatcher::getSizePreemption() +
directSubmission.getSizeSemaphoreSection(false) +
directSubmission.getDiagnosticModeSection();
expectedSize += expectedExecCount * directSubmission.getSizeDispatch(false);
expectedSize += expectedExecCount * directSubmission.getSizeDispatch(false, false);
if (directSubmission.miMemFenceRequired) {
expectedSize += directSubmission.getSizeSystemMemoryFenceAddress();
}
if (directSubmission.isRelaxedOrderingEnabled()) {
expectedSize += RelaxedOrderingHelper::getSizeRegistersInit<FamilyType>();
}
bool ret = directSubmission.initialize(false, false);
EXPECT_TRUE(ret);
@@ -922,12 +945,15 @@ HWTEST_F(DirectSubmissionTest,
EXPECT_EQ(expectedStoreAddress, storeCmd->getAddress());
}
size_t sysMemFenceOffset = 0;
size_t cmdOffset = 0;
if (directSubmission.miMemFenceRequired) {
sysMemFenceOffset = directSubmission.getSizeSystemMemoryFenceAddress();
cmdOffset = directSubmission.getSizeSystemMemoryFenceAddress();
}
if (directSubmission.isRelaxedOrderingEnabled()) {
cmdOffset += RelaxedOrderingHelper::getSizeRegistersInit<FamilyType>();
}
uint8_t *cmdBufferPosition = static_cast<uint8_t *>(directSubmission.ringCommandStream.getCpuBase()) + Dispatcher::getSizePreemption() + sysMemFenceOffset;
uint8_t *cmdBufferPosition = static_cast<uint8_t *>(directSubmission.ringCommandStream.getCpuBase()) + Dispatcher::getSizePreemption() + cmdOffset;
MI_STORE_DATA_IMM *storeDataCmdAtPosition = genCmdCast<MI_STORE_DATA_IMM *>(cmdBufferPosition);
ASSERT_NE(nullptr, storeDataCmdAtPosition);
EXPECT_EQ(1u, storeDataCmdAtPosition->getDataDword0());
@@ -978,12 +1004,15 @@ HWTEST_F(DirectSubmissionTest,
size_t expectedSize = Dispatcher::getSizePreemption() +
directSubmission.getSizeSemaphoreSection(false);
size_t expectedDispatch = directSubmission.getSizeSemaphoreSection(false);
EXPECT_EQ(expectedDispatch, directSubmission.getSizeDispatch(false));
EXPECT_EQ(expectedDispatch, directSubmission.getSizeDispatch(false, false));
expectedSize += expectedExecCount * expectedDispatch;
if (directSubmission.miMemFenceRequired) {
expectedSize += directSubmission.getSizeSystemMemoryFenceAddress();
}
if (directSubmission.isRelaxedOrderingEnabled()) {
expectedSize += RelaxedOrderingHelper::getSizeReturnPtrRegs<FamilyType>();
}
bool ret = directSubmission.initialize(false, false);
EXPECT_TRUE(ret);

View File

@@ -207,6 +207,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DirectSubmissionDispatchBufferTest,
if (directSubmission.miMemFenceRequired) {
submitSize += directSubmission.getSizeSystemMemoryFenceAddress();
}
if (directSubmission.isRelaxedOrderingEnabled()) {
submitSize += RelaxedOrderingHelper::getSizeReturnPtrRegs<FamilyType>();
}
EXPECT_EQ(submitSize, directSubmission.submitSize);
EXPECT_EQ(oldRingAllocation->getGpuAddress(), directSubmission.submitGpuAddress);
EXPECT_EQ(1u, directSubmission.handleResidencyCount);
@@ -224,7 +227,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DirectSubmissionDispatchBufferTest,
EXPECT_EQ(1u, directSubmission.submitCount);
EXPECT_EQ(2u, directSubmission.handleResidencyCount);
EXPECT_EQ(directSubmission.getSizeDispatch(false), directSubmission.ringCommandStream.getUsed());
EXPECT_EQ(directSubmission.getSizeDispatch(false, false), directSubmission.ringCommandStream.getUsed());
EXPECT_TRUE(directSubmission.ringStart);
HardwareParse hwParse;
@@ -257,7 +260,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
DebugManager.flags.DirectSubmissionDisableCacheFlush.set(0);
MockDirectSubmissionHw<FamilyType, Dispatcher> regularDirectSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
size_t regularSizeDispatch = regularDirectSubmission.getSizeDispatch(false);
size_t regularSizeDispatch = regularDirectSubmission.getSizeDispatch(false, false);
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
directSubmission.disableMonitorFence = true;
@@ -267,7 +270,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
size_t tagUpdateSize = Dispatcher::getSizeMonitorFence(*directSubmission.hwInfo);
size_t disabledSizeDispatch = directSubmission.getSizeDispatch(false);
size_t disabledSizeDispatch = directSubmission.getSizeDispatch(false, false);
EXPECT_EQ(disabledSizeDispatch, (regularSizeDispatch - tagUpdateSize));
directSubmission.tagValueSetValue = 0x4343123ull;
@@ -306,7 +309,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
DebugManager.flags.DirectSubmissionDisableCacheFlush.set(0);
MockDirectSubmissionHw<FamilyType, Dispatcher> regularDirectSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
size_t regularSizeDispatch = regularDirectSubmission.getSizeDispatch(false);
size_t regularSizeDispatch = regularDirectSubmission.getSizeDispatch(false, false);
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
@@ -316,7 +319,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
size_t flushSize = Dispatcher::getSizeCacheFlush(*directSubmission.hwInfo);
size_t disabledSizeDispatch = directSubmission.getSizeDispatch(false);
size_t disabledSizeDispatch = directSubmission.getSizeDispatch(false, false);
EXPECT_EQ(disabledSizeDispatch, (regularSizeDispatch - flushSize));
directSubmission.dispatchWorkloadSection(batchBuffer);
@@ -354,7 +357,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
MockDirectSubmissionHw<FamilyType, Dispatcher> regularDirectSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
size_t regularSizeDispatch = regularDirectSubmission.getSizeDispatch(false);
size_t regularSizeDispatch = regularDirectSubmission.getSizeDispatch(false, false);
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
@@ -365,7 +368,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
size_t startSize = directSubmission.getSizeStartSection();
size_t storeDataSize = Dispatcher::getSizeStoreDwordCommand();
size_t debugSizeDispatch = directSubmission.getSizeDispatch(false);
size_t debugSizeDispatch = directSubmission.getSizeDispatch(false, false);
EXPECT_EQ(debugSizeDispatch, (regularSizeDispatch - startSize + storeDataSize));
directSubmission.workloadModeOneExpectedValue = 0x40u;
@@ -398,7 +401,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM;
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> regularDirectSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
size_t regularSizeDispatch = regularDirectSubmission.getSizeDispatch(false);
size_t regularSizeDispatch = regularDirectSubmission.getSizeDispatch(false, false);
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
@@ -408,7 +411,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
size_t startSize = directSubmission.getSizeStartSection();
size_t debugSizeDispatch = directSubmission.getSizeDispatch(false);
size_t debugSizeDispatch = directSubmission.getSizeDispatch(false, false);
EXPECT_EQ(debugSizeDispatch, (regularSizeDispatch - startSize));
directSubmission.currentQueueWorkCount = 0x40u;
@@ -450,6 +453,9 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
if (directSubmission.miMemFenceRequired) {
submitSize += directSubmission.getSizeSystemMemoryFenceAddress();
}
if (directSubmission.isRelaxedOrderingEnabled()) {
submitSize += RelaxedOrderingHelper::getSizeRegistersInit<FamilyType>();
}
EXPECT_EQ(submitSize, directSubmission.submitSize);
EXPECT_EQ(oldRingAllocation->getGpuAddress(), directSubmission.submitGpuAddress);
EXPECT_EQ(1u, directSubmission.handleResidencyCount);
@@ -463,7 +469,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
EXPECT_EQ(1u, directSubmission.submitCount);
EXPECT_EQ(2u, directSubmission.handleResidencyCount);
EXPECT_EQ(sizeUsed + directSubmission.getSizeDispatch(false), directSubmission.ringCommandStream.getUsed());
EXPECT_EQ(sizeUsed + directSubmission.getSizeDispatch(false, false), directSubmission.ringCommandStream.getUsed());
EXPECT_TRUE(directSubmission.ringStart);
HardwareParse hwParse;
@@ -498,11 +504,14 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
if (directSubmission.miMemFenceRequired) {
submitSize += directSubmission.getSizeSystemMemoryFenceAddress();
}
if (directSubmission.isRelaxedOrderingEnabled()) {
submitSize += RelaxedOrderingHelper::getSizeRegistersInit<FamilyType>();
}
EXPECT_EQ(submitSize, directSubmission.submitSize);
EXPECT_EQ(oldRingAllocation->getGpuAddress(), directSubmission.submitGpuAddress);
EXPECT_EQ(2u, directSubmission.handleResidencyCount);
size_t dispatchSize = submitSize + directSubmission.getSizeDispatch(false);
size_t dispatchSize = submitSize + directSubmission.getSizeDispatch(false, false);
EXPECT_EQ(dispatchSize, directSubmission.ringCommandStream.getUsed());
EXPECT_TRUE(directSubmission.ringStart);
@@ -527,6 +536,9 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
if (directSubmission.miMemFenceRequired) {
submitSize += directSubmission.getSizeSystemMemoryFenceAddress();
}
if (directSubmission.isRelaxedOrderingEnabled()) {
submitSize += RelaxedOrderingHelper::getSizeRegistersInit<FamilyType>();
}
EXPECT_EQ(submitSize, directSubmission.submitSize);
EXPECT_EQ(oldRingAllocation->getGpuAddress(), directSubmission.submitGpuAddress);
EXPECT_EQ(1u, directSubmission.handleResidencyCount);
@@ -542,7 +554,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
EXPECT_EQ(1u, directSubmission.submitCount);
EXPECT_EQ(2u, directSubmission.handleResidencyCount);
EXPECT_EQ(directSubmission.getSizeDispatch(false), directSubmission.ringCommandStream.getUsed());
EXPECT_EQ(directSubmission.getSizeDispatch(false, false), directSubmission.ringCommandStream.getUsed());
EXPECT_TRUE(directSubmission.ringStart);
}
@@ -573,10 +585,13 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
if (directSubmission.miMemFenceRequired) {
submitSize += directSubmission.getSizeSystemMemoryFenceAddress();
}
if (directSubmission.isRelaxedOrderingEnabled()) {
submitSize += RelaxedOrderingHelper::getSizeRegistersInit<FamilyType>();
}
EXPECT_EQ(submitSize, directSubmission.submitSize);
EXPECT_EQ(2u, directSubmission.handleResidencyCount);
size_t dispatchSize = submitSize + directSubmission.getSizeDispatch(false);
size_t dispatchSize = submitSize + directSubmission.getSizeDispatch(false, false);
EXPECT_EQ(dispatchSize, directSubmission.ringCommandStream.getUsed());
EXPECT_TRUE(directSubmission.ringStart);
@@ -639,9 +654,17 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DirectSubmissionDispatchBufferTest,
if (directSubmission.miMemFenceRequired) {
submitSize += directSubmission.getSizeSystemMemoryFenceAddress();
}
size_t expectedAllocationsCount = 4;
if (directSubmission.isRelaxedOrderingEnabled()) {
expectedAllocationsCount += 2;
submitSize += RelaxedOrderingHelper::getSizeRegistersInit<FamilyType>();
}
EXPECT_EQ(submitSize, directSubmission.submitSize);
EXPECT_EQ(1u, directSubmission.handleResidencyCount);
EXPECT_EQ(4u, directSubmission.makeResourcesResidentVectorSize);
EXPECT_EQ(expectedAllocationsCount, directSubmission.makeResourcesResidentVectorSize);
uint32_t expectedOffset = NEO::ImplicitScalingDispatch<FamilyType>::getPostSyncOffset();
EXPECT_EQ(expectedOffset, directSubmission.postSyncOffset);
@@ -1865,7 +1888,7 @@ HWTEST_F(DirectSubmissionRelaxedOrderingTests, givenNotEnoughSpaceForTaskStoreSe
directSubmission.ringCommandStream.getUsed();
auto sizeToConsume = directSubmission.ringCommandStream.getAvailableSpace() -
(directSubmission.getSizeDispatch(false) + directSubmission.getSizeEnd(false) + directSubmission.getSizeSwitchRingBufferSection());
(directSubmission.getSizeDispatch(false, false) + directSubmission.getSizeEnd(false) + directSubmission.getSizeSwitchRingBufferSection());
directSubmission.ringCommandStream.getSpace(sizeToConsume);
@@ -2105,6 +2128,35 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, WhenStoppingRingWithoutSubmissio
EXPECT_FALSE(success);
}
HWTEST_F(DirectSubmissionRelaxedOrderingTests, givenDebugFlagSetWhenAskingForRelaxedOrderingSupportThenEnable) {
auto ultCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(pDevice->getDefaultEngine().commandStreamReceiver);
auto &hwHelper = HwHelperHw<FamilyType>::get();
{
DebugManager.flags.DirectSubmissionRelaxedOrdering.set(-1);
MockDirectSubmissionHw<FamilyType, BlitterDispatcher<FamilyType>> directSubmission(*ultCsr);
EXPECT_EQ(hwHelper.isRelaxedOrderingSupported(), directSubmission.isRelaxedOrderingEnabled());
}
{
DebugManager.flags.DirectSubmissionRelaxedOrdering.set(0);
MockDirectSubmissionHw<FamilyType, BlitterDispatcher<FamilyType>> directSubmission(*ultCsr);
EXPECT_FALSE(directSubmission.isRelaxedOrderingEnabled());
}
{
DebugManager.flags.DirectSubmissionRelaxedOrdering.set(1);
MockDirectSubmissionHw<FamilyType, BlitterDispatcher<FamilyType>> directSubmission(*ultCsr);
EXPECT_TRUE(directSubmission.isRelaxedOrderingEnabled());
}
}
HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenDebugFlagSetWhenCreatingBcsDispatcherThenEnableRelaxedOrdering, IsAtLeastXeHpcCore) {
std::unique_ptr<OsContext> osContext(OsContext::create(pDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), pDevice->getRootDeviceIndex(), 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_BCS, EngineUsage::Regular},
@@ -2700,4 +2752,13 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenSchedulerRequiredWhenDispat
EXPECT_TRUE(verifyLri<FamilyType>(++lriCmd, CS_GPR_R3, static_cast<uint32_t>(returnPtr2 & 0xFFFF'FFFFULL)));
EXPECT_TRUE(verifyLri<FamilyType>(++lriCmd, CS_GPR_R3 + 4, static_cast<uint32_t>(returnPtr2 >> 32)));
}
HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenReturnPtrsRequiredWhenAskingForDispatchSizeTheAddMmioSizes, IsAtLeastXeHpcCore) {
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
size_t baseSize = directSubmission.getSizeDispatch(true, false);
size_t sizeWitfRetPtr = directSubmission.getSizeDispatch(true, true);
EXPECT_EQ(baseSize + RelaxedOrderingHelper::getSizeReturnPtrRegs<FamilyType>(), sizeWitfRetPtr);
}

View File

@@ -59,8 +59,13 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenDirectIsInitializedAndStartedThe
EXPECT_NE(nullptr, wddmDirectSubmission->ringBuffers[1].ringBuffer);
EXPECT_NE(nullptr, wddmDirectSubmission->semaphores);
size_t expectedAllocationsCnt = 3;
if (HwHelperHw<FamilyType>::get().isRelaxedOrderingSupported()) {
expectedAllocationsCnt += 2;
}
EXPECT_EQ(1u, wddm->makeResidentResult.called);
EXPECT_EQ(3u, wddm->makeResidentResult.handleCount);
EXPECT_EQ(expectedAllocationsCnt, wddm->makeResidentResult.handleCount);
EXPECT_EQ(1u, wddmMockInterface->createMonitoredFenceCalled);
@@ -90,8 +95,13 @@ HWTEST_F(WddmDirectSubmissionNoPreemptionTest, givenWddmWhenDirectIsInitializedA
EXPECT_NE(nullptr, wddmDirectSubmission->ringBuffers[1].ringBuffer);
EXPECT_NE(nullptr, wddmDirectSubmission->semaphores);
size_t expectedAllocationsCnt = 3;
if (HwHelperHw<FamilyType>::get().isRelaxedOrderingSupported()) {
expectedAllocationsCnt += 2;
}
EXPECT_EQ(1u, wddm->makeResidentResult.called);
EXPECT_EQ(3u, wddm->makeResidentResult.handleCount);
EXPECT_EQ(expectedAllocationsCnt, wddm->makeResidentResult.handleCount);
EXPECT_EQ(1u, wddmMockInterface->createMonitoredFenceCalled);
@@ -128,9 +138,14 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenAllocateOsResourcesThenExpectRin
bool ret = wddmDirectSubmission.allocateResources();
EXPECT_TRUE(ret);
size_t expectedAllocationsCnt = 3;
if (HwHelperHw<FamilyType>::get().isRelaxedOrderingSupported()) {
expectedAllocationsCnt += 2;
}
EXPECT_EQ(1u, wddmMockInterface->createMonitoredFenceCalled);
EXPECT_EQ(1u, wddm->makeResidentResult.called);
EXPECT_EQ(3u, wddm->makeResidentResult.handleCount);
EXPECT_EQ(expectedAllocationsCnt, wddm->makeResidentResult.handleCount);
}
HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenAllocateOsResourcesFenceCreationFailsThenExpectRingMonitorFenceNotCreatedAndAllocationsNotResident) {
@@ -167,10 +182,15 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenAllocateOsResourcesResidencyFail
bool ret = wddmDirectSubmission.allocateResources();
EXPECT_FALSE(ret);
size_t expectedAllocationsCnt = 3;
if (HwHelperHw<FamilyType>::get().isRelaxedOrderingSupported()) {
expectedAllocationsCnt += 2;
}
EXPECT_EQ(0u, wddmMockInterface->createMonitoredFenceCalled);
//expect 2 makeResident calls, due to fail on 1st and then retry (which also fails)
EXPECT_EQ(2u, wddm->makeResidentResult.called);
EXPECT_EQ(3u, wddm->makeResidentResult.handleCount);
EXPECT_EQ(expectedAllocationsCnt, wddm->makeResidentResult.handleCount);
}
HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenGettingTagDataThenExpectContextMonitorFence) {

View File

@@ -1332,6 +1332,11 @@ HWTEST_F(HwHelperTest, givenHwHelperWhenPassingComputeEngineTypeThenItsNotCopyOn
EXPECT_FALSE(EngineHelper::isCopyOnlyEngineType(EngineGroupType::Compute));
}
HWTEST_F(HwHelperTest, givenHwHelperWhenAskingForRelaxedOrderingSupportThenReturnFalse) {
const auto &hwHelper = HwHelper::get(renderCoreFamily);
EXPECT_FALSE(hwHelper.isRelaxedOrderingSupported());
}
HWTEST2_F(HwHelperTest, givenHwHelperWhenCallCopyThroughLockedPtrEnabledThenReturnFalse, IsNotXeHpgOrXeHpcCore) {
HwHelper &hwHelper = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
EXPECT_FALSE(hwHelper.copyThroughLockedPtrEnabled(*defaultHwInfo));

View File

@@ -7,6 +7,7 @@
#include "shared/source/command_stream/command_stream_receiver_with_aub_dump.h"
#include "shared/source/command_stream/preemption.h"
#include "shared/source/direct_submission/relaxed_ordering_helper.h"
#include "shared/source/helpers/windows/gmm_callbacks.h"
#include "shared/source/memory_manager/internal_allocation_storage.h"
#include "shared/source/os_interface/sys_calls_common.h"
@@ -1149,11 +1150,14 @@ HWTEST_TEMPLATED_F(WddmCommandStreamMockGdiTest, givenDirectSubmissionEnabledOnR
size_t actualDispatchSize = directSubmission->ringCommandStream.getUsed();
size_t expectedSize = directSubmission->getSizeSemaphoreSection(false) +
Dispatcher::getSizePreemption() +
directSubmission->getSizeDispatch(false);
directSubmission->getSizeDispatch(false, false);
if (directSubmission->miMemFenceRequired) {
expectedSize += directSubmission->getSizeSystemMemoryFenceAddress();
}
if (directSubmission->isRelaxedOrderingEnabled()) {
expectedSize += RelaxedOrderingHelper::getSizeRegistersInit<FamilyType>();
}
EXPECT_EQ(expectedSize, actualDispatchSize);
memoryManager->freeGraphicsMemory(commandBuffer);
@@ -1190,11 +1194,14 @@ HWTEST_TEMPLATED_F(WddmCommandStreamMockGdiTest, givenDirectSubmissionEnabledOnB
size_t actualDispatchSize = directSubmission->ringCommandStream.getUsed();
size_t expectedSize = directSubmission->getSizeSemaphoreSection(false) +
Dispatcher::getSizePreemption() +
directSubmission->getSizeDispatch(false);
directSubmission->getSizeDispatch(false, false);
if (directSubmission->miMemFenceRequired) {
expectedSize += directSubmission->getSizeSystemMemoryFenceAddress();
}
if (directSubmission->isRelaxedOrderingEnabled()) {
expectedSize += RelaxedOrderingHelper::getSizeRegistersInit<FamilyType>();
}
EXPECT_EQ(expectedSize, actualDispatchSize);
memoryManager->freeGraphicsMemory(commandBuffer);

View File

@@ -89,3 +89,11 @@ XE_HPC_CORETEST_F(HwHelperTest, givenHwHelperWhenCallGetAmountOfAllocationsToFil
auto &hwHelper = HwHelperHw<FamilyType>::get();
EXPECT_EQ(hwHelper.getAmountOfAllocationsToFill(), 1u);
}
HWTEST_EXCLUDE_PRODUCT(HwHelperTest, givenHwHelperWhenAskingForRelaxedOrderingSupportThenReturnFalse, IGFX_XE_HPC_CORE);
XE_HPC_CORETEST_F(HwHelperTest, givenHwHelperWhenAskingForRelaxedOrderingSupportThenReturnTrue) {
auto &hwHelper = HwHelperHw<FamilyType>::get();
EXPECT_TRUE(hwHelper.isRelaxedOrderingSupported());
}