mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
refactor: improve creating 48b resources
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
5535ef3049
commit
d7b6f11ced
@@ -176,6 +176,8 @@ class GfxCoreHelper {
|
|||||||
virtual bool areSecondaryContextsSupported() const = 0;
|
virtual bool areSecondaryContextsSupported() const = 0;
|
||||||
virtual uint32_t getContextGroupContextsCount() const = 0;
|
virtual uint32_t getContextGroupContextsCount() const = 0;
|
||||||
|
|
||||||
|
virtual bool is48ResourceNeededForCmdBuffer() const = 0;
|
||||||
|
|
||||||
virtual ~GfxCoreHelper() = default;
|
virtual ~GfxCoreHelper() = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -390,6 +392,8 @@ class GfxCoreHelperHw : public GfxCoreHelper {
|
|||||||
bool areSecondaryContextsSupported() const override;
|
bool areSecondaryContextsSupported() const override;
|
||||||
uint32_t getContextGroupContextsCount() const override;
|
uint32_t getContextGroupContextsCount() const override;
|
||||||
|
|
||||||
|
bool is48ResourceNeededForCmdBuffer() const override;
|
||||||
|
|
||||||
~GfxCoreHelperHw() override = default;
|
~GfxCoreHelperHw() override = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -730,4 +730,9 @@ uint32_t GfxCoreHelperHw<GfxFamily>::getContextGroupContextsCount() const {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename GfxFamily>
|
||||||
|
bool GfxCoreHelperHw<GfxFamily>::is48ResourceNeededForCmdBuffer() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -476,8 +476,11 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (properties.allocationType) {
|
switch (properties.allocationType) {
|
||||||
case AllocationType::deferredTasksList:
|
|
||||||
case AllocationType::commandBuffer:
|
case AllocationType::commandBuffer:
|
||||||
|
case AllocationType::ringBuffer:
|
||||||
|
allocationData.flags.resource48Bit = helper.is48ResourceNeededForCmdBuffer();
|
||||||
|
break;
|
||||||
|
case AllocationType::deferredTasksList:
|
||||||
case AllocationType::image:
|
case AllocationType::image:
|
||||||
case AllocationType::indirectObjectHeap:
|
case AllocationType::indirectObjectHeap:
|
||||||
case AllocationType::instructionHeap:
|
case AllocationType::instructionHeap:
|
||||||
@@ -495,7 +498,6 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
|||||||
case AllocationType::timestampPacketTagBuffer:
|
case AllocationType::timestampPacketTagBuffer:
|
||||||
case AllocationType::debugModuleArea:
|
case AllocationType::debugModuleArea:
|
||||||
case AllocationType::gpuTimestampDeviceBuffer:
|
case AllocationType::gpuTimestampDeviceBuffer:
|
||||||
case AllocationType::ringBuffer:
|
|
||||||
case AllocationType::semaphoreBuffer:
|
case AllocationType::semaphoreBuffer:
|
||||||
allocationData.flags.resource48Bit = true;
|
allocationData.flags.resource48Bit = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1609,4 +1609,8 @@ TEST_F(GfxCoreHelperTest, givenContextGroupEnabledWithDebugKeyWhenContextGroupCo
|
|||||||
debugManager.flags.ContextGroupSize.set(2);
|
debugManager.flags.ContextGroupSize.set(2);
|
||||||
EXPECT_EQ(2u, gfxCoreHelper.getContextGroupContextsCount());
|
EXPECT_EQ(2u, gfxCoreHelper.getContextGroupContextsCount());
|
||||||
EXPECT_TRUE(gfxCoreHelper.areSecondaryContextsSupported());
|
EXPECT_TRUE(gfxCoreHelper.areSecondaryContextsSupported());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWTEST_F(GfxCoreHelperTest, whenAskingIf48bResourceNeededForCmdBufferThenReturnTrue) {
|
||||||
|
EXPECT_TRUE(getHelper<GfxCoreHelper>().is48ResourceNeededForCmdBuffer());
|
||||||
|
}
|
||||||
|
|||||||
@@ -1034,6 +1034,27 @@ TEST_P(MemoryManagerGetAlloctionDataHaveToBeForcedTo48BitTest, givenAllocationTy
|
|||||||
EXPECT_TRUE(allocationData.flags.resource48Bit);
|
EXPECT_TRUE(allocationData.flags.resource48Bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using MemoryManagerGetAlloctionDataOptionallyForcedTo48BitTest = testing::TestWithParam<std::tuple<AllocationType, bool>>;
|
||||||
|
|
||||||
|
TEST_P(MemoryManagerGetAlloctionDataOptionallyForcedTo48BitTest, givenAllocationTypesOptionalFor48BitThenAllocationDataResource48BitIsSet) {
|
||||||
|
MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<GfxCoreHelper>();
|
||||||
|
|
||||||
|
AllocationType allocationType;
|
||||||
|
bool propertiesFlag48Bit;
|
||||||
|
|
||||||
|
std::tie(allocationType, propertiesFlag48Bit) = GetParam();
|
||||||
|
|
||||||
|
AllocationProperties properties(mockRootDeviceIndex, 0, allocationType, mockDeviceBitfield);
|
||||||
|
properties.flags.resource48Bit = propertiesFlag48Bit;
|
||||||
|
|
||||||
|
AllocationData allocationData;
|
||||||
|
MockMemoryManager mockMemoryManager;
|
||||||
|
mockMemoryManager.getAllocationData(allocationData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||||
|
|
||||||
|
EXPECT_EQ(gfxCoreHelper.is48ResourceNeededForCmdBuffer(), allocationData.flags.resource48Bit);
|
||||||
|
}
|
||||||
|
|
||||||
using MemoryManagerGetAlloctionDataHaveNotToBeForcedTo48BitTest = testing::TestWithParam<std::tuple<AllocationType, bool>>;
|
using MemoryManagerGetAlloctionDataHaveNotToBeForcedTo48BitTest = testing::TestWithParam<std::tuple<AllocationType, bool>>;
|
||||||
|
|
||||||
TEST_P(MemoryManagerGetAlloctionDataHaveNotToBeForcedTo48BitTest, givenAllocationTypesHaveNotToBeForcedTo48BitThenAllocationDataResource48BitIsSetProperly) {
|
TEST_P(MemoryManagerGetAlloctionDataHaveNotToBeForcedTo48BitTest, givenAllocationTypesHaveNotToBeForcedTo48BitThenAllocationDataResource48BitIsSetProperly) {
|
||||||
@@ -1052,7 +1073,6 @@ TEST_P(MemoryManagerGetAlloctionDataHaveNotToBeForcedTo48BitTest, givenAllocatio
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const AllocationType allocationHaveToBeForcedTo48Bit[] = {
|
static const AllocationType allocationHaveToBeForcedTo48Bit[] = {
|
||||||
AllocationType::commandBuffer,
|
|
||||||
AllocationType::image,
|
AllocationType::image,
|
||||||
AllocationType::indirectObjectHeap,
|
AllocationType::indirectObjectHeap,
|
||||||
AllocationType::instructionHeap,
|
AllocationType::instructionHeap,
|
||||||
@@ -1066,11 +1086,15 @@ static const AllocationType allocationHaveToBeForcedTo48Bit[] = {
|
|||||||
AllocationType::sharedResourceCopy,
|
AllocationType::sharedResourceCopy,
|
||||||
AllocationType::surfaceStateHeap,
|
AllocationType::surfaceStateHeap,
|
||||||
AllocationType::timestampPacketTagBuffer,
|
AllocationType::timestampPacketTagBuffer,
|
||||||
AllocationType::ringBuffer,
|
|
||||||
AllocationType::semaphoreBuffer,
|
AllocationType::semaphoreBuffer,
|
||||||
AllocationType::deferredTasksList,
|
AllocationType::deferredTasksList,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const AllocationType allocationsOptionallyForcedTo48Bit[] = {
|
||||||
|
AllocationType::commandBuffer,
|
||||||
|
AllocationType::ringBuffer,
|
||||||
|
};
|
||||||
|
|
||||||
static const AllocationType allocationHaveNotToBeForcedTo48Bit[] = {
|
static const AllocationType allocationHaveNotToBeForcedTo48Bit[] = {
|
||||||
AllocationType::buffer,
|
AllocationType::buffer,
|
||||||
AllocationType::bufferHostMemory,
|
AllocationType::bufferHostMemory,
|
||||||
@@ -1105,3 +1129,9 @@ INSTANTIATE_TEST_CASE_P(NotForceTo48Bit,
|
|||||||
::testing::Combine(
|
::testing::Combine(
|
||||||
::testing::ValuesIn(allocationHaveNotToBeForcedTo48Bit),
|
::testing::ValuesIn(allocationHaveNotToBeForcedTo48Bit),
|
||||||
::testing::Bool()));
|
::testing::Bool()));
|
||||||
|
|
||||||
|
INSTANTIATE_TEST_CASE_P(OptionallyForceTo48Bit,
|
||||||
|
MemoryManagerGetAlloctionDataOptionallyForcedTo48BitTest,
|
||||||
|
::testing::Combine(
|
||||||
|
::testing::ValuesIn(allocationsOptionallyForcedTo48Bit),
|
||||||
|
::testing::Bool()));
|
||||||
|
|||||||
Reference in New Issue
Block a user