mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Set resource48Bit flag according to GraphicsAllocation::AllocationType
Related-To: NEO-2941 Change-Id: Iefb1870280ef60cf6c70c195e1e7d23739f7b427 Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
4e16de51d8
commit
2b6fa20e12
@ -738,3 +738,93 @@ TEST(MemoryManagerTest, givenDirectSemaphorePlacementSetWhenOverrideToSystemThen
|
||||
EXPECT_EQ(0u, allocationData.flags.requiresCpuAccess);
|
||||
EXPECT_EQ(1u, allocationData.flags.useSystemMemory);
|
||||
}
|
||||
|
||||
using MemoryManagerGetAlloctionDataHaveToBeForcedTo48BitTest = testing::TestWithParam<std::tuple<GraphicsAllocation::AllocationType, bool>>;
|
||||
|
||||
TEST_P(MemoryManagerGetAlloctionDataHaveToBeForcedTo48BitTest, givenAllocationTypesHaveToBeForcedTo48BitThenAllocationDataResource48BitIsSet) {
|
||||
GraphicsAllocation::AllocationType allocationType;
|
||||
bool propertiesFlag48Bit;
|
||||
|
||||
std::tie(allocationType, propertiesFlag48Bit) = GetParam();
|
||||
|
||||
AllocationProperties properties(0, true, 0, allocationType, false);
|
||||
properties.flags.resource48Bit = propertiesFlag48Bit;
|
||||
|
||||
AllocationData allocationData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
MockMemoryManager::getAllocationData(allocationData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_TRUE(allocationData.flags.resource48Bit);
|
||||
}
|
||||
|
||||
using MemoryManagerGetAlloctionDataHaveNotToBeForcedTo48BitTest = testing::TestWithParam<std::tuple<GraphicsAllocation::AllocationType, bool>>;
|
||||
|
||||
TEST_P(MemoryManagerGetAlloctionDataHaveNotToBeForcedTo48BitTest, givenAllocationTypesHaveNotToBeForcedTo48BitThenAllocationDataResource48BitIsSetProperly) {
|
||||
GraphicsAllocation::AllocationType allocationType;
|
||||
bool propertiesFlag48Bit;
|
||||
|
||||
std::tie(allocationType, propertiesFlag48Bit) = GetParam();
|
||||
|
||||
AllocationProperties properties(0, true, 0, allocationType, false);
|
||||
properties.flags.resource48Bit = propertiesFlag48Bit;
|
||||
|
||||
AllocationData allocationData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
MockMemoryManager::getAllocationData(allocationData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_EQ(allocationData.flags.resource48Bit, propertiesFlag48Bit);
|
||||
}
|
||||
|
||||
static const GraphicsAllocation::AllocationType allocationHaveToBeForcedTo48Bit[] = {
|
||||
GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER,
|
||||
GraphicsAllocation::AllocationType::IMAGE,
|
||||
GraphicsAllocation::AllocationType::INDIRECT_OBJECT_HEAP,
|
||||
GraphicsAllocation::AllocationType::INSTRUCTION_HEAP,
|
||||
GraphicsAllocation::AllocationType::INTERNAL_HEAP,
|
||||
GraphicsAllocation::AllocationType::KERNEL_ISA,
|
||||
GraphicsAllocation::AllocationType::LINEAR_STREAM,
|
||||
GraphicsAllocation::AllocationType::MCS,
|
||||
GraphicsAllocation::AllocationType::SCRATCH_SURFACE,
|
||||
GraphicsAllocation::AllocationType::SHARED_CONTEXT_IMAGE,
|
||||
GraphicsAllocation::AllocationType::SHARED_IMAGE,
|
||||
GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY,
|
||||
GraphicsAllocation::AllocationType::SURFACE_STATE_HEAP,
|
||||
GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER,
|
||||
};
|
||||
|
||||
static const GraphicsAllocation::AllocationType allocationHaveNotToBeForcedTo48Bit[] = {
|
||||
GraphicsAllocation::AllocationType::BUFFER,
|
||||
GraphicsAllocation::AllocationType::BUFFER_COMPRESSED,
|
||||
GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY,
|
||||
GraphicsAllocation::AllocationType::COMMAND_BUFFER,
|
||||
GraphicsAllocation::AllocationType::CONSTANT_SURFACE,
|
||||
GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR,
|
||||
GraphicsAllocation::AllocationType::FILL_PATTERN,
|
||||
GraphicsAllocation::AllocationType::GLOBAL_SURFACE,
|
||||
GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||
GraphicsAllocation::AllocationType::MAP_ALLOCATION,
|
||||
GraphicsAllocation::AllocationType::PIPE,
|
||||
GraphicsAllocation::AllocationType::PREEMPTION,
|
||||
GraphicsAllocation::AllocationType::PRINTF_SURFACE,
|
||||
GraphicsAllocation::AllocationType::PRIVATE_SURFACE,
|
||||
GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER,
|
||||
GraphicsAllocation::AllocationType::SHARED_BUFFER,
|
||||
GraphicsAllocation::AllocationType::SVM_CPU,
|
||||
GraphicsAllocation::AllocationType::SVM_GPU,
|
||||
GraphicsAllocation::AllocationType::SVM_ZERO_COPY,
|
||||
GraphicsAllocation::AllocationType::TAG_BUFFER,
|
||||
GraphicsAllocation::AllocationType::GLOBAL_FENCE,
|
||||
GraphicsAllocation::AllocationType::WRITE_COMBINED,
|
||||
GraphicsAllocation::AllocationType::RING_BUFFER,
|
||||
GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER,
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ForceTo48Bit,
|
||||
MemoryManagerGetAlloctionDataHaveToBeForcedTo48BitTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(allocationHaveToBeForcedTo48Bit),
|
||||
::testing::Bool()));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(NotForceTo48Bit,
|
||||
MemoryManagerGetAlloctionDataHaveNotToBeForcedTo48BitTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(allocationHaveNotToBeForcedTo48Bit),
|
||||
::testing::Bool()));
|
||||
|
@ -299,6 +299,27 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
||||
break;
|
||||
}
|
||||
|
||||
switch (properties.allocationType) {
|
||||
case GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER:
|
||||
case GraphicsAllocation::AllocationType::IMAGE:
|
||||
case GraphicsAllocation::AllocationType::INDIRECT_OBJECT_HEAP:
|
||||
case GraphicsAllocation::AllocationType::INSTRUCTION_HEAP:
|
||||
case GraphicsAllocation::AllocationType::INTERNAL_HEAP:
|
||||
case GraphicsAllocation::AllocationType::KERNEL_ISA:
|
||||
case GraphicsAllocation::AllocationType::LINEAR_STREAM:
|
||||
case GraphicsAllocation::AllocationType::MCS:
|
||||
case GraphicsAllocation::AllocationType::SCRATCH_SURFACE:
|
||||
case GraphicsAllocation::AllocationType::SHARED_CONTEXT_IMAGE:
|
||||
case GraphicsAllocation::AllocationType::SHARED_IMAGE:
|
||||
case GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY:
|
||||
case GraphicsAllocation::AllocationType::SURFACE_STATE_HEAP:
|
||||
case GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
|
||||
allocationData.flags.resource48Bit = true;
|
||||
break;
|
||||
default:
|
||||
allocationData.flags.resource48Bit = properties.flags.resource48Bit;
|
||||
}
|
||||
|
||||
allocationData.flags.shareable = properties.flags.shareable;
|
||||
allocationData.flags.requiresCpuAccess = GraphicsAllocation::isCpuAccessRequired(properties.allocationType);
|
||||
allocationData.flags.allocateMemory = properties.flags.allocateMemory;
|
||||
@ -323,7 +344,6 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
||||
}
|
||||
|
||||
allocationData.rootDeviceIndex = properties.rootDeviceIndex;
|
||||
allocationData.flags.resource48Bit = properties.flags.resource48Bit;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user