Limit preemption programming in level zero command queues

When multiple command queues use the same context and retain the same state
No preemption programming for copy command queues
Program preemption preamble only for mid thread preemption

Related-To: NEO-7187

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2022-07-27 15:35:15 +00:00
committed by Compute-Runtime-Automation
parent 17f22990e6
commit 0c301e5e99
11 changed files with 368 additions and 94 deletions

View File

@@ -7,6 +7,7 @@
#pragma once
#include "shared/source/helpers/aux_translation.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include <cstddef>
#include <vector>
@@ -82,6 +83,10 @@ struct UnitTestHelper {
static bool timestampRegisterHighAddress();
static void validateSbaMocs(uint32_t expectedMocs, CommandStreamReceiver &csr);
static GenCmdList::iterator findMidThreadPreemptionAllocationCommand(GenCmdList::iterator begin, GenCmdList::iterator end);
static std::vector<GenCmdList::iterator> findAllMidThreadPreemptionAllocationCommand(GenCmdList::iterator begin, GenCmdList::iterator end);
};
} // namespace NEO

View File

@@ -77,4 +77,14 @@ inline bool UnitTestHelper<GfxFamily>::getWorkloadPartitionForStoreRegisterMemCm
return false;
}
template <typename GfxFamily>
GenCmdList::iterator UnitTestHelper<GfxFamily>::findMidThreadPreemptionAllocationCommand(GenCmdList::iterator begin, GenCmdList::iterator end) {
return find<typename GfxFamily::GPGPU_CSR_BASE_ADDRESS *>(begin, end);
}
template <typename GfxFamily>
std::vector<GenCmdList::iterator> UnitTestHelper<GfxFamily>::findAllMidThreadPreemptionAllocationCommand(GenCmdList::iterator begin, GenCmdList::iterator end) {
return findAll<typename GfxFamily::GPGPU_CSR_BASE_ADDRESS *>(begin, end);
}
} // namespace NEO

View File

@@ -105,4 +105,15 @@ inline bool UnitTestHelper<GfxFamily>::getWorkloadPartitionForStoreRegisterMemCm
return storeRegisterMem.getWorkloadPartitionIdOffsetEnable();
}
template <typename GfxFamily>
GenCmdList::iterator UnitTestHelper<GfxFamily>::findMidThreadPreemptionAllocationCommand(GenCmdList::iterator begin, GenCmdList::iterator end) {
return end;
}
template <typename GfxFamily>
std::vector<GenCmdList::iterator> UnitTestHelper<GfxFamily>::findAllMidThreadPreemptionAllocationCommand(GenCmdList::iterator begin, GenCmdList::iterator end) {
std::vector<GenCmdList::iterator> emptyList;
return emptyList;
}
} // namespace NEO

View File

@@ -2103,3 +2103,11 @@ TEST_F(CommandStreamReceiverTest, givenPreambleFlagIsSetWhenGettingFlagStateThen
commandStreamReceiver->setPreambleSetFlag(true);
EXPECT_TRUE(commandStreamReceiver->getPreambleSetFlag());
}
TEST_F(CommandStreamReceiverTest, givenPreemptionSentIsInitialWhenSettingPreemptionToNewModeThenExpectCorrectPreemption) {
PreemptionMode mode = PreemptionMode::Initial;
EXPECT_EQ(mode, commandStreamReceiver->getPreemptionMode());
mode = PreemptionMode::ThreadGroup;
commandStreamReceiver->setPreemptionMode(mode);
EXPECT_EQ(mode, commandStreamReceiver->getPreemptionMode());
}