fix: return correct allocation from InOrderExecInfo getter

Related-To: NEO-13971

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski 2025-02-11 16:28:01 +00:00 committed by Compute-Runtime-Automation
parent a33603a084
commit 68a0aa0525
3 changed files with 13 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2023-2024 Intel Corporation
* Copyright (C) 2023-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -133,6 +133,9 @@ NEO::GraphicsAllocation *InOrderExecInfo::getDeviceCounterAllocation() const {
}
NEO::GraphicsAllocation *InOrderExecInfo::getHostCounterAllocation() const {
if (externalHostAllocation) {
return externalHostAllocation;
}
return hostCounterNode ? hostCounterNode->getBaseGraphicsAllocation()->getGraphicsAllocation(rootDeviceIndex) : nullptr;
}

View File

@ -18,6 +18,7 @@
#include "memory_properties_flags.h"
#include <atomic>
#include <chrono>
#include <cstdint>
#include <map>
#include <memory>

View File

@ -62,14 +62,14 @@ HWTEST_F(CommandEncoderTests, givenDifferentInputParamsWhenCreatingStandaloneInO
uint64_t *hostAddress = &counterValue;
uint64_t gpuAddress = castToUint64(ptrOffset(&counterValue, 64));
MockGraphicsAllocation alloc(nullptr, gpuAddress, 1);
MockGraphicsAllocation deviceAlloc(nullptr, gpuAddress, 1);
auto inOrderExecInfo = InOrderExecInfo::createFromExternalAllocation(mockDevice, &alloc, gpuAddress, nullptr, hostAddress, counterValue, 2, 3);
auto inOrderExecInfo = InOrderExecInfo::createFromExternalAllocation(mockDevice, &deviceAlloc, gpuAddress, nullptr, hostAddress, counterValue, 2, 3);
EXPECT_EQ(counterValue, inOrderExecInfo->getCounterValue());
EXPECT_EQ(hostAddress, inOrderExecInfo->getBaseHostAddress());
EXPECT_EQ(gpuAddress, inOrderExecInfo->getBaseDeviceAddress());
EXPECT_EQ(&alloc, inOrderExecInfo->getDeviceCounterAllocation());
EXPECT_EQ(&deviceAlloc, inOrderExecInfo->getDeviceCounterAllocation());
EXPECT_EQ(nullptr, inOrderExecInfo->getHostCounterAllocation());
EXPECT_TRUE(inOrderExecInfo->isExternalMemoryExecInfo());
EXPECT_EQ(2u, inOrderExecInfo->getNumDevicePartitionsToWait());
@ -78,6 +78,11 @@ HWTEST_F(CommandEncoderTests, givenDifferentInputParamsWhenCreatingStandaloneInO
inOrderExecInfo->reset();
EXPECT_EQ(0u, inOrderExecInfo->getCounterValue());
MockGraphicsAllocation hostAlloc(nullptr, castToUint64(hostAddress), 1);
inOrderExecInfo = InOrderExecInfo::createFromExternalAllocation(mockDevice, &deviceAlloc, gpuAddress, &hostAlloc, hostAddress, counterValue, 2, 3);
EXPECT_EQ(&hostAlloc, inOrderExecInfo->getHostCounterAllocation());
}
HWTEST_F(CommandEncoderTests, givenTsNodesWhenStoringOnTempListThenHandleOwnershipCorrectly) {