fix: accept more than 16 root devices

Related-To: GSD-5892
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2023-09-05 15:33:39 +00:00
committed by Compute-Runtime-Automation
parent 73682494bc
commit 3845eb3b90
3 changed files with 11 additions and 8 deletions

View File

@@ -10,7 +10,6 @@
#include "shared/source/helpers/debug_helpers.h"
#include <algorithm>
#include <bitset>
#include <cstdint>
#include <limits>
#include <tuple>
@@ -476,13 +475,16 @@ class RootDeviceIndicesContainer : protected StackVec<uint32_t, MaxRootDeviceInd
using StackVec<uint32_t, MaxRootDeviceIndices>::operator[];
inline void pushUnique(uint32_t rootDeviceIndex) {
if (!indexPresent.test(rootDeviceIndex)) {
if (indexPresent.size() <= rootDeviceIndex) {
indexPresent.resize(rootDeviceIndex + 1);
}
if (!indexPresent[rootDeviceIndex]) {
push_back(rootDeviceIndex);
indexPresent.set(rootDeviceIndex);
indexPresent[rootDeviceIndex] = 1;
}
}
protected:
std::bitset<MaxRootDeviceIndices> indexPresent{};
StackVec<int8_t, MaxRootDeviceIndices> indexPresent;
};
using RootDeviceIndicesMap = StackVec<std::tuple<uint32_t, uint32_t>, MaxRootDeviceIndices>;