mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
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:
committed by
Compute-Runtime-Automation
parent
81739c0265
commit
2c1bfbb5b2
29
shared/source/utilities/lookup_array.h
Normal file
29
shared/source/utilities/lookup_array.h
Normal 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;
|
||||
};
|
||||
Reference in New Issue
Block a user