mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 08:53:55 +08:00
Add shareable allocation on windows dGPUs
Add default initialization for object members Related-To: LOCI-2665 Signed-off-by: Kamil Diedrich <kamil.diedrich@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
b75f5d4c8b
commit
1b7949432f
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -345,6 +345,14 @@ TEST_F(MultiDeviceStorageInfoTest, whenCreatingStorageInfoForSvmGpuThenLocalOnly
|
||||
EXPECT_TRUE(storageInfo.localOnlyRequired);
|
||||
}
|
||||
|
||||
TEST_F(MultiDeviceStorageInfoTest, whenCreatingStorageInfoForShareableSvmGpuThenLocalOnlyFlagIsRequiredAndIsNotLocable) {
|
||||
AllocationProperties properties{mockRootDeviceIndex, false, numDevices * MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::SVM_GPU, false, singleTileMask};
|
||||
properties.flags.shareable = 1u;
|
||||
auto storageInfo = memoryManager->createStorageInfoFromProperties(properties);
|
||||
EXPECT_TRUE(storageInfo.localOnlyRequired);
|
||||
EXPECT_FALSE(storageInfo.isLockable);
|
||||
}
|
||||
|
||||
TEST_F(MultiDeviceStorageInfoTest, givenReadOnlyBufferToBeCopiedAcrossTilesWhenCreatingStorageInfoThenCorrectValuesAreSet) {
|
||||
AllocationProperties properties{mockRootDeviceIndex, false, 1u, GraphicsAllocation::AllocationType::BUFFER, false, singleTileMask};
|
||||
properties.flags.readOnlyMultiStorage = true;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -49,6 +49,62 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNotSetUseSystemMemoryWhenGraphicsAlloca
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenShareableAllocationWhenAllocateInDevicePoolThenMemoryIsNotLocableAndLocalOnlyIsSet) {
|
||||
const bool localMemoryEnabled = true;
|
||||
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo);
|
||||
|
||||
memoryManager = std::make_unique<MockWddmMemoryManager>(false, localMemoryEnabled, *executionEnvironment);
|
||||
MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Error;
|
||||
AllocationData allocData;
|
||||
allocData.allFlags = 0;
|
||||
allocData.type = GraphicsAllocation::AllocationType::SVM_GPU;
|
||||
allocData.storageInfo.localOnlyRequired = true;
|
||||
allocData.size = MemoryConstants::pageSize;
|
||||
allocData.flags.allocateMemory = true;
|
||||
allocData.flags.shareable = true;
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryInDevicePool(allocData, status);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryManager::AllocationStatus::Success, status);
|
||||
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
|
||||
EXPECT_FALSE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_NE(allocation->peekInternalHandle(memoryManager.get()), 0u);
|
||||
|
||||
EXPECT_EQ(1u, allocation->getDefaultGmm()->resourceParams.Flags.Info.LocalOnly);
|
||||
EXPECT_EQ(1u, allocation->getDefaultGmm()->resourceParams.Flags.Info.NotLockable);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenShareableAllocationWhenAllocateGraphicsMemoryInPreferredPoolThenMemoryIsNotLocableAndLocalOnlyIsSet) {
|
||||
const bool localMemoryEnabled = true;
|
||||
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo);
|
||||
|
||||
memoryManager = std::make_unique<MockWddmMemoryManager>(false, localMemoryEnabled, *executionEnvironment);
|
||||
AllocationProperties properties{mockRootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SVM_GPU, mockDeviceBitfield};
|
||||
properties.allFlags = 0;
|
||||
properties.size = MemoryConstants::pageSize;
|
||||
properties.flags.allocateMemory = true;
|
||||
properties.flags.shareable = true;
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryInPreferredPool(properties, nullptr);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
|
||||
EXPECT_FALSE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_NE(allocation->peekInternalHandle(memoryManager.get()), 0u);
|
||||
|
||||
EXPECT_EQ(1u, allocation->getDefaultGmm()->resourceParams.Flags.Info.LocalOnly);
|
||||
EXPECT_EQ(1u, allocation->getDefaultGmm()->resourceParams.Flags.Info.NotLockable);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
struct WddmMemoryManagerDevicePoolAlignmentTests : WddmMemoryManagerSimpleTest {
|
||||
void testAlignment(uint32_t allocationSize, uint32_t expectedAlignment) {
|
||||
const bool enable64kbPages = false;
|
||||
|
||||
@@ -190,7 +190,7 @@ class CommandStreamReceiver {
|
||||
|
||||
bool peekTimestampPacketWriteEnabled() const { return timestampPacketWriteEnabled; }
|
||||
|
||||
size_t defaultSshSize;
|
||||
size_t defaultSshSize = 0u;
|
||||
bool canUse4GbHeaps = true;
|
||||
|
||||
AllocationsList &getTemporaryAllocations();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -143,6 +143,10 @@ StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationPrope
|
||||
storageInfo.tileInstanced = true;
|
||||
}
|
||||
storageInfo.localOnlyRequired = true;
|
||||
|
||||
if (properties.flags.shareable) {
|
||||
storageInfo.isLockable = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GraphicsAllocation::AllocationType::UNIFIED_SHARED_MEMORY:
|
||||
|
||||
@@ -91,7 +91,7 @@ class HwInfoConfig {
|
||||
virtual LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const = 0;
|
||||
|
||||
public:
|
||||
uint32_t threadsPerEu;
|
||||
uint32_t threadsPerEu = 0u;
|
||||
};
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -993,7 +993,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryInDevicePool(const
|
||||
const size_t numGmms = (static_cast<uint64_t>(sizeAligned) + chunkSize - 1) / chunkSize;
|
||||
|
||||
auto wddmAllocation = std::make_unique<WddmAllocation>(allocationData.rootDeviceIndex, singleBankAllocation ? numGmms : numBanks,
|
||||
allocationData.type, nullptr, sizeAligned, nullptr, MemoryPool::LocalMemory, 0u, maxOsContextCount);
|
||||
allocationData.type, nullptr, sizeAligned, nullptr, MemoryPool::LocalMemory, allocationData.flags.shareable, maxOsContextCount);
|
||||
if (singleBankAllocation) {
|
||||
if (numGmms > 1) {
|
||||
splitGmmsInAllocation(gmmClientContext, wddmAllocation.get(), alignment, chunkSize, const_cast<StorageInfo &>(allocationData.storageInfo));
|
||||
|
||||
Reference in New Issue
Block a user