mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-06 19:32:25 +08:00
Unify StreamProperties structs
Introduce functions allowing to copy values from one struct to another, while correctly setting values of isDirty field. Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
899af98240
commit
7eb81e9d85
@@ -1852,14 +1852,14 @@ void CommandListCoreFamily<gfxCoreFamily>::updateStreamProperties(Kernel &kernel
|
|||||||
using VFE_STATE_TYPE = typename GfxFamily::VFE_STATE_TYPE;
|
using VFE_STATE_TYPE = typename GfxFamily::VFE_STATE_TYPE;
|
||||||
|
|
||||||
if (!containsAnyKernel) {
|
if (!containsAnyKernel) {
|
||||||
requiredStreamState.setCooperativeKernelProperties(kernel.usesSyncBuffer(), device->getHwInfo());
|
requiredStreamState.frontEndState.setProperties(kernel.usesSyncBuffer(), device->getHwInfo());
|
||||||
finalStreamState = requiredStreamState;
|
finalStreamState = requiredStreamState;
|
||||||
containsAnyKernel = true;
|
containsAnyKernel = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto &hwInfo = device->getHwInfo();
|
auto &hwInfo = device->getHwInfo();
|
||||||
auto programVfe = finalStreamState.setCooperativeKernelProperties(kernel.usesSyncBuffer(), hwInfo);
|
finalStreamState.frontEndState.setProperties(kernel.usesSyncBuffer(), hwInfo);
|
||||||
if (programVfe) {
|
if (finalStreamState.frontEndState.isDirty()) {
|
||||||
auto pVfeStateAddress = NEO::PreambleHelper<GfxFamily>::getSpaceForVfeState(commandContainer.getCommandStream(), hwInfo, engineGroupType);
|
auto pVfeStateAddress = NEO::PreambleHelper<GfxFamily>::getSpaceForVfeState(commandContainer.getCommandStream(), hwInfo, engineGroupType);
|
||||||
auto pVfeState = new VFE_STATE_TYPE;
|
auto pVfeState = new VFE_STATE_TYPE;
|
||||||
NEO::PreambleHelper<GfxFamily>::programVfeState(pVfeState, hwInfo, 0, 0, device->getMaxNumHwThreads(),
|
NEO::PreambleHelper<GfxFamily>::programVfeState(pVfeState, hwInfo, 0, 0, device->getMaxNumHwThreads(),
|
||||||
@@ -1869,7 +1869,7 @@ void CommandListCoreFamily<gfxCoreFamily>::updateStreamProperties(Kernel &kernel
|
|||||||
|
|
||||||
auto &kernelAttributes = kernel.getKernelDescriptor().kernelAttributes;
|
auto &kernelAttributes = kernel.getKernelDescriptor().kernelAttributes;
|
||||||
auto &neoDevice = *device->getNEODevice();
|
auto &neoDevice = *device->getNEODevice();
|
||||||
finalStreamState.setStateComputeModeProperties(false, kernelAttributes.numGrfRequired, isMultiOsContextCapable,
|
finalStreamState.stateComputeMode.setProperties(false, kernelAttributes.numGrfRequired, isMultiOsContextCapable,
|
||||||
kernelAttributes.flags.useGlobalAtomics,
|
kernelAttributes.flags.useGlobalAtomics,
|
||||||
(neoDevice.getNumAvailableDevices() > 1));
|
(neoDevice.getNumAvailableDevices() > 1));
|
||||||
if (finalStreamState.stateComputeMode.isDirty()) {
|
if (finalStreamState.stateComputeMode.isDirty()) {
|
||||||
|
|||||||
@@ -330,7 +330,8 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
|
|||||||
|
|
||||||
if (!isCopyOnlyCommandQueue) {
|
if (!isCopyOnlyCommandQueue) {
|
||||||
auto &requiredStreamState = commandList->getRequiredStreamState();
|
auto &requiredStreamState = commandList->getRequiredStreamState();
|
||||||
auto programVfe = streamProperties.setCooperativeKernelProperties(requiredStreamState.getCooperativeKernelProperties(), hwInfo);
|
streamProperties.frontEndState.setProperties(requiredStreamState.frontEndState);
|
||||||
|
auto programVfe = streamProperties.frontEndState.isDirty();
|
||||||
if (frontEndStateDirty) {
|
if (frontEndStateDirty) {
|
||||||
programVfe = true;
|
programVfe = true;
|
||||||
frontEndStateDirty = false;
|
frontEndStateDirty = false;
|
||||||
@@ -339,7 +340,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
|
|||||||
programFrontEnd(scratchSpaceController->getScratchPatchAddress(), scratchSpaceController->getPerThreadScratchSpaceSize(), child);
|
programFrontEnd(scratchSpaceController->getScratchPatchAddress(), scratchSpaceController->getPerThreadScratchSpaceSize(), child);
|
||||||
}
|
}
|
||||||
auto &finalStreamState = commandList->getFinalStreamState();
|
auto &finalStreamState = commandList->getFinalStreamState();
|
||||||
streamProperties.setCooperativeKernelProperties(finalStreamState.getCooperativeKernelProperties(), hwInfo);
|
streamProperties.frontEndState.setProperties(finalStreamState.frontEndState);
|
||||||
}
|
}
|
||||||
|
|
||||||
patchCommands(*commandList, scratchSpaceController->getScratchPatchAddress());
|
patchCommands(*commandList, scratchSpaceController->getScratchPatchAddress());
|
||||||
@@ -462,13 +463,13 @@ size_t CommandQueueHw<gfxCoreFamily>::estimateFrontEndCmdSizeForMultipleCommandL
|
|||||||
|
|
||||||
auto streamPropertiesCopy = streamProperties;
|
auto streamPropertiesCopy = streamProperties;
|
||||||
auto singleFrontEndCmdSize = estimateFrontEndCmdSize();
|
auto singleFrontEndCmdSize = estimateFrontEndCmdSize();
|
||||||
auto &hwInfo = device->getHwInfo();
|
|
||||||
size_t estimatedSize = 0;
|
size_t estimatedSize = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < numCommandLists; i++) {
|
for (size_t i = 0; i < numCommandLists; i++) {
|
||||||
auto commandList = CommandList::fromHandle(phCommandLists[i]);
|
auto commandList = CommandList::fromHandle(phCommandLists[i]);
|
||||||
auto &requiredStreamState = commandList->getRequiredStreamState();
|
auto &requiredStreamState = commandList->getRequiredStreamState();
|
||||||
auto isVfeRequired = streamPropertiesCopy.setCooperativeKernelProperties(requiredStreamState.getCooperativeKernelProperties(), hwInfo);
|
streamPropertiesCopy.frontEndState.setProperties(requiredStreamState.frontEndState);
|
||||||
|
auto isVfeRequired = streamPropertiesCopy.frontEndState.isDirty();
|
||||||
if (isFrontEndStateDirty) {
|
if (isFrontEndStateDirty) {
|
||||||
isVfeRequired = true;
|
isVfeRequired = true;
|
||||||
isFrontEndStateDirty = false;
|
isFrontEndStateDirty = false;
|
||||||
@@ -477,7 +478,7 @@ size_t CommandQueueHw<gfxCoreFamily>::estimateFrontEndCmdSizeForMultipleCommandL
|
|||||||
estimatedSize += singleFrontEndCmdSize;
|
estimatedSize += singleFrontEndCmdSize;
|
||||||
}
|
}
|
||||||
auto &finalStreamState = commandList->getFinalStreamState();
|
auto &finalStreamState = commandList->getFinalStreamState();
|
||||||
streamPropertiesCopy.setCooperativeKernelProperties(finalStreamState.getCooperativeKernelProperties(), hwInfo);
|
streamPropertiesCopy.frontEndState.setProperties(finalStreamState.frontEndState);
|
||||||
}
|
}
|
||||||
|
|
||||||
return estimatedSize;
|
return estimatedSize;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ template <typename Family>
|
|||||||
void EncodeStates<Family>::adjustStateComputeMode(LinearStream &csr, uint32_t numGrfRequired, void *const stateComputeModePtr,
|
void EncodeStates<Family>::adjustStateComputeMode(LinearStream &csr, uint32_t numGrfRequired, void *const stateComputeModePtr,
|
||||||
bool isMultiOsContextCapable, bool requiresCoherency, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) {
|
bool isMultiOsContextCapable, bool requiresCoherency, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) {
|
||||||
StreamProperties properties{};
|
StreamProperties properties{};
|
||||||
properties.setStateComputeModeProperties(requiresCoherency, numGrfRequired, isMultiOsContextCapable, useGlobalAtomics, areMultipleSubDevicesInContext);
|
properties.stateComputeMode.setProperties(requiresCoherency, numGrfRequired, isMultiOsContextCapable, useGlobalAtomics, areMultipleSubDevicesInContext);
|
||||||
EncodeComputeMode<Family>::adjustComputeMode(csr, stateComputeModePtr, properties.stateComputeMode);
|
EncodeComputeMode<Family>::adjustComputeMode(csr, stateComputeModePtr, properties.stateComputeMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -913,7 +913,7 @@ inline void CommandStreamReceiverHw<GfxFamily>::programVFEState(LinearStream &cs
|
|||||||
auto engineGroupType = hwHelper.getEngineGroupType(getOsContext().getEngineType(), hwInfo);
|
auto engineGroupType = hwHelper.getEngineGroupType(getOsContext().getEngineType(), hwInfo);
|
||||||
auto pVfeState = PreambleHelper<GfxFamily>::getSpaceForVfeState(&csr, hwInfo, engineGroupType);
|
auto pVfeState = PreambleHelper<GfxFamily>::getSpaceForVfeState(&csr, hwInfo, engineGroupType);
|
||||||
StreamProperties streamProperties{};
|
StreamProperties streamProperties{};
|
||||||
streamProperties.setCooperativeKernelProperties(lastKernelExecutionType == KernelExecutionType::Concurrent, hwInfo);
|
streamProperties.frontEndState.setProperties(lastKernelExecutionType == KernelExecutionType::Concurrent, hwInfo);
|
||||||
PreambleHelper<GfxFamily>::programVfeState(
|
PreambleHelper<GfxFamily>::programVfeState(
|
||||||
pVfeState, hwInfo, requiredScratchSize, getScratchPatchAddress(),
|
pVfeState, hwInfo, requiredScratchSize, getScratchPatchAddress(),
|
||||||
maxFrontEndThreads, lastAdditionalKernelExecInfo, streamProperties);
|
maxFrontEndThreads, lastAdditionalKernelExecInfo, streamProperties);
|
||||||
|
|||||||
@@ -12,11 +12,18 @@ namespace NEO {
|
|||||||
struct StateComputeModeProperties {
|
struct StateComputeModeProperties {
|
||||||
StreamProperty isCoherencyRequired{};
|
StreamProperty isCoherencyRequired{};
|
||||||
|
|
||||||
|
void setProperties(bool requiresCoherency, uint32_t numGrfRequired, bool isMultiOsContextCapable,
|
||||||
|
bool useGlobalAtomics, bool areMultipleSubDevicesInContext);
|
||||||
|
void setProperties(const StateComputeModeProperties &properties);
|
||||||
bool isDirty();
|
bool isDirty();
|
||||||
void clearIsDirty();
|
void clearIsDirty();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FrontEndProperties {
|
struct FrontEndProperties {
|
||||||
|
void setProperties(bool isCooperativeKernel, const HardwareInfo &hwInfo);
|
||||||
|
void setProperties(const FrontEndProperties &properties);
|
||||||
|
bool isDirty();
|
||||||
|
void clearIsDirty();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -9,20 +9,18 @@
|
|||||||
|
|
||||||
using namespace NEO;
|
using namespace NEO;
|
||||||
|
|
||||||
bool StreamProperties::setCooperativeKernelProperties(int32_t cooperativeKernelProperties, const HardwareInfo &hwInfo) {
|
void StateComputeModeProperties::setProperties(bool requiresCoherency, uint32_t numGrfRequired, bool isMultiOsContextCapable,
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t StreamProperties::getCooperativeKernelProperties() const {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void StreamProperties::setStateComputeModeProperties(bool requiresCoherency, uint32_t numGrfRequired, bool isMultiOsContextCapable,
|
|
||||||
bool useGlobalAtomics, bool areMultipleSubDevicesInContext) {
|
bool useGlobalAtomics, bool areMultipleSubDevicesInContext) {
|
||||||
stateComputeMode.clearIsDirty();
|
clearIsDirty();
|
||||||
|
|
||||||
int32_t isCoherencyRequired = (requiresCoherency ? 1 : 0);
|
int32_t isCoherencyRequired = (requiresCoherency ? 1 : 0);
|
||||||
stateComputeMode.isCoherencyRequired.set(isCoherencyRequired);
|
this->isCoherencyRequired.set(isCoherencyRequired);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StateComputeModeProperties::setProperties(const StateComputeModeProperties &properties) {
|
||||||
|
clearIsDirty();
|
||||||
|
|
||||||
|
isCoherencyRequired.set(properties.isCoherencyRequired.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StateComputeModeProperties::isDirty() {
|
bool StateComputeModeProperties::isDirty() {
|
||||||
@@ -32,3 +30,16 @@ bool StateComputeModeProperties::isDirty() {
|
|||||||
void StateComputeModeProperties::clearIsDirty() {
|
void StateComputeModeProperties::clearIsDirty() {
|
||||||
isCoherencyRequired.isDirty = false;
|
isCoherencyRequired.isDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FrontEndProperties::setProperties(bool isCooperativeKernel, const HardwareInfo &hwInfo) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void FrontEndProperties::setProperties(const FrontEndProperties &properties) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FrontEndProperties::isDirty() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FrontEndProperties::clearIsDirty() {
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,12 +15,6 @@
|
|||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
struct StreamProperties {
|
struct StreamProperties {
|
||||||
bool setCooperativeKernelProperties(int32_t cooperativeKernelProperties, const HardwareInfo &hwInfo);
|
|
||||||
int32_t getCooperativeKernelProperties() const;
|
|
||||||
|
|
||||||
void setStateComputeModeProperties(bool requiresCoherency, uint32_t numGrfRequired, bool isMultiOsContextCapable,
|
|
||||||
bool useGlobalAtomics, bool areMultipleSubDevicesInContext);
|
|
||||||
|
|
||||||
StateComputeModeProperties stateComputeMode{};
|
StateComputeModeProperties stateComputeMode{};
|
||||||
FrontEndProperties frontEndState{};
|
FrontEndProperties frontEndState{};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,11 +42,6 @@ enum class LocalMemoryAccessMode {
|
|||||||
CpuAccessDisallowed = 3
|
CpuAccessDisallowed = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class FrontEndType {
|
|
||||||
Video,
|
|
||||||
Compute
|
|
||||||
};
|
|
||||||
|
|
||||||
class HwHelper {
|
class HwHelper {
|
||||||
public:
|
public:
|
||||||
using EngineInstancesContainer = StackVec<EngineTypeUsage, 32>;
|
using EngineInstancesContainer = StackVec<EngineTypeUsage, 32>;
|
||||||
@@ -74,7 +69,6 @@ class HwHelper {
|
|||||||
virtual bool preferSmallWorkgroupSizeForKernel(const size_t size, const HardwareInfo &hwInfo) const = 0;
|
virtual bool preferSmallWorkgroupSizeForKernel(const size_t size, const HardwareInfo &hwInfo) const = 0;
|
||||||
virtual bool isBufferSizeSuitableForRenderCompression(const size_t size) const = 0;
|
virtual bool isBufferSizeSuitableForRenderCompression(const size_t size) const = 0;
|
||||||
virtual bool obtainBlitterPreference(const HardwareInfo &hwInfo) const = 0;
|
virtual bool obtainBlitterPreference(const HardwareInfo &hwInfo) const = 0;
|
||||||
virtual FrontEndType getFrontEndType(const HardwareInfo &hwInfo) const = 0;
|
|
||||||
virtual bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) = 0;
|
virtual bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) = 0;
|
||||||
virtual bool allowRenderCompression(const HardwareInfo &hwInfo) const = 0;
|
virtual bool allowRenderCompression(const HardwareInfo &hwInfo) const = 0;
|
||||||
virtual bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const = 0;
|
virtual bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const = 0;
|
||||||
@@ -244,8 +238,6 @@ class HwHelperHw : public HwHelper {
|
|||||||
|
|
||||||
bool obtainBlitterPreference(const HardwareInfo &hwInfo) const override;
|
bool obtainBlitterPreference(const HardwareInfo &hwInfo) const override;
|
||||||
|
|
||||||
FrontEndType getFrontEndType(const HardwareInfo &hwInfo) const override;
|
|
||||||
|
|
||||||
bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) override;
|
bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) override;
|
||||||
|
|
||||||
bool timestampPacketWriteSupported() const override;
|
bool timestampPacketWriteSupported() const override;
|
||||||
|
|||||||
@@ -55,11 +55,6 @@ bool HwHelperHw<Family>::obtainBlitterPreference(const HardwareInfo &hwInfo) con
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Family>
|
|
||||||
FrontEndType HwHelperHw<Family>::getFrontEndType(const HardwareInfo &hwInfo) const {
|
|
||||||
return FrontEndType::Video;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
const HwHelper::EngineInstancesContainer HwHelperHw<GfxFamily>::getGpgpuEngineInstances(const HardwareInfo &hwInfo) const {
|
const HwHelper::EngineInstancesContainer HwHelperHw<GfxFamily>::getGpgpuEngineInstances(const HardwareInfo &hwInfo) const {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -16,4 +16,8 @@ std::vector<StreamProperty *> getAllStateComputeModeProperties(StateComputeModeP
|
|||||||
return allProperties;
|
return allProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<StreamProperty *> getAllFrontEndProperties(FrontEndProperties &properties) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -44,32 +44,90 @@ TEST(StreamPropertiesTests, whenPropertyValueIsChangedThenProperStateIsSet) {
|
|||||||
TEST(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrectValuesAreSet) {
|
TEST(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrectValuesAreSet) {
|
||||||
StreamProperties properties;
|
StreamProperties properties;
|
||||||
for (auto requiresCoherency : ::testing::Bool()) {
|
for (auto requiresCoherency : ::testing::Bool()) {
|
||||||
properties.setStateComputeModeProperties(requiresCoherency, 0u, false, false, false);
|
properties.stateComputeMode.setProperties(requiresCoherency, 0u, false, false, false);
|
||||||
EXPECT_EQ(requiresCoherency, properties.stateComputeMode.isCoherencyRequired.value);
|
EXPECT_EQ(requiresCoherency, properties.stateComputeMode.isCoherencyRequired.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(StreamPropertiesTests, givenVariousStatesOfThePropertiesWhenIsStateComputeModeDirtyIsQueriedThenCorrectValueIsReturned) {
|
template <typename PropertiesT>
|
||||||
struct MockStateComputeModeProperties : StateComputeModeProperties {
|
using getAllPropertiesFunctionPtr = std::vector<StreamProperty *> (*)(PropertiesT &properties);
|
||||||
using StateComputeModeProperties::clearIsDirty;
|
|
||||||
|
template <typename PropertiesT, getAllPropertiesFunctionPtr<PropertiesT> getAllProperties>
|
||||||
|
void verifyIsDirty() {
|
||||||
|
struct MockPropertiesT : PropertiesT {
|
||||||
|
using PropertiesT::clearIsDirty;
|
||||||
};
|
};
|
||||||
MockStateComputeModeProperties properties;
|
MockPropertiesT properties;
|
||||||
|
auto allProperties = getAllProperties(properties);
|
||||||
|
|
||||||
EXPECT_FALSE(properties.isDirty());
|
EXPECT_FALSE(properties.isDirty());
|
||||||
for (auto pProperty : getAllStateComputeModeProperties(properties)) {
|
for (auto pProperty : allProperties) {
|
||||||
pProperty->isDirty = true;
|
pProperty->isDirty = true;
|
||||||
EXPECT_TRUE(properties.isDirty());
|
EXPECT_TRUE(properties.isDirty());
|
||||||
pProperty->isDirty = false;
|
pProperty->isDirty = false;
|
||||||
EXPECT_FALSE(properties.isDirty());
|
EXPECT_FALSE(properties.isDirty());
|
||||||
}
|
}
|
||||||
for (auto pProperty : getAllStateComputeModeProperties(properties)) {
|
for (auto pProperty : allProperties) {
|
||||||
pProperty->isDirty = true;
|
pProperty->isDirty = true;
|
||||||
}
|
}
|
||||||
EXPECT_TRUE(properties.isDirty());
|
|
||||||
|
EXPECT_EQ(!allProperties.empty(), properties.isDirty());
|
||||||
|
|
||||||
properties.clearIsDirty();
|
properties.clearIsDirty();
|
||||||
for (auto pProperty : getAllStateComputeModeProperties(properties)) {
|
for (auto pProperty : allProperties) {
|
||||||
EXPECT_FALSE(pProperty->isDirty);
|
EXPECT_FALSE(pProperty->isDirty);
|
||||||
}
|
}
|
||||||
EXPECT_FALSE(properties.isDirty());
|
EXPECT_FALSE(properties.isDirty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(StreamPropertiesTests, givenVariousStatesOfStateComputeModePropertiesWhenIsDirtyIsQueriedThenCorrectValueIsReturned) {
|
||||||
|
verifyIsDirty<StateComputeModeProperties, &getAllStateComputeModeProperties>();
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(StreamPropertiesTests, givenVariousStatesOfFrontEndPropertiesWhenIsDirtyIsQueriedThenCorrectValueIsReturned) {
|
||||||
|
verifyIsDirty<FrontEndProperties, getAllFrontEndProperties>();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename PropertiesT, getAllPropertiesFunctionPtr<PropertiesT> getAllProperties>
|
||||||
|
void verifySettingPropertiesFromOtherStruct() {
|
||||||
|
PropertiesT propertiesDestination;
|
||||||
|
PropertiesT propertiesSource;
|
||||||
|
|
||||||
|
auto allPropertiesDestination = getAllProperties(propertiesDestination);
|
||||||
|
auto allPropertiesSource = getAllProperties(propertiesSource);
|
||||||
|
|
||||||
|
int valueToSet = 1;
|
||||||
|
for (auto pProperty : allPropertiesSource) {
|
||||||
|
pProperty->value = valueToSet;
|
||||||
|
valueToSet++;
|
||||||
|
}
|
||||||
|
EXPECT_FALSE(propertiesSource.isDirty());
|
||||||
|
|
||||||
|
propertiesDestination.setProperties(propertiesSource);
|
||||||
|
EXPECT_EQ(!allPropertiesDestination.empty(), propertiesDestination.isDirty());
|
||||||
|
|
||||||
|
int expectedValue = 1;
|
||||||
|
for (auto pProperty : allPropertiesDestination) {
|
||||||
|
EXPECT_EQ(expectedValue, pProperty->value);
|
||||||
|
EXPECT_TRUE(pProperty->isDirty);
|
||||||
|
expectedValue++;
|
||||||
|
}
|
||||||
|
|
||||||
|
propertiesDestination.setProperties(propertiesSource);
|
||||||
|
EXPECT_FALSE(propertiesDestination.isDirty());
|
||||||
|
|
||||||
|
expectedValue = 1;
|
||||||
|
for (auto pProperty : allPropertiesDestination) {
|
||||||
|
EXPECT_EQ(expectedValue, pProperty->value);
|
||||||
|
EXPECT_FALSE(pProperty->isDirty);
|
||||||
|
expectedValue++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(StreamPropertiesTests, givenOtherStateComputeModePropertiesStructWhenSetPropertiesIsCalledThenCorrectValuesAreSet) {
|
||||||
|
verifySettingPropertiesFromOtherStruct<StateComputeModeProperties, &getAllStateComputeModeProperties>();
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(StreamPropertiesTests, givenOtherFrontEndPropertiesStructWhenSetPropertiesIsCalledThenCorrectValuesAreSet) {
|
||||||
|
verifySettingPropertiesFromOtherStruct<FrontEndProperties, getAllFrontEndProperties>();
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,9 +11,11 @@
|
|||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
|
struct FrontEndProperties;
|
||||||
struct StateComputeModeProperties;
|
struct StateComputeModeProperties;
|
||||||
struct StreamProperty;
|
struct StreamProperty;
|
||||||
|
|
||||||
std::vector<StreamProperty *> getAllStateComputeModeProperties(StateComputeModeProperties &properties);
|
std::vector<StreamProperty *> getAllStateComputeModeProperties(StateComputeModeProperties &properties);
|
||||||
|
std::vector<StreamProperty *> getAllFrontEndProperties(FrontEndProperties &properties);
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
Reference in New Issue
Block a user