Debug flag to control MI_ARB_CHECK prefetcher

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2022-03-09 15:17:47 +00:00
committed by Compute-Runtime-Automation
parent 41c51df086
commit e24322f266
12 changed files with 95 additions and 4 deletions

View File

@@ -398,3 +398,4 @@ OverridePatIndex = -1
UseTileMemoryBankInVirtualMemoryCreation = -1
DisableScratchPages = 0
ForceAllResourcesUncached = 0
ForcePreParserEnabledForMiArbCheck = -1

View File

@@ -378,6 +378,7 @@ struct EncodeMiArbCheck {
using MI_ARB_CHECK = typename GfxFamily::MI_ARB_CHECK;
static void program(LinearStream &commandStream);
static void adjust(MI_ARB_CHECK &miArbCheck);
static size_t getCommandSize();
};

View File

@@ -798,8 +798,12 @@ inline size_t EncodeMemoryPrefetch<Family>::getSizeForMemoryPrefetch(size_t size
template <typename Family>
void EncodeMiArbCheck<Family>::program(LinearStream &commandStream) {
MI_ARB_CHECK cmd = Family::cmdInitArbCheck;
EncodeMiArbCheck<Family>::adjust(cmd);
auto miArbCheckStream = commandStream.getSpaceForCmd<MI_ARB_CHECK>();
*miArbCheckStream = Family::cmdInitArbCheck;
*miArbCheckStream = cmd;
}
template <typename Family>

View File

@@ -472,4 +472,8 @@ inline void EncodeStoreMemory<Family>::programStoreDataImm(MI_STORE_DATA_IMM *cm
*cmdBuffer = storeDataImmediate;
}
template <typename Family>
inline void EncodeMiArbCheck<Family>::adjust(MI_ARB_CHECK &miArbCheck) {
}
} // namespace NEO

View File

@@ -672,4 +672,11 @@ inline void EncodeStoreMemory<Family>::programStoreDataImm(MI_STORE_DATA_IMM *cm
*cmdBuffer = storeDataImmediate;
}
template <typename Family>
inline void EncodeMiArbCheck<Family>::adjust(MI_ARB_CHECK &miArbCheck) {
if (DebugManager.flags.ForcePreParserEnabledForMiArbCheck.get() != -1) {
miArbCheck.setPreParserDisable(!DebugManager.flags.ForcePreParserEnabledForMiArbCheck.get());
}
}
} // namespace NEO

View File

@@ -194,6 +194,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, AccessCountersGranularity, -1, "-1: default - AC
DECLARE_DEBUG_VARIABLE(int32_t, OverridePatIndex, -1, "-1: default, >=0: PatIndex to override")
DECLARE_DEBUG_VARIABLE(int32_t, UseTileMemoryBankInVirtualMemoryCreation, -1, "-1: default - on, 0: do not assign tile memory bank to virtual memory space, 1: assign tile memory bank to virtual memory space")
DECLARE_DEBUG_VARIABLE(int32_t, OverrideTimestampEvents, -1, "-1: default (based on user settings), 0: Force disable timestamp events (no timestamps will be reported), 1: Force enable timestamp events")
DECLARE_DEBUG_VARIABLE(int32_t, ForcePreParserEnabledForMiArbCheck, -1, "-1: default , 0: PreParser disabled, 1: PreParser enabled")
DECLARE_DEBUG_VARIABLE(bool, DisableScratchPages, false, "Disable scratch pages during VM creations")
/*LOGGING FLAGS*/
DECLARE_DEBUG_VARIABLE(int32_t, PrintDriverDiagnostics, -1, "prints driver diagnostics messages to standard output, value corresponds to hint level")

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -15,6 +15,9 @@ inline void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchDisablePrefetcher
MI_ARB_CHECK arbCheck = GfxFamily::cmdInitArbCheck;
arbCheck.setPreParserDisable(disable);
EncodeMiArbCheck<GfxFamily>::adjust(arbCheck);
MI_ARB_CHECK *arbCheckSpace = ringCommandStream.getSpaceForCmd<MI_ARB_CHECK>();
*arbCheckSpace = arbCheck;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -15,6 +15,9 @@ inline void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchDisablePrefetcher
MI_ARB_CHECK arbCheck = GfxFamily::cmdInitArbCheck;
arbCheck.setPreFetchDisable(disable);
EncodeMiArbCheck<GfxFamily>::adjust(arbCheck);
MI_ARB_CHECK *arbCheckSpace = ringCommandStream.getSpaceForCmd<MI_ARB_CHECK>();
*arbCheckSpace = arbCheck;
}

View File

@@ -5690,6 +5690,17 @@ typedef struct tagMI_ARB_CHECK {
inline uint32_t getPreFetchDisable() const {
return TheStructure.Common.Pre_FetchDisable;
}
// patched for easier templates usage
inline void setPreParserDisable(const uint32_t value) {
setPreFetchDisable(value);
}
// patched for easier templates usage
inline uint32_t getPreParserDisable() const {
return getPreFetchDisable();
}
inline void setMaskBits(const uint32_t value) {
DEBUG_BREAK_IF(value > 0xff00);
TheStructure.Common.MaskBits = value;

View File

@@ -5761,6 +5761,17 @@ typedef struct tagMI_ARB_CHECK {
inline uint32_t getPreFetchDisable() const {
return TheStructure.Common.Pre_FetchDisable;
}
// patched for easier templates usage
inline void setPreParserDisable(const uint32_t value) {
setPreFetchDisable(value);
}
// patched for easier templates usage
inline uint32_t getPreParserDisable() const {
return getPreFetchDisable();
}
inline void setMaskBits(const uint32_t value) {
DEBUG_BREAK_IF(value > 0xff00);
TheStructure.Common.MaskBits = value;

View File

@@ -8,6 +8,7 @@
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/command_stream/linear_stream.h"
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/test_macros/test.h"
@@ -111,4 +112,25 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandEncoderTests, whenAppendParamsForImageFromBuf
EncodeSurfaceState<FamilyType>::appendParamsForImageFromBuffer(&surfaceState);
EXPECT_EQ(0, memcmp(&expectedState, &surfaceState, sizeof(surfaceState)));
}
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncoderTests, givenDebugFlagSetWhenProgrammingMiArbThenSetPreparserDisabledValue) {
DebugManagerStateRestore restore;
using MI_ARB_CHECK = typename FamilyType::MI_ARB_CHECK;
for (int32_t value : {-1, 0, 1}) {
DebugManager.flags.ForcePreParserEnabledForMiArbCheck.set(value);
MI_ARB_CHECK buffer[2] = {};
LinearStream linearStream(buffer, sizeof(buffer));
EncodeMiArbCheck<FamilyType>::program(linearStream);
if (value == 0) {
EXPECT_TRUE(buffer[0].getPreParserDisable());
} else {
EXPECT_FALSE(buffer[0].getPreParserDisable());
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -956,3 +956,26 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DirectSubmissionTest,
size_t usedSizeAfter = directSubmission.ringCommandStream.getUsed();
EXPECT_EQ(expectedSize, usedSizeAfter - usedSize);
}
HWCMDTEST_F(IGFX_XE_HP_CORE, DirectSubmissionTest, givenDebugFlagSetWhenDispatchingPrefetcherThenSetCorrectValue) {
DebugManagerStateRestore restore;
DebugManager.flags.ForcePreParserEnabledForMiArbCheck.set(1);
using MI_ARB_CHECK = typename FamilyType::MI_ARB_CHECK;
using Dispatcher = BlitterDispatcher<FamilyType>;
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice, *osContext.get());
bool ret = directSubmission.allocateResources();
EXPECT_TRUE(ret);
directSubmission.dispatchDisablePrefetcher(true);
HardwareParse hwParse;
hwParse.parseCommands<FamilyType>(directSubmission.ringCommandStream, 0);
hwParse.findHardwareCommands<FamilyType>();
MI_ARB_CHECK *arbCheck = hwParse.getCommand<MI_ARB_CHECK>();
ASSERT_NE(nullptr, arbCheck);
EXPECT_EQ(0u, arbCheck->getPreParserDisable());
}