From 76c730bee8b97e575587aaff0b841a481f9f3f1c Mon Sep 17 00:00:00 2001 From: Bartosz Dunajski Date: Tue, 7 Dec 2021 11:46:24 +0000 Subject: [PATCH] Add new Stream Property fields Signed-off-by: Bartosz Dunajski --- .../definitions/stream_properties.inl | 2 + .../command_stream/stream_properties.cpp | 14 ++++++- .../stream_properties_tests.cpp | 15 +------ .../stream_properties_tests_common.cpp | 39 ++++++++++++++++--- 4 files changed, 50 insertions(+), 20 deletions(-) diff --git a/shared/source/command_stream/definitions/stream_properties.inl b/shared/source/command_stream/definitions/stream_properties.inl index 2286cd885e..985bc07fbd 100644 --- a/shared/source/command_stream/definitions/stream_properties.inl +++ b/shared/source/command_stream/definitions/stream_properties.inl @@ -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); diff --git a/shared/source/command_stream/stream_properties.cpp b/shared/source/command_stream/stream_properties.cpp index be712f2e23..aa1944efa8 100644 --- a/shared/source/command_stream/stream_properties.cpp +++ b/shared/source/command_stream/stream_properties.cpp @@ -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(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; } diff --git a/shared/test/unit_test/command_stream/stream_properties_tests.cpp b/shared/test/unit_test/command_stream/stream_properties_tests.cpp index d1903cf080..7733ff5563 100644 --- a/shared/test/unit_test/command_stream/stream_properties_tests.cpp +++ b/shared/test/unit_test/command_stream/stream_properties_tests.cpp @@ -19,6 +19,7 @@ std::vector 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 getAllFrontEndProperties(FrontEndProperties &prope std::vector 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); - } - } -} diff --git a/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp b/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp index ec33c0ccf9..6f3179b029 100644 --- a/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp +++ b/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp @@ -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(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(properties.stateComputeMode.threadArbitrationPolicy.value)); + } } template