refactor: pass arrayIndex to Wddm::openSharedHandle function

Related-To: NEO-11498
Signed-off-by: Jaroslaw Warchulski <jaroslaw.warchulski@intel.com>
This commit is contained in:
Jaroslaw Warchulski
2024-06-06 16:56:16 +00:00
committed by Compute-Runtime-Automation
parent 89a8623933
commit 0ac1be7669
50 changed files with 279 additions and 232 deletions

View File

@@ -24,6 +24,7 @@ TEST_P(MemoryManagerMultiDeviceTest, givenRootDeviceIndexSpecifiedWhenAllocateGr
for (auto allocationType : allocationTypes) {
for (uint32_t rootDeviceIndex = 0; rootDeviceIndex < getNumRootDevices(); ++rootDeviceIndex) {
AllocationProperties properties{rootDeviceIndex, true, MemoryConstants::pageSize, allocationType, false, false, mockDeviceBitfield};
MemoryManager::OsHandleData osHandleData{static_cast<uint64_t>(0ull)};
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
ASSERT_NE(gfxAllocation, nullptr);
@@ -45,12 +46,12 @@ TEST_P(MemoryManagerMultiDeviceTest, givenRootDeviceIndexSpecifiedWhenAllocateGr
EXPECT_EQ(rootDeviceIndex, gfxAllocation->getRootDeviceIndex());
memoryManager->freeGraphicsMemory(gfxAllocation);
gfxAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(static_cast<osHandle>(0u), properties, false, false, true, nullptr);
gfxAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandleData, properties, false, false, true, nullptr);
ASSERT_NE(gfxAllocation, nullptr);
EXPECT_EQ(rootDeviceIndex, gfxAllocation->getRootDeviceIndex());
memoryManager->freeGraphicsMemory(gfxAllocation);
gfxAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(static_cast<osHandle>(0u), properties, true, false, true, nullptr);
gfxAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandleData, properties, true, false, true, nullptr);
ASSERT_NE(gfxAllocation, nullptr);
EXPECT_EQ(rootDeviceIndex, gfxAllocation->getRootDeviceIndex());
memoryManager->freeGraphicsMemory(gfxAllocation);

View File

@@ -337,10 +337,10 @@ TEST(OsAgnosticMemoryManager, whenCallingCreateGraphicsAllocationFromSharedHandl
DeviceBitfield mockDeviceBitfield(0b1);
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
osHandle handle = 1;
OsAgnosticMemoryManager::OsHandleData osHandleData{1u};
auto size = 4096u;
AllocationProperties properties(mockRootDeviceIndex, false, size, AllocationType::sharedBuffer, false, mockDeviceBitfield);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, false, false, true, nullptr);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(osHandleData, properties, false, false, true, nullptr);
EXPECT_NE(nullptr, sharedAllocation);
EXPECT_EQ(reinterpret_cast<void *>(1u), sharedAllocation->getUnderlyingBuffer());
EXPECT_FALSE(sharedAllocation->isCoherent());
@@ -356,11 +356,11 @@ TEST(OsAgnosticMemoryManager, whenCallingCreateGraphicsAllocationFromSharedHandl
DeviceBitfield mockDeviceBitfield(0b1);
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
osHandle handle = 1;
OsAgnosticMemoryManager::OsHandleData osHandleData{1u};
auto size = 4096u;
uint64_t basePointer = 0x1234;
AllocationProperties properties(mockRootDeviceIndex, false, size, AllocationType::sharedBuffer, false, mockDeviceBitfield);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, false, false, true, reinterpret_cast<void *>(basePointer));
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(osHandleData, properties, false, false, true, reinterpret_cast<void *>(basePointer));
EXPECT_NE(nullptr, sharedAllocation);
EXPECT_EQ(reinterpret_cast<void *>(0x1234), sharedAllocation->getUnderlyingBuffer());
EXPECT_FALSE(sharedAllocation->isCoherent());
@@ -1289,10 +1289,10 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWith64KBPagesDisabledWhenAllocat
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocationFromSharedObjectIsCalledThenGraphicsAllocationIsReturned) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
osHandle handle = 1;
OsAgnosticMemoryManager::OsHandleData osHandleData{1u};
auto size = 4096u;
AllocationProperties properties(mockRootDeviceIndex, false, size, AllocationType::sharedBuffer, false, mockDeviceBitfield);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, false, false, true, nullptr);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(osHandleData, properties, false, false, true, nullptr);
EXPECT_NE(nullptr, sharedAllocation);
EXPECT_FALSE(sharedAllocation->isCoherent());
EXPECT_NE(nullptr, sharedAllocation->getUnderlyingBuffer());
@@ -1305,11 +1305,11 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocat
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocationFromSharedObjectIsCalledWithAMappedPointerThenGraphicsAllocationIsReturnedWithTheSameAddress) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
osHandle handle = 1;
OsAgnosticMemoryManager::OsHandleData osHandleData{1u};
auto size = 4096u;
void *mapPointer = reinterpret_cast<void *>(0x1234);
AllocationProperties properties(mockRootDeviceIndex, false, size, AllocationType::sharedBuffer, false, mockDeviceBitfield);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, false, false, true, mapPointer);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(osHandleData, properties, false, false, true, mapPointer);
EXPECT_NE(nullptr, sharedAllocation);
EXPECT_FALSE(sharedAllocation->isCoherent());
EXPECT_EQ(mapPointer, sharedAllocation->getUnderlyingBuffer());
@@ -1322,13 +1322,13 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocat
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocationFromSharedObjectIsCalledAndRootDeviceIndexIsSpecifiedThenGraphicsAllocationIsReturnedWithCorrectRootDeviceIndex) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
osHandle handle = 1;
OsAgnosticMemoryManager::OsHandleData osHandleData{1u};
auto size = 4096u;
AllocationProperties properties(mockRootDeviceIndex, false, size, AllocationType::sharedBuffer, false, false, mockDeviceBitfield);
EXPECT_EQ(properties.subDevicesBitfield, mockDeviceBitfield);
EXPECT_EQ(properties.rootDeviceIndex, 0u);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, false, false, true, nullptr);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(osHandleData, properties, false, false, true, nullptr);
EXPECT_NE(nullptr, sharedAllocation);
EXPECT_EQ(0u, sharedAllocation->getRootDeviceIndex());
EXPECT_FALSE(sharedAllocation->isCoherent());
@@ -1342,10 +1342,10 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocat
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocationFromSharedObjectIsCalledWithSpecificBitnessThen32BitGraphicsAllocationIsReturned) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
osHandle handle = 1;
OsAgnosticMemoryManager::OsHandleData osHandleData{1u};
auto size = 4096u;
AllocationProperties properties(mockRootDeviceIndex, false, size, AllocationType::sharedBuffer, false, mockDeviceBitfield);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, true, false, true, nullptr);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(osHandleData, properties, true, false, true, nullptr);
EXPECT_NE(nullptr, sharedAllocation);
EXPECT_TRUE(sharedAllocation->is32BitAllocation());
EXPECT_FALSE(sharedAllocation->isCoherent());