[perf] simplify state transition for size properties
State base address size proprties are not used to track state changes, but they are important to carry size values. Simplify state base address tracking, so they can update the value of the property, but not the dirty state. Related-To: NEO-7828 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
parent
3ff7a63145
commit
f211d97363
|
@ -349,9 +349,7 @@ void StateBaseAddressProperties::setPropertiesBindingTableSurfaceState(int64_t b
|
|||
DEBUG_BREAK_IF(!this->propertiesSupportLoaded);
|
||||
|
||||
this->bindingTablePoolBaseAddress.isDirty = false;
|
||||
this->bindingTablePoolSize.isDirty = false;
|
||||
this->surfaceStateBaseAddress.isDirty = false;
|
||||
this->surfaceStateSize.isDirty = false;
|
||||
|
||||
if (this->stateBaseAddressPropertiesSupport.bindingTablePoolBaseAddress) {
|
||||
this->bindingTablePoolBaseAddress.set(bindingTablePoolBaseAddress);
|
||||
|
@ -365,7 +363,6 @@ void StateBaseAddressProperties::setPropertiesSurfaceState(int64_t surfaceStateB
|
|||
DEBUG_BREAK_IF(!this->propertiesSupportLoaded);
|
||||
|
||||
this->surfaceStateBaseAddress.isDirty = false;
|
||||
this->surfaceStateSize.isDirty = false;
|
||||
|
||||
this->surfaceStateBaseAddress.set(surfaceStateBaseAddress);
|
||||
this->surfaceStateSize.set(surfaceStateSize);
|
||||
|
@ -373,14 +370,12 @@ void StateBaseAddressProperties::setPropertiesSurfaceState(int64_t surfaceStateB
|
|||
|
||||
void StateBaseAddressProperties::setPropertiesDynamicState(int64_t dynamicStateBaseAddress, size_t dynamicStateSize) {
|
||||
this->dynamicStateBaseAddress.isDirty = false;
|
||||
this->dynamicStateSize.isDirty = false;
|
||||
this->dynamicStateBaseAddress.set(dynamicStateBaseAddress);
|
||||
this->dynamicStateSize.set(dynamicStateSize);
|
||||
}
|
||||
|
||||
void StateBaseAddressProperties::setPropertiesIndirectState(int64_t indirectObjectBaseAddress, size_t indirectObjectSize) {
|
||||
this->indirectObjectBaseAddress.isDirty = false;
|
||||
this->indirectObjectSize.isDirty = false;
|
||||
this->indirectObjectBaseAddress.set(indirectObjectBaseAddress);
|
||||
this->indirectObjectSize.set(indirectObjectSize);
|
||||
}
|
||||
|
@ -457,7 +452,6 @@ void StateBaseAddressProperties::copyPropertiesStatelessMocs(const StateBaseAddr
|
|||
void StateBaseAddressProperties::copyPropertiesStatelessMocsIndirectState(const StateBaseAddressProperties &properties) {
|
||||
this->statelessMocs.isDirty = false;
|
||||
this->indirectObjectBaseAddress.isDirty = false;
|
||||
this->indirectObjectSize.isDirty = false;
|
||||
|
||||
this->statelessMocs.set(properties.statelessMocs.value);
|
||||
this->indirectObjectBaseAddress.set(properties.indirectObjectBaseAddress.value);
|
||||
|
@ -466,21 +460,17 @@ void StateBaseAddressProperties::copyPropertiesStatelessMocsIndirectState(const
|
|||
|
||||
bool StateBaseAddressProperties::isDirty() const {
|
||||
return globalAtomics.isDirty || statelessMocs.isDirty ||
|
||||
bindingTablePoolBaseAddress.isDirty || bindingTablePoolSize.isDirty ||
|
||||
surfaceStateBaseAddress.isDirty || surfaceStateSize.isDirty ||
|
||||
dynamicStateBaseAddress.isDirty || dynamicStateSize.isDirty ||
|
||||
indirectObjectBaseAddress.isDirty || indirectObjectSize.isDirty;
|
||||
bindingTablePoolBaseAddress.isDirty ||
|
||||
surfaceStateBaseAddress.isDirty ||
|
||||
dynamicStateBaseAddress.isDirty ||
|
||||
indirectObjectBaseAddress.isDirty;
|
||||
}
|
||||
|
||||
void StateBaseAddressProperties::clearIsDirty() {
|
||||
globalAtomics.isDirty = false;
|
||||
statelessMocs.isDirty = false;
|
||||
bindingTablePoolBaseAddress.isDirty = false;
|
||||
bindingTablePoolSize.isDirty = false;
|
||||
surfaceStateBaseAddress.isDirty = false;
|
||||
surfaceStateSize.isDirty = false;
|
||||
dynamicStateBaseAddress.isDirty = false;
|
||||
dynamicStateSize.isDirty = false;
|
||||
indirectObjectBaseAddress.isDirty = false;
|
||||
indirectObjectSize.isDirty = false;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -12,23 +12,29 @@
|
|||
|
||||
namespace NEO {
|
||||
|
||||
template <typename Type>
|
||||
template <typename Type, bool fullStateProperty>
|
||||
struct StreamPropertyType {
|
||||
static constexpr Type initValue = static_cast<Type>(-1);
|
||||
|
||||
Type value = initValue;
|
||||
bool isDirty = false;
|
||||
void set(Type newValue) {
|
||||
if constexpr (fullStateProperty) {
|
||||
if ((value != newValue) && (newValue != initValue)) {
|
||||
value = newValue;
|
||||
isDirty = true;
|
||||
}
|
||||
} else {
|
||||
if (newValue != initValue) {
|
||||
value = newValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
using StreamProperty32 = StreamPropertyType<int32_t>;
|
||||
using StreamProperty64 = StreamPropertyType<int64_t>;
|
||||
using StreamPropertySizeT = StreamPropertyType<size_t>;
|
||||
using StreamProperty32 = StreamPropertyType<int32_t, true>;
|
||||
using StreamProperty64 = StreamPropertyType<int64_t, true>;
|
||||
using StreamPropertySizeT = StreamPropertyType<size_t, false>;
|
||||
|
||||
using StreamProperty = StreamProperty32;
|
||||
|
||||
|
|
|
@ -829,7 +829,7 @@ TEST(StreamPropertiesTests, givenStateBaseAddressSupportFlagStateWhenSettingProp
|
|||
EXPECT_FALSE(sbaProperties.globalAtomics.isDirty);
|
||||
EXPECT_FALSE(sbaProperties.statelessMocs.isDirty);
|
||||
EXPECT_TRUE(sbaProperties.bindingTablePoolBaseAddress.isDirty);
|
||||
EXPECT_TRUE(sbaProperties.bindingTablePoolSize.isDirty);
|
||||
EXPECT_FALSE(sbaProperties.bindingTablePoolSize.isDirty);
|
||||
|
||||
EXPECT_EQ(1, sbaProperties.globalAtomics.value);
|
||||
EXPECT_EQ(1, sbaProperties.statelessMocs.value);
|
||||
|
@ -849,7 +849,7 @@ TEST(StreamPropertiesTests, givenStateBaseAddressSupportFlagStateWhenSettingProp
|
|||
EXPECT_EQ(2u, sbaProperties.bindingTablePoolSize.value);
|
||||
|
||||
sbaProperties.setPropertiesAll(false, 0, 3, 3, -1, -1, -1, -1, -1, -1);
|
||||
EXPECT_TRUE(sbaProperties.isDirty());
|
||||
EXPECT_FALSE(sbaProperties.isDirty());
|
||||
|
||||
EXPECT_EQ(0, sbaProperties.globalAtomics.value);
|
||||
EXPECT_EQ(0, sbaProperties.statelessMocs.value);
|
||||
|
@ -919,11 +919,11 @@ TEST(StreamPropertiesTests, givenStateBaseAddressCommonBaseAddressAndSizeWhenSet
|
|||
EXPECT_FALSE(sbaProperties.indirectObjectSize.isDirty);
|
||||
|
||||
sbaProperties.setPropertiesAll(false, -1, -1, 10, 10, 20, -1, -1, -1, -1);
|
||||
EXPECT_TRUE(sbaProperties.isDirty());
|
||||
EXPECT_FALSE(sbaProperties.isDirty());
|
||||
EXPECT_EQ(20u, sbaProperties.surfaceStateSize.value);
|
||||
|
||||
EXPECT_FALSE(sbaProperties.surfaceStateBaseAddress.isDirty);
|
||||
EXPECT_TRUE(sbaProperties.surfaceStateSize.isDirty);
|
||||
EXPECT_FALSE(sbaProperties.surfaceStateSize.isDirty);
|
||||
EXPECT_FALSE(sbaProperties.dynamicStateBaseAddress.isDirty);
|
||||
EXPECT_FALSE(sbaProperties.dynamicStateSize.isDirty);
|
||||
EXPECT_FALSE(sbaProperties.indirectObjectBaseAddress.isDirty);
|
||||
|
@ -941,13 +941,13 @@ TEST(StreamPropertiesTests, givenStateBaseAddressCommonBaseAddressAndSizeWhenSet
|
|||
EXPECT_FALSE(sbaProperties.indirectObjectSize.isDirty);
|
||||
|
||||
sbaProperties.setPropertiesAll(false, -1, -1, 10, 10, 20, 30, 40, -1, -1);
|
||||
EXPECT_TRUE(sbaProperties.isDirty());
|
||||
EXPECT_FALSE(sbaProperties.isDirty());
|
||||
EXPECT_EQ(40u, sbaProperties.dynamicStateSize.value);
|
||||
|
||||
EXPECT_FALSE(sbaProperties.surfaceStateBaseAddress.isDirty);
|
||||
EXPECT_FALSE(sbaProperties.surfaceStateSize.isDirty);
|
||||
EXPECT_FALSE(sbaProperties.dynamicStateBaseAddress.isDirty);
|
||||
EXPECT_TRUE(sbaProperties.dynamicStateSize.isDirty);
|
||||
EXPECT_FALSE(sbaProperties.dynamicStateSize.isDirty);
|
||||
EXPECT_FALSE(sbaProperties.indirectObjectBaseAddress.isDirty);
|
||||
EXPECT_FALSE(sbaProperties.indirectObjectSize.isDirty);
|
||||
|
||||
|
@ -963,7 +963,7 @@ TEST(StreamPropertiesTests, givenStateBaseAddressCommonBaseAddressAndSizeWhenSet
|
|||
EXPECT_FALSE(sbaProperties.indirectObjectSize.isDirty);
|
||||
|
||||
sbaProperties.setPropertiesAll(false, -1, -1, 10, 10, 20, 30, 40, 50, 60);
|
||||
EXPECT_TRUE(sbaProperties.isDirty());
|
||||
EXPECT_FALSE(sbaProperties.isDirty());
|
||||
EXPECT_EQ(60u, sbaProperties.indirectObjectSize.value);
|
||||
|
||||
EXPECT_FALSE(sbaProperties.surfaceStateBaseAddress.isDirty);
|
||||
|
@ -971,7 +971,7 @@ TEST(StreamPropertiesTests, givenStateBaseAddressCommonBaseAddressAndSizeWhenSet
|
|||
EXPECT_FALSE(sbaProperties.dynamicStateBaseAddress.isDirty);
|
||||
EXPECT_FALSE(sbaProperties.dynamicStateSize.isDirty);
|
||||
EXPECT_FALSE(sbaProperties.indirectObjectBaseAddress.isDirty);
|
||||
EXPECT_TRUE(sbaProperties.indirectObjectSize.isDirty);
|
||||
EXPECT_FALSE(sbaProperties.indirectObjectSize.isDirty);
|
||||
|
||||
sbaProperties.setPropertiesAll(false, -1, -1, 10, 10, 20, 30, 40, 50, 60);
|
||||
EXPECT_FALSE(sbaProperties.isDirty());
|
||||
|
@ -1132,7 +1132,7 @@ TEST(StreamPropertiesTests, givenIndirectHeapAndStatelessMocsStateBaseAddressPro
|
|||
indirectObjectSize = 2;
|
||||
sbaProperties.setPropertiesIndirectState(indirectObjectBaseAddress, indirectObjectSize);
|
||||
sbaPropertiesCopy.copyPropertiesStatelessMocsIndirectState(sbaProperties);
|
||||
EXPECT_TRUE(sbaPropertiesCopy.isDirty());
|
||||
EXPECT_FALSE(sbaPropertiesCopy.isDirty());
|
||||
EXPECT_EQ(1, sbaPropertiesCopy.statelessMocs.value);
|
||||
EXPECT_EQ(2, sbaPropertiesCopy.indirectObjectBaseAddress.value);
|
||||
EXPECT_EQ(2u, sbaPropertiesCopy.indirectObjectSize.value);
|
||||
|
@ -1200,6 +1200,24 @@ TEST(StreamPropertiesTests, givenBindingTableAndSurfaceStateBaseAddressStateBase
|
|||
EXPECT_EQ(1u, sbaProperties.bindingTablePoolSize.value);
|
||||
EXPECT_EQ(1, sbaProperties.surfaceStateBaseAddress.value);
|
||||
EXPECT_EQ(1u, sbaProperties.surfaceStateSize.value);
|
||||
|
||||
surfaceStateSize = 2;
|
||||
bindingTablePoolSize = 2;
|
||||
sbaProperties.setPropertiesBindingTableSurfaceState(bindingTablePoolBaseAddress, bindingTablePoolSize, surfaceStateBaseAddress, surfaceStateSize);
|
||||
EXPECT_FALSE(sbaProperties.isDirty());
|
||||
EXPECT_EQ(1, sbaProperties.bindingTablePoolBaseAddress.value);
|
||||
EXPECT_EQ(2u, sbaProperties.bindingTablePoolSize.value);
|
||||
EXPECT_EQ(1, sbaProperties.surfaceStateBaseAddress.value);
|
||||
EXPECT_EQ(2u, sbaProperties.surfaceStateSize.value);
|
||||
|
||||
bindingTablePoolBaseAddress = 2;
|
||||
surfaceStateBaseAddress = 2;
|
||||
sbaProperties.setPropertiesBindingTableSurfaceState(bindingTablePoolBaseAddress, bindingTablePoolSize, surfaceStateBaseAddress, surfaceStateSize);
|
||||
EXPECT_TRUE(sbaProperties.isDirty());
|
||||
EXPECT_EQ(2, sbaProperties.bindingTablePoolBaseAddress.value);
|
||||
EXPECT_EQ(2u, sbaProperties.bindingTablePoolSize.value);
|
||||
EXPECT_EQ(2, sbaProperties.surfaceStateBaseAddress.value);
|
||||
EXPECT_EQ(2u, sbaProperties.surfaceStateSize.value);
|
||||
}
|
||||
|
||||
TEST(StreamPropertiesTests, givenSurfaceStateBaseAddressStateBaseAddressPropertyWhenSettingPropertyAndCheckIfSupportedThenExpectCorrectState) {
|
||||
|
@ -1230,6 +1248,18 @@ TEST(StreamPropertiesTests, givenSurfaceStateBaseAddressStateBaseAddressProperty
|
|||
EXPECT_FALSE(sbaProperties.isDirty());
|
||||
EXPECT_EQ(1, sbaProperties.surfaceStateBaseAddress.value);
|
||||
EXPECT_EQ(1u, sbaProperties.surfaceStateSize.value);
|
||||
|
||||
surfaceStateSize = 2;
|
||||
sbaProperties.setPropertiesSurfaceState(surfaceStateBaseAddress, surfaceStateSize);
|
||||
EXPECT_FALSE(sbaProperties.isDirty());
|
||||
EXPECT_EQ(1, sbaProperties.surfaceStateBaseAddress.value);
|
||||
EXPECT_EQ(2u, sbaProperties.surfaceStateSize.value);
|
||||
|
||||
surfaceStateBaseAddress = 2;
|
||||
sbaProperties.setPropertiesSurfaceState(surfaceStateBaseAddress, surfaceStateSize);
|
||||
EXPECT_TRUE(sbaProperties.isDirty());
|
||||
EXPECT_EQ(2, sbaProperties.surfaceStateBaseAddress.value);
|
||||
EXPECT_EQ(2u, sbaProperties.surfaceStateSize.value);
|
||||
}
|
||||
|
||||
TEST(StreamPropertiesTests, givenDynamicStateBaseAddressStateBaseAddressPropertyWhenSettingPropertyAndCheckIfSupportedThenExpectCorrectState) {
|
||||
|
@ -1262,7 +1292,7 @@ TEST(StreamPropertiesTests, givenDynamicStateBaseAddressStateBaseAddressProperty
|
|||
|
||||
dynamicStateSize = 2;
|
||||
sbaProperties.setPropertiesDynamicState(dynamicStateBaseAddress, dynamicStateSize);
|
||||
EXPECT_TRUE(sbaProperties.isDirty());
|
||||
EXPECT_FALSE(sbaProperties.isDirty());
|
||||
EXPECT_EQ(1, sbaProperties.dynamicStateBaseAddress.value);
|
||||
EXPECT_EQ(2u, sbaProperties.dynamicStateSize.value);
|
||||
|
||||
|
@ -1303,7 +1333,7 @@ TEST(StreamPropertiesTests, givenIndirectObjectBaseAddressStateBaseAddressProper
|
|||
|
||||
indirectObjectSize = 2;
|
||||
sbaProperties.setPropertiesIndirectState(indirectObjectBaseAddress, indirectObjectSize);
|
||||
EXPECT_TRUE(sbaProperties.isDirty());
|
||||
EXPECT_FALSE(sbaProperties.isDirty());
|
||||
EXPECT_EQ(1, sbaProperties.indirectObjectBaseAddress.value);
|
||||
EXPECT_EQ(2u, sbaProperties.indirectObjectSize.value);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -16,10 +16,10 @@ struct FrontEndProperties;
|
|||
struct PipelineSelectProperties;
|
||||
struct StateComputeModeProperties;
|
||||
|
||||
template <typename Type>
|
||||
template <typename Type, bool fullStatePropert>
|
||||
struct StreamPropertyType;
|
||||
|
||||
using StreamProperty = StreamPropertyType<int32_t>;
|
||||
using StreamProperty = StreamPropertyType<int32_t, true>;
|
||||
|
||||
std::vector<StreamProperty *> getAllStateComputeModeProperties(StateComputeModeProperties &properties);
|
||||
std::vector<StreamProperty *> getAllFrontEndProperties(FrontEndProperties &properties);
|
||||
|
|
Loading…
Reference in New Issue