Rename fields in AllocationProperties

Related-To: NEO-5498

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2021-02-19 15:11:13 +00:00
committed by Compute-Runtime-Automation
parent d0d15dd058
commit 24b928303b
10 changed files with 39 additions and 24 deletions

View File

@@ -1659,7 +1659,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendQueryKernelTimestamps(
}
size_t alignedSize = alignUp<size_t>(sizeof(EventData) * numEvents, MemoryConstants::pageSize64k);
NEO::GraphicsAllocation::AllocationType allocationType = NEO::GraphicsAllocation::AllocationType::GPU_TIMESTAMP_TAG_BUFFER;
NEO::GraphicsAllocation::AllocationType allocationType = NEO::GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER;
auto devices = device->getNEODevice()->getDeviceBitfield();
NEO::AllocationProperties allocationProperties{device->getRootDeviceIndex(),
true,

View File

@@ -90,7 +90,7 @@ ze_result_t EventPoolImp::initialize(DriverHandle *driver, uint32_t numDevices,
auto deviceBitfield = devices[0]->getNEODevice()->getDeviceBitfield();
auto allocationType = isEventPoolUsedForTimestamp ? NEO::GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER : NEO::GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
if (this->allocOnDevice) {
allocationType = NEO::GraphicsAllocation::AllocationType::GPU_TIMESTAMP_TAG_BUFFER;
allocationType = NEO::GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER;
}
NEO::AllocationProperties eventPoolAllocationProperties{rootDeviceIndex,

View File

@@ -632,7 +632,7 @@ HWTEST2_F(AppendQueryKernelTimestamps, givenCommandListWhenAppendQueryKernelTime
containsDstPtr = true;
}
if (residentGfxAlloc->getAllocationType() ==
NEO::GraphicsAllocation::AllocationType::GPU_TIMESTAMP_TAG_BUFFER) {
NEO::GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER) {
gpuTimeStampAlloc = true;
}
}

View File

@@ -154,7 +154,7 @@ TEST_F(EventPoolCreate, whenHostVisibleFlagNotSetThenEventAllocationIsOnDevice)
ASSERT_NE(nullptr, eventPool);
EXPECT_EQ(NEO::GraphicsAllocation::AllocationType::GPU_TIMESTAMP_TAG_BUFFER, eventPool->getAllocation().getAllocationType());
EXPECT_EQ(NEO::GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER, eventPool->getAllocation().getAllocationType());
eventPool->destroy();
}

View File

@@ -550,8 +550,8 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithMultipleBitsSetWhenSharedUnifiedM
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
EXPECT_TRUE(memoryManager->multiOsContextCapablePassed);
EXPECT_FALSE(memoryManager->multiStorageResourcePassed);
EXPECT_FALSE(memoryManager->multiOsContextCapablePassed);
EXPECT_TRUE(memoryManager->multiStorageResourcePassed);
EXPECT_EQ(unifiedMemoryProperties.subdeviceBitfields.at(mockRootDeviceIndex), memoryManager->subDevicesBitfieldPassed);
svmManager->freeSVMAlloc(ptr);
@@ -586,7 +586,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithMultipleBitsSetWhenDeviceUnifiedM
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
EXPECT_TRUE(memoryManager->multiOsContextCapablePassed);
EXPECT_FALSE(memoryManager->multiOsContextCapablePassed);
EXPECT_TRUE(memoryManager->multiStorageResourcePassed);
EXPECT_EQ(unifiedMemoryProperties.subdeviceBitfields.at(mockRootDeviceIndex), memoryManager->subDevicesBitfieldPassed);
@@ -608,6 +608,20 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithSingleBitSetWh
svmManager->freeSVMAlloc(ptr);
}
TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithMultiDeviceBitSetWhenDeviceUnifiedMemoryAllocationIsCreatedThenProperPropertiesArePassedToMemoryManager) {
std::set<uint32_t> rootDeviceIndices{mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xF)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties);
EXPECT_FALSE(memoryManager->multiOsContextCapablePassed);
EXPECT_TRUE(memoryManager->multiStorageResourcePassed);
EXPECT_EQ(unifiedMemoryProperties.subdeviceBitfields.at(mockRootDeviceIndex), memoryManager->subDevicesBitfieldPassed);
svmManager->freeSVMAlloc(ptr);
}
struct ShareableUnifiedMemoryManagerPropertiesTest : public ::testing::Test {
void SetUp() override {
executionEnvironment = platform()->peekExecutionEnvironment();
@@ -1058,4 +1072,4 @@ HWTEST_F(UnfiedSharedMemoryHWTest, givenSharedUsmAllocationWhenReadBufferThenCpu
gpuAllocation->setCpuPtrAndGpuAddress(cpuPtr, gpuAddress);
delete buffer;
clMemFreeINTEL(&mockContext, sharedMemory);
}
}

View File

@@ -67,7 +67,7 @@ struct AllocationProperties {
bool allocateMemoryParam,
size_t sizeParam,
GraphicsAllocation::AllocationType allocationTypeParam,
bool multiOsContextCapableParam,
bool multiOsContextCapable,
bool isMultiStorageAllocationParam,
DeviceBitfield subDevicesBitfieldParam)
: rootDeviceIndex(rootDeviceIndexParam),
@@ -79,7 +79,7 @@ struct AllocationProperties {
flags.flushL3RequiredForRead = 1;
flags.flushL3RequiredForWrite = 1;
flags.allocateMemory = allocateMemoryParam;
flags.multiOsContextCapable = multiOsContextCapableParam;
flags.multiOsContextCapable = multiOsContextCapable;
}
};

View File

@@ -98,7 +98,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
DEBUG_MODULE_AREA,
UNIFIED_SHARED_MEMORY,
WORK_PARTITION_SURFACE,
GPU_TIMESTAMP_TAG_BUFFER
GPU_TIMESTAMP_DEVICE_BUFFER
};
~GraphicsAllocation() override;

View File

@@ -297,7 +297,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
switch (properties.allocationType) {
case GraphicsAllocation::AllocationType::SVM_GPU:
case GraphicsAllocation::AllocationType::SVM_ZERO_COPY:
case GraphicsAllocation::AllocationType::GPU_TIMESTAMP_TAG_BUFFER:
case GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER:
allow64KbPages = true;
default:
break;
@@ -381,7 +381,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
case GraphicsAllocation::AllocationType::SURFACE_STATE_HEAP:
case GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
case GraphicsAllocation::AllocationType::DEBUG_MODULE_AREA:
case GraphicsAllocation::AllocationType::GPU_TIMESTAMP_TAG_BUFFER:
case GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER:
allocationData.flags.resource48Bit = true;
break;
default:

View File

@@ -128,13 +128,13 @@ void *SVMAllocsManager::createHostUnifiedMemoryAllocation(size_t size,
std::vector<uint32_t> rootDeviceIndicesVector(memoryProperties.rootDeviceIndices.begin(), memoryProperties.rootDeviceIndices.end());
uint32_t rootDeviceIndex = rootDeviceIndicesVector.at(0);
auto deviceBitfield = memoryProperties.subdeviceBitfields.at(rootDeviceIndex);
auto &deviceBitfield = memoryProperties.subdeviceBitfields.at(rootDeviceIndex);
AllocationProperties unifiedMemoryProperties{rootDeviceIndex,
true,
alignedSize,
allocationType,
deviceBitfield.count() > 1,
false,
deviceBitfield.count() > 1,
deviceBitfield};
unifiedMemoryProperties.flags.shareable = memoryProperties.allocationFlags.flags.shareable;
@@ -167,7 +167,7 @@ void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size,
auto rootDeviceIndex = memoryProperties.device
? memoryProperties.device->getRootDeviceIndex()
: *memoryProperties.rootDeviceIndices.begin();
auto deviceBitfield = memoryProperties.subdeviceBitfields.at(rootDeviceIndex);
auto &deviceBitfield = memoryProperties.subdeviceBitfields.at(rootDeviceIndex);
size_t alignedSize = alignUp<size_t>(size, MemoryConstants::pageSize64k);
@@ -177,7 +177,7 @@ void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size,
true,
alignedSize,
allocationType,
deviceBitfield.count() > 1,
false,
deviceBitfield.count() > 1,
deviceBitfield};
unifiedMemoryProperties.flags.shareable = memoryProperties.allocationFlags.flags.shareable;
@@ -255,13 +255,13 @@ void *SVMAllocsManager::createUnifiedKmdMigratedAllocation(size_t size, const Sv
auto rootDeviceIndex = unifiedMemoryProperties.device
? unifiedMemoryProperties.device->getRootDeviceIndex()
: *unifiedMemoryProperties.rootDeviceIndices.begin();
auto deviceBitfield = unifiedMemoryProperties.subdeviceBitfields.at(rootDeviceIndex);
auto &deviceBitfield = unifiedMemoryProperties.subdeviceBitfields.at(rootDeviceIndex);
size_t alignedSize = alignUp<size_t>(size, 2 * MemoryConstants::megaByte);
AllocationProperties gpuProperties{rootDeviceIndex,
true,
alignedSize,
GraphicsAllocation::AllocationType::UNIFIED_SHARED_MEMORY,
deviceBitfield.count() > 1,
false,
false,
deviceBitfield};
@@ -340,7 +340,7 @@ void *SVMAllocsManager::createZeroCopySvmAllocation(size_t size, const SvmAlloca
const std::map<uint32_t, DeviceBitfield> &subdeviceBitfields) {
auto rootDeviceIndex = *rootDeviceIndices.begin();
auto deviceBitfield = subdeviceBitfields.at(rootDeviceIndex);
auto &deviceBitfield = subdeviceBitfields.at(rootDeviceIndex);
AllocationProperties properties{rootDeviceIndex,
true, // allocateMemory
size,
@@ -369,11 +369,12 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, co
? unifiedMemoryProperties.device->getRootDeviceIndex()
: *unifiedMemoryProperties.rootDeviceIndices.begin();
size_t alignedSize = alignUp<size_t>(size, 2 * MemoryConstants::megaByte);
const DeviceBitfield &subDevices = unifiedMemoryProperties.subdeviceBitfields.at(rootDeviceIndex);
AllocationProperties cpuProperties{rootDeviceIndex,
true, // allocateMemory
alignedSize, GraphicsAllocation::AllocationType::SVM_CPU,
false, // isMultiStorageAllocation
unifiedMemoryProperties.subdeviceBitfields.at(rootDeviceIndex)};
subDevices};
cpuProperties.alignment = 2 * MemoryConstants::megaByte;
auto cacheRegion = MemoryPropertiesHelper::getCacheRegion(unifiedMemoryProperties.allocationFlags);
MemoryPropertiesHelper::fillCachePolicyInProperties(cpuProperties, false, svmProperties.readOnly, false, cacheRegion);
@@ -388,9 +389,9 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, co
false,
alignedSize,
GraphicsAllocation::AllocationType::SVM_GPU,
unifiedMemoryProperties.subdeviceBitfields.at(rootDeviceIndex).count() > 1,
false,
unifiedMemoryProperties.subdeviceBitfields.at(rootDeviceIndex)};
subDevices.count() > 1,
subDevices};
gpuProperties.alignment = 2 * MemoryConstants::megaByte;
MemoryPropertiesHelper::fillCachePolicyInProperties(gpuProperties, false, svmProperties.readOnly, false, cacheRegion);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*