Encode number barriers

When programming number of barriers use BARRIER_SIZE enumeration.
Resolves: NEO-6785

Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
This commit is contained in:
Krystian Chmielewski
2022-04-04 09:11:39 +00:00
committed by Compute-Runtime-Automation
parent 81739c0265
commit 2c1bfbb5b2
12 changed files with 66 additions and 53 deletions

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/debug_helpers.h"
#include <array>
#include <utility>
template <typename KeyT, typename ValueT, size_t NumElements>
struct LookupArray {
using LookupMapArrayT = std::array<std::pair<KeyT, ValueT>, NumElements>;
constexpr LookupArray(const LookupMapArrayT &lookupArray) : lookupArray(lookupArray){};
constexpr ValueT lookUp(const KeyT &keyToFind) const {
for (auto &[key, value] : lookupArray) {
if (keyToFind == key) {
return value;
}
}
UNRECOVERABLE_IF(true);
}
protected:
LookupMapArrayT lookupArray;
};