Add new Stream Property fields

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2021-12-07 11:46:24 +00:00
committed by Compute-Runtime-Automation
parent 0c49fa8203
commit 76c730bee8
4 changed files with 50 additions and 20 deletions

View File

@ -14,6 +14,7 @@ struct StateComputeModeProperties {
StreamProperty largeGrfMode{};
StreamProperty zPassAsyncComputeThreadLimit{};
StreamProperty pixelAsyncComputeThreadLimit{};
StreamProperty threadArbitrationPolicy{};
void setProperties(bool requiresCoherency, uint32_t numGrfRequired, uint32_t threadArbitrationPolicy);
void setProperties(const StateComputeModeProperties &properties);
@ -24,6 +25,7 @@ struct StateComputeModeProperties {
struct FrontEndProperties {
StreamProperty disableOverdispatch{};
StreamProperty singleSliceDispatchCcsMode{};
StreamProperty computeDispatchAllWalkerEnable{};
void setProperties(bool isCooperativeKernel, bool disableOverdispatch, int32_t engineInstancedDevice, const HardwareInfo &hwInfo);
void setProperties(const FrontEndProperties &properties);

View File

@ -31,6 +31,11 @@ void StateComputeModeProperties::setProperties(bool requiresCoherency, uint32_t
pixelAsyncComputeThreadLimit = DebugManager.flags.ForcePixelAsyncComputeThreadLimit.get();
}
this->pixelAsyncComputeThreadLimit.set(pixelAsyncComputeThreadLimit);
if (DebugManager.flags.OverrideThreadArbitrationPolicy.get() != -1) {
threadArbitrationPolicy = static_cast<uint32_t>(DebugManager.flags.OverrideThreadArbitrationPolicy.get());
}
this->threadArbitrationPolicy.set(threadArbitrationPolicy);
}
void StateComputeModeProperties::setProperties(const StateComputeModeProperties &properties) {
@ -40,11 +45,12 @@ void StateComputeModeProperties::setProperties(const StateComputeModeProperties
largeGrfMode.set(properties.largeGrfMode.value);
zPassAsyncComputeThreadLimit.set(properties.zPassAsyncComputeThreadLimit.value);
pixelAsyncComputeThreadLimit.set(properties.pixelAsyncComputeThreadLimit.value);
threadArbitrationPolicy.set(properties.threadArbitrationPolicy.value);
}
bool StateComputeModeProperties::isDirty() {
return isCoherencyRequired.isDirty || largeGrfMode.isDirty || zPassAsyncComputeThreadLimit.isDirty ||
pixelAsyncComputeThreadLimit.isDirty;
pixelAsyncComputeThreadLimit.isDirty || threadArbitrationPolicy.isDirty;
}
void StateComputeModeProperties::clearIsDirty() {
@ -52,12 +58,14 @@ void StateComputeModeProperties::clearIsDirty() {
largeGrfMode.isDirty = false;
zPassAsyncComputeThreadLimit.isDirty = false;
pixelAsyncComputeThreadLimit.isDirty = false;
threadArbitrationPolicy.isDirty = false;
}
void FrontEndProperties::setProperties(bool isCooperativeKernel, bool disableOverdispatch, int32_t engineInstancedDevice,
const HardwareInfo &hwInfo) {
clearIsDirty();
this->computeDispatchAllWalkerEnable.set(isCooperativeKernel);
this->disableOverdispatch.set(disableOverdispatch);
this->singleSliceDispatchCcsMode.set(engineInstancedDevice);
}
@ -67,13 +75,15 @@ void FrontEndProperties::setProperties(const FrontEndProperties &properties) {
disableOverdispatch.set(properties.disableOverdispatch.value);
singleSliceDispatchCcsMode.set(properties.singleSliceDispatchCcsMode.value);
computeDispatchAllWalkerEnable.set(properties.computeDispatchAllWalkerEnable.value);
}
bool FrontEndProperties::isDirty() {
return disableOverdispatch.isDirty || singleSliceDispatchCcsMode.isDirty;
return disableOverdispatch.isDirty || singleSliceDispatchCcsMode.isDirty || computeDispatchAllWalkerEnable.isDirty;
}
void FrontEndProperties::clearIsDirty() {
disableOverdispatch.isDirty = false;
singleSliceDispatchCcsMode.isDirty = false;
computeDispatchAllWalkerEnable.isDirty = false;
}

View File

@ -19,6 +19,7 @@ std::vector<StreamProperty *> getAllStateComputeModeProperties(StateComputeModeP
allProperties.push_back(&properties.largeGrfMode);
allProperties.push_back(&properties.zPassAsyncComputeThreadLimit);
allProperties.push_back(&properties.pixelAsyncComputeThreadLimit);
allProperties.push_back(&properties.threadArbitrationPolicy);
return allProperties;
}
@ -26,20 +27,8 @@ std::vector<StreamProperty *> getAllFrontEndProperties(FrontEndProperties &prope
std::vector<StreamProperty *> allProperties;
allProperties.push_back(&properties.disableOverdispatch);
allProperties.push_back(&properties.singleSliceDispatchCcsMode);
allProperties.push_back(&properties.computeDispatchAllWalkerEnable);
return allProperties;
}
} // namespace NEO
using namespace NEO;
TEST(StreamPropertiesTests, whenSettingCooperativeKernelPropertiesThenCorrectValueIsSet) {
StreamProperties properties;
for (auto isEngineInstanced : ::testing::Bool()) {
for (auto disableOverdispatch : ::testing::Bool()) {
properties.frontEndState.setProperties(false, disableOverdispatch, isEngineInstanced, *defaultHwInfo);
EXPECT_EQ(disableOverdispatch, properties.frontEndState.disableOverdispatch.value);
EXPECT_EQ(isEngineInstanced, properties.frontEndState.singleSliceDispatchCcsMode.value);
}
}
}

View File

@ -9,6 +9,7 @@
#include "shared/source/command_stream/stream_properties.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "test.h"
@ -41,16 +42,38 @@ TEST(StreamPropertiesTests, whenPropertyValueIsChangedThenProperStateIsSet) {
}
}
TEST(StreamPropertiesTests, whenSettingCooperativeKernelPropertiesThenCorrectValueIsSet) {
StreamProperties properties;
for (auto isEngineInstanced : ::testing::Bool()) {
for (auto isCooperativeKernel : ::testing::Bool()) {
for (auto disableOverdispatch : ::testing::Bool()) {
properties.frontEndState.setProperties(isCooperativeKernel, disableOverdispatch, isEngineInstanced, *defaultHwInfo);
EXPECT_EQ(isCooperativeKernel, properties.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(disableOverdispatch, properties.frontEndState.disableOverdispatch.value);
EXPECT_EQ(isEngineInstanced, properties.frontEndState.singleSliceDispatchCcsMode.value);
}
}
}
}
TEST(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrectValuesAreSet) {
DebugManagerStateRestore restorer;
uint32_t threadArbitrationPolicyValues[] = {
ThreadArbitrationPolicy::AgeBased, ThreadArbitrationPolicy::RoundRobin,
ThreadArbitrationPolicy::RoundRobinAfterDependency, ThreadArbitrationPolicy::NotPresent};
StreamProperties properties;
for (auto requiresCoherency : ::testing::Bool()) {
for (auto largeGrf : ::testing::Bool()) {
properties.stateComputeMode.setProperties(requiresCoherency, largeGrf ? 256 : 128, 0u);
EXPECT_EQ(largeGrf, properties.stateComputeMode.largeGrfMode.value);
EXPECT_EQ(requiresCoherency, properties.stateComputeMode.isCoherencyRequired.value);
EXPECT_EQ(-1, properties.stateComputeMode.zPassAsyncComputeThreadLimit.value);
EXPECT_EQ(-1, properties.stateComputeMode.pixelAsyncComputeThreadLimit.value);
for (auto threadArbitrationPolicy : threadArbitrationPolicyValues) {
properties.stateComputeMode.setProperties(requiresCoherency, largeGrf ? 256 : 128, threadArbitrationPolicy);
EXPECT_EQ(largeGrf, properties.stateComputeMode.largeGrfMode.value);
EXPECT_EQ(requiresCoherency, properties.stateComputeMode.isCoherencyRequired.value);
EXPECT_EQ(-1, properties.stateComputeMode.zPassAsyncComputeThreadLimit.value);
EXPECT_EQ(-1, properties.stateComputeMode.pixelAsyncComputeThreadLimit.value);
EXPECT_EQ(threadArbitrationPolicy, static_cast<uint32_t>(properties.stateComputeMode.threadArbitrationPolicy.value));
}
}
}
@ -65,6 +88,12 @@ TEST(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrectValu
properties.stateComputeMode.setProperties(false, 0u, 0u);
EXPECT_EQ(forcePixelAsyncComputeThreadLimit, properties.stateComputeMode.pixelAsyncComputeThreadLimit.value);
}
for (auto threadArbitrationPolicy : threadArbitrationPolicyValues) {
DebugManager.flags.OverrideThreadArbitrationPolicy.set(threadArbitrationPolicy);
properties.stateComputeMode.setProperties(false, 0u, 0u);
EXPECT_EQ(threadArbitrationPolicy, static_cast<uint32_t>(properties.stateComputeMode.threadArbitrationPolicy.value));
}
}
template <typename PropertiesT>