fix: dont program NP state in ULLS if heapless state init is enabled

Related-To: HSD-13012223827

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski 2024-09-11 18:42:55 +00:00 committed by Compute-Runtime-Automation
parent 4f2e61841f
commit ddce122991
2 changed files with 22 additions and 6 deletions

View File

@ -18,6 +18,7 @@
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/gmm_lib.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/compiler_product_helper.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/flush_stamp.h"
#include "shared/source/helpers/gfx_core_helper.h"
@ -48,6 +49,7 @@ DirectSubmissionHw<GfxFamily, Dispatcher>::DirectSubmissionHw(const DirectSubmis
memoryOperationHandler = inputParams.rootDeviceEnvironment.memoryOperationsInterface.get();
auto &productHelper = inputParams.rootDeviceEnvironment.getHelper<ProductHelper>();
auto &compilerProductHelper = inputParams.rootDeviceEnvironment.getHelper<CompilerProductHelper>();
disableCacheFlush = UllsDefaults::defaultDisableCacheFlush;
disableMonitorFence = UllsDefaults::defaultDisableMonitorFence;
@ -76,6 +78,11 @@ DirectSubmissionHw<GfxFamily, Dispatcher>::DirectSubmissionHw(const DirectSubmis
if (debugManager.flags.DirectSubmissionInsertExtraMiMemFenceCommands.get() != -1) {
miMemFenceRequired = debugManager.flags.DirectSubmissionInsertExtraMiMemFenceCommands.get();
}
if (miMemFenceRequired && compilerProductHelper.isHeaplessStateInitEnabled(compilerProductHelper.isHeaplessModeEnabled())) {
this->systemMemoryFenceAddressSet = true;
}
if (debugManager.flags.DirectSubmissionInsertSfenceInstructionPriorToSubmission.get() != -1) {
sfenceMode = static_cast<DirectSubmissionSfenceMode>(debugManager.flags.DirectSubmissionInsertSfenceInstructionPriorToSubmission.get());
}
@ -477,7 +484,7 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::initialize(bool submitOnInit, bo
this->partitionConfigSet = true;
}
if (this->miMemFenceRequired) {
if (this->miMemFenceRequired && !this->systemMemoryFenceAddressSet) {
startBufferSize += getSizeSystemMemoryFenceAddress();
dispatchSystemMemoryFenceAddress();

View File

@ -14,6 +14,7 @@
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/gmm_lib.h"
#include "shared/source/helpers/blit_commands_helper.h"
#include "shared/source/helpers/compiler_product_helper.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/flush_stamp.h"
#include "shared/source/helpers/gfx_core_helper.h"
@ -48,6 +49,9 @@ struct DirectSubmissionDispatchMiMemFenceTest : public DirectSubmissionDispatchB
auto &productHelper = pDevice->getProductHelper();
miMemFenceSupported = pDevice->getHardwareInfo().capabilityTable.isIntegratedDevice ? false : productHelper.isGlobalFenceInDirectSubmissionRequired(pDevice->getHardwareInfo());
auto &compilerProductHelper = pDevice->getCompilerProductHelper();
heaplessStateInit = compilerProductHelper.isHeaplessStateInitEnabled(compilerProductHelper.isHeaplessModeEnabled());
}
template <typename FamilyType>
@ -111,35 +115,40 @@ struct DirectSubmissionDispatchMiMemFenceTest : public DirectSubmissionDispatchB
}
bool miMemFenceSupported = false;
bool heaplessStateInit = false;
};
HWTEST_F(DirectSubmissionDispatchMiMemFenceTest, givenMiMemFenceSupportedWhenInitializingDirectSubmissionThenEnableMiMemFenceProgramming) {
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
uint32_t expectedSysMemFenceAddress = heaplessStateInit ? 0 : 1;
EXPECT_EQ(miMemFenceSupported, directSubmission.miMemFenceRequired);
EXPECT_FALSE(directSubmission.systemMemoryFenceAddressSet);
EXPECT_EQ(heaplessStateInit && miMemFenceSupported, directSubmission.systemMemoryFenceAddressSet);
EXPECT_TRUE(directSubmission.initialize(true, false));
EXPECT_EQ(miMemFenceSupported, directSubmission.systemMemoryFenceAddressSet);
validateFenceProgramming<FamilyType>(directSubmission, 1, 1);
validateFenceProgramming<FamilyType>(directSubmission, 1, expectedSysMemFenceAddress);
}
HWTEST_F(DirectSubmissionDispatchMiMemFenceTest, givenMiMemFenceSupportedWhenDispatchingWithoutInitThenEnableMiMemFenceProgramming) {
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
FlushStampTracker flushStamp(true);
uint32_t expectedSysMemFenceAddress = heaplessStateInit ? 0 : 1;
EXPECT_EQ(miMemFenceSupported, directSubmission.miMemFenceRequired);
EXPECT_FALSE(directSubmission.systemMemoryFenceAddressSet);
EXPECT_EQ(heaplessStateInit && miMemFenceSupported, directSubmission.systemMemoryFenceAddressSet);
EXPECT_TRUE(directSubmission.initialize(false, false));
EXPECT_FALSE(directSubmission.systemMemoryFenceAddressSet);
EXPECT_EQ(heaplessStateInit && miMemFenceSupported, directSubmission.systemMemoryFenceAddressSet);
EXPECT_TRUE(directSubmission.dispatchCommandBuffer(batchBuffer, flushStamp));
validateFenceProgramming<FamilyType>(directSubmission, 1, 1);
validateFenceProgramming<FamilyType>(directSubmission, 1, expectedSysMemFenceAddress);
EXPECT_EQ(miMemFenceSupported, directSubmission.systemMemoryFenceAddressSet);
}