From 9ccecb5a35e966f44a1782765dfd50df59a0da83 Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Tue, 31 Dec 2024 11:26:51 +0000 Subject: [PATCH] feature: add enableVariableRegisterSizeAllocation to StateComputeModeProperties Related-To: NEO-12803 Signed-off-by: Mateusz Jablonski --- .../definitions/stream_properties.inl | 2 ++ .../command_stream/stream_properties.cpp | 18 ++++++++++++++++-- .../command_stream/stream_properties_tests.cpp | 1 + .../stream_properties_tests_common.cpp | 4 ++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/shared/source/command_stream/definitions/stream_properties.inl b/shared/source/command_stream/definitions/stream_properties.inl index e7a9ec119a..296e5a386f 100644 --- a/shared/source/command_stream/definitions/stream_properties.inl +++ b/shared/source/command_stream/definitions/stream_properties.inl @@ -20,6 +20,7 @@ struct StateComputeModePropertiesSupport { bool threadArbitrationPolicy = false; bool devicePreemptionMode = false; bool allocationForScratchAndMidthreadPreemption = false; + bool enableVariableRegisterSizeAllocation = false; }; struct StateComputeModeProperties { @@ -30,6 +31,7 @@ struct StateComputeModeProperties { StreamProperty threadArbitrationPolicy{}; StreamProperty devicePreemptionMode{}; StreamProperty memoryAllocationForScratchAndMidthreadPreemptionBuffers{}; + StreamProperty enableVariableRegisterSizeAllocation{}; void initSupport(const RootDeviceEnvironment &rootDeviceEnvironment); void resetState(); diff --git a/shared/source/command_stream/stream_properties.cpp b/shared/source/command_stream/stream_properties.cpp index 95e6983361..b3416597b8 100644 --- a/shared/source/command_stream/stream_properties.cpp +++ b/shared/source/command_stream/stream_properties.cpp @@ -48,6 +48,9 @@ void StateComputeModeProperties::setPropertiesAll(bool requiresCoherency, uint32 if (this->scmPropertiesSupport.allocationForScratchAndMidthreadPreemption) { this->memoryAllocationForScratchAndMidthreadPreemptionBuffers.set(memoryAllocationForScratchAndMidthreadPreemptionBuffers); } + if (this->scmPropertiesSupport.enableVariableRegisterSizeAllocation) { + this->enableVariableRegisterSizeAllocation.set(this->scmPropertiesSupport.enableVariableRegisterSizeAllocation); + } setPropertiesExtraPerContext(); } @@ -62,6 +65,7 @@ void StateComputeModeProperties::copyPropertiesAll(const StateComputeModePropert threadArbitrationPolicy.set(properties.threadArbitrationPolicy.value); devicePreemptionMode.set(properties.devicePreemptionMode.value); memoryAllocationForScratchAndMidthreadPreemptionBuffers.set(properties.memoryAllocationForScratchAndMidthreadPreemptionBuffers.value); + enableVariableRegisterSizeAllocation.set(properties.enableVariableRegisterSizeAllocation.value); copyPropertiesExtra(properties); } @@ -77,8 +81,15 @@ void StateComputeModeProperties::copyPropertiesGrfNumberThreadArbitration(const } bool StateComputeModeProperties::isDirty() const { - return isCoherencyRequired.isDirty || largeGrfMode.isDirty || zPassAsyncComputeThreadLimit.isDirty || - pixelAsyncComputeThreadLimit.isDirty || threadArbitrationPolicy.isDirty || devicePreemptionMode.isDirty || memoryAllocationForScratchAndMidthreadPreemptionBuffers.isDirty || isDirtyExtra(); + return isCoherencyRequired.isDirty || + largeGrfMode.isDirty || + zPassAsyncComputeThreadLimit.isDirty || + pixelAsyncComputeThreadLimit.isDirty || + threadArbitrationPolicy.isDirty || + devicePreemptionMode.isDirty || + memoryAllocationForScratchAndMidthreadPreemptionBuffers.isDirty || + enableVariableRegisterSizeAllocation.isDirty || + isDirtyExtra(); } void StateComputeModeProperties::clearIsDirty() { @@ -89,6 +100,7 @@ void StateComputeModeProperties::clearIsDirty() { threadArbitrationPolicy.isDirty = false; devicePreemptionMode.isDirty = false; memoryAllocationForScratchAndMidthreadPreemptionBuffers.isDirty = false; + enableVariableRegisterSizeAllocation.isDirty = false; clearIsDirtyExtraPerContext(); } @@ -149,6 +161,8 @@ void StateComputeModeProperties::resetState() { this->threadArbitrationPolicy.value = StreamProperty::initValue; this->devicePreemptionMode.value = StreamProperty::initValue; this->memoryAllocationForScratchAndMidthreadPreemptionBuffers.value = StreamProperty::initValue; + this->enableVariableRegisterSizeAllocation.value = StreamProperty::initValue; + resetStateExtra(); } 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 21d478959e..1443452f64 100644 --- a/shared/test/unit_test/command_stream/stream_properties_tests.cpp +++ b/shared/test/unit_test/command_stream/stream_properties_tests.cpp @@ -20,6 +20,7 @@ std::vector getAllStateComputeModeProperties(StateComputeModeP allProperties.push_back(&properties.pixelAsyncComputeThreadLimit); allProperties.push_back(&properties.threadArbitrationPolicy); allProperties.push_back(&properties.memoryAllocationForScratchAndMidthreadPreemptionBuffers); + allProperties.push_back(&properties.enableVariableRegisterSizeAllocation); return allProperties; } 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 afc2bd689a..3238750e11 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 @@ -404,6 +404,7 @@ TEST(StreamPropertiesTests, givenSetAllStateComputeModePropertiesWhenResettingSt scmProperties.scmPropertiesSupport.threadArbitrationPolicy = true; scmProperties.scmPropertiesSupport.devicePreemptionMode = true; scmProperties.scmPropertiesSupport.allocationForScratchAndMidthreadPreemption = true; + scmProperties.scmPropertiesSupport.enableVariableRegisterSizeAllocation = true; int32_t grfNumber = 128; int32_t threadArbitration = 1; @@ -416,6 +417,7 @@ TEST(StreamPropertiesTests, givenSetAllStateComputeModePropertiesWhenResettingSt EXPECT_EQ(0, scmProperties.isCoherencyRequired.value); EXPECT_EQ(static_cast(devicePreemptionMode), scmProperties.devicePreemptionMode.value); EXPECT_EQ(2, scmProperties.memoryAllocationForScratchAndMidthreadPreemptionBuffers.value); + EXPECT_EQ(1, scmProperties.enableVariableRegisterSizeAllocation.value); scmProperties.resetState(); EXPECT_FALSE(scmProperties.isDirty()); @@ -424,6 +426,7 @@ TEST(StreamPropertiesTests, givenSetAllStateComputeModePropertiesWhenResettingSt EXPECT_EQ(-1, scmProperties.isCoherencyRequired.value); EXPECT_EQ(-1, scmProperties.devicePreemptionMode.value); EXPECT_EQ(-1, scmProperties.memoryAllocationForScratchAndMidthreadPreemptionBuffers.value); + EXPECT_EQ(-1, scmProperties.enableVariableRegisterSizeAllocation.value); EXPECT_TRUE(scmProperties.propertiesSupportLoaded); EXPECT_TRUE(scmProperties.scmPropertiesSupport.coherencyRequired); @@ -431,6 +434,7 @@ TEST(StreamPropertiesTests, givenSetAllStateComputeModePropertiesWhenResettingSt EXPECT_TRUE(scmProperties.scmPropertiesSupport.threadArbitrationPolicy); EXPECT_TRUE(scmProperties.scmPropertiesSupport.devicePreemptionMode); EXPECT_TRUE(scmProperties.scmPropertiesSupport.allocationForScratchAndMidthreadPreemption); + EXPECT_TRUE(scmProperties.scmPropertiesSupport.enableVariableRegisterSizeAllocation); } TEST(StreamPropertiesTests, givenGrfNumberAndThreadArbitrationStateComputeModePropertiesWhenCopyingPropertyAndCheckIfDirtyThenExpectCorrectState) {