diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe.h b/shared/source/os_interface/linux/xe/ioctl_helper_xe.h index 970003fdda..1694bc932e 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.h +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.h @@ -8,6 +8,7 @@ #pragma once #include "shared/source/os_interface/linux/ioctl_helper.h" +#include #include struct drm_xe_engine_class_instance; diff --git a/shared/source/utilities/stackvec.h b/shared/source/utilities/stackvec.h index dcfc805524..ecb3396cc0 100644 --- a/shared/source/utilities/stackvec.h +++ b/shared/source/utilities/stackvec.h @@ -10,7 +10,6 @@ #include "shared/source/helpers/debug_helpers.h" #include -#include #include #include #include @@ -476,13 +475,16 @@ class RootDeviceIndicesContainer : protected StackVec::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 indexPresent{}; + StackVec indexPresent; }; using RootDeviceIndicesMap = StackVec, MaxRootDeviceIndices>; diff --git a/shared/test/unit_test/utilities/containers_tests.cpp b/shared/test/unit_test/utilities/containers_tests.cpp index dba4d916df..778e0a7f13 100644 --- a/shared/test/unit_test/utilities/containers_tests.cpp +++ b/shared/test/unit_test/utilities/containers_tests.cpp @@ -1705,8 +1705,8 @@ TEST(StackVec, GivenStackVecWithDynamicMemWhenSelfAssignedThenMemoryIsReused) { } TEST(StackVec, whenPushingUniqueToRootDeviceIndicesContainerThenOnlyUniqueValuesArePopulated) { - StackVec input = {6, 5, 4, 3, 2, 1, 5, 4, 5, 4, 2, 4, 3, 1, 6, 1}; - ASSERT_EQ(input.size(), 16u); + StackVec input = {6, 5, 4, 3, 2, 1, 5, 4, 5, 4, 2, 4, 3, 1, 6, 1, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0}; + ASSERT_EQ(input.size(), 27u); RootDeviceIndicesContainer rootDeviceIndices{}; @@ -1714,8 +1714,8 @@ TEST(StackVec, whenPushingUniqueToRootDeviceIndicesContainerThenOnlyUniqueValues rootDeviceIndices.pushUnique(index); } - EXPECT_EQ(rootDeviceIndices.size(), 6u); - const RootDeviceIndicesContainer expectedContainer = {6, 5, 4, 3, 2, 1}; + EXPECT_EQ(rootDeviceIndices.size(), 17u); + const RootDeviceIndicesContainer expectedContainer = {6, 5, 4, 3, 2, 1, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0}; for (auto i = 0u; i < rootDeviceIndices.size(); i++) { EXPECT_EQ(rootDeviceIndices[i], expectedContainer[i]); }