Files
compute-runtime/shared/source/command_stream/stream_property.h
Zbigniew Zdanowicz f211d97363 [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>
2023-04-04 10:41:36 +02:00

42 lines
945 B
C++

/*
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <cstdint>
#include <stddef.h>
namespace NEO {
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, true>;
using StreamProperty64 = StreamPropertyType<int64_t, true>;
using StreamPropertySizeT = StreamPropertyType<size_t, false>;
using StreamProperty = StreamProperty32;
} // namespace NEO