mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-06 19:32:25 +08:00
fix: create dedicated class for root device indices to store unique values
remove method to removing duplicates from StackVec as the method implicitly sorted the vector Related-To: GSD-4692 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
52651991c2
commit
4f72835b7d
@@ -230,10 +230,9 @@ bool Context::createImpl(const cl_context_properties *properties,
|
||||
|
||||
bool containsDeviceWithSubdevices = false;
|
||||
for (const auto &device : inputDevices) {
|
||||
rootDeviceIndices.push_back(device->getRootDeviceIndex());
|
||||
rootDeviceIndices.pushUnique(device->getRootDeviceIndex());
|
||||
containsDeviceWithSubdevices |= device->getNumGenericSubDevices() > 1;
|
||||
}
|
||||
rootDeviceIndices.remove_duplicates();
|
||||
|
||||
this->driverDiagnostics = driverDiagnostics.release();
|
||||
if (rootDeviceIndices.size() > 1 && containsDeviceWithSubdevices && !DebugManager.flags.EnableMultiRootDeviceContexts.get()) {
|
||||
|
||||
@@ -276,11 +276,10 @@ Buffer *Buffer::create(Context *context,
|
||||
pRootDeviceIndices = &context->getRootDeviceIndices();
|
||||
} else {
|
||||
for (const auto &device : memoryProperties.associatedDevices) {
|
||||
rootDeviceIndices.push_back(device->getRootDeviceIndex());
|
||||
rootDeviceIndices.pushUnique(device->getRootDeviceIndex());
|
||||
}
|
||||
defaultDevice = memoryProperties.associatedDevices[0];
|
||||
defaultRootDeviceIndex = rootDeviceIndices[0];
|
||||
rootDeviceIndices.remove_duplicates();
|
||||
pRootDeviceIndices = &rootDeviceIndices;
|
||||
}
|
||||
|
||||
|
||||
@@ -143,11 +143,10 @@ Image *Image::create(Context *context,
|
||||
pRootDeviceIndices = &context->getRootDeviceIndices();
|
||||
} else {
|
||||
for (const auto &device : memoryProperties.associatedDevices) {
|
||||
rootDeviceIndices.push_back(device->getRootDeviceIndex());
|
||||
rootDeviceIndices.pushUnique(device->getRootDeviceIndex());
|
||||
}
|
||||
defaultDevice = memoryProperties.associatedDevices[0];
|
||||
defaultRootDeviceIndex = rootDeviceIndices[0];
|
||||
rootDeviceIndices.remove_duplicates();
|
||||
pRootDeviceIndices = &rootDeviceIndices;
|
||||
}
|
||||
|
||||
|
||||
@@ -1790,10 +1790,9 @@ HWTEST_F(CreateHostUnifiedMemoryAllocationTest,
|
||||
auto maxRootDeviceIndex = numDevices - 1u;
|
||||
|
||||
RootDeviceIndicesContainer rootDeviceIndices;
|
||||
rootDeviceIndices.reserve(numDevices);
|
||||
rootDeviceIndices.push_back(0u);
|
||||
rootDeviceIndices.push_back(1u);
|
||||
rootDeviceIndices.push_back(2u);
|
||||
rootDeviceIndices.pushUnique(0u);
|
||||
rootDeviceIndices.pushUnique(1u);
|
||||
rootDeviceIndices.pushUnique(2u);
|
||||
|
||||
auto rootDeviceIndex = rootDeviceIndices.at(0);
|
||||
auto deviceBitfield = device0->getDeviceBitfield();
|
||||
@@ -1836,9 +1835,8 @@ HWTEST_F(CreateHostUnifiedMemoryAllocationTest,
|
||||
auto maxRootDeviceIndex = numDevices - 1u;
|
||||
|
||||
RootDeviceIndicesContainer rootDeviceIndices;
|
||||
rootDeviceIndices.reserve(numDevices);
|
||||
rootDeviceIndices.push_back(0u);
|
||||
rootDeviceIndices.push_back(2u);
|
||||
rootDeviceIndices.pushUnique(0u);
|
||||
rootDeviceIndices.pushUnique(2u);
|
||||
|
||||
auto noProgramedRootDeviceIndex = 1u;
|
||||
auto rootDeviceIndex = rootDeviceIndices.at(0);
|
||||
|
||||
@@ -3045,7 +3045,7 @@ TEST(MemoryManagerTest, givenMemoryManagerWithLocalMemoryWhenCreatingMultiGraphi
|
||||
memoryManager.freeGraphicsMemory(localMemoryAllocation);
|
||||
|
||||
RootDeviceIndicesContainer rootDeviceIndices;
|
||||
rootDeviceIndices.push_back(mockRootDeviceIndex);
|
||||
rootDeviceIndices.pushUnique(mockRootDeviceIndex);
|
||||
|
||||
MultiGraphicsAllocation multiGraphicsAllocation(mockRootDeviceIndex);
|
||||
|
||||
@@ -3067,11 +3067,11 @@ TEST(MemoryManagerTest, givenDuplicateRootDeviceIndicesWhenCreatingMultiGraphics
|
||||
AllocationProperties allocationProperties{mockRootDeviceIndex, MemoryConstants::pageSize, AllocationType::SVM_GPU, systemMemoryBitfield};
|
||||
|
||||
RootDeviceIndicesContainer rootDeviceIndices;
|
||||
rootDeviceIndices.push_back(mockRootDeviceIndex);
|
||||
rootDeviceIndices.push_back(mockRootDeviceIndex);
|
||||
rootDeviceIndices.push_back(mockRootDeviceIndex);
|
||||
rootDeviceIndices.pushUnique(mockRootDeviceIndex);
|
||||
rootDeviceIndices.pushUnique(mockRootDeviceIndex);
|
||||
rootDeviceIndices.pushUnique(mockRootDeviceIndex);
|
||||
|
||||
EXPECT_EQ(3u, rootDeviceIndices.size());
|
||||
EXPECT_EQ(1u, rootDeviceIndices.size());
|
||||
|
||||
MultiGraphicsAllocation multiGraphicsAllocation(mockRootDeviceIndex);
|
||||
|
||||
|
||||
@@ -100,9 +100,8 @@ std::unique_ptr<AsyncEventsHandler> &MockContext::getAsyncEventsHandlerUniquePtr
|
||||
void MockContext::initializeWithDevices(const ClDeviceVector &devices, bool noSpecialQueue) {
|
||||
for (auto &pClDevice : devices) {
|
||||
pClDevice->incRefInternal();
|
||||
rootDeviceIndices.push_back(pClDevice->getRootDeviceIndex());
|
||||
rootDeviceIndices.pushUnique(pClDevice->getRootDeviceIndex());
|
||||
}
|
||||
rootDeviceIndices.remove_duplicates();
|
||||
maxRootDeviceIndex = *std::max_element(rootDeviceIndices.begin(), rootDeviceIndices.end(), std::less<uint32_t const>());
|
||||
specialQueues.resize(maxRootDeviceIndex + 1u);
|
||||
|
||||
|
||||
@@ -625,10 +625,10 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSomeOfMultipleEngine
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenWddmMemoryManagerWhenGpuAddressIsReservedAndFreedThenAddressRangeIsNonZero) {
|
||||
RootDeviceIndicesContainer rootDevices;
|
||||
rootDevices.push_back(0);
|
||||
RootDeviceIndicesContainer rootDeviceIndices;
|
||||
rootDeviceIndices.pushUnique(0);
|
||||
uint32_t rootDeviceIndexReserved = 1;
|
||||
auto addressRange = memoryManager->reserveGpuAddress(0ull, MemoryConstants::pageSize64k, rootDevices, &rootDeviceIndexReserved);
|
||||
auto addressRange = memoryManager->reserveGpuAddress(0ull, MemoryConstants::pageSize64k, rootDeviceIndices, &rootDeviceIndexReserved);
|
||||
auto gmmHelper = memoryManager->getGmmHelper(0);
|
||||
EXPECT_EQ(0u, rootDeviceIndexReserved);
|
||||
EXPECT_NE(0u, gmmHelper->decanonize(addressRange.address));
|
||||
|
||||
Reference in New Issue
Block a user