mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-07 21:27:04 +08:00
Revert "fix: usm pool alignment check, use host ptr"
This reverts commit b0530e13e2.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
13abdc4372
commit
e9f1e05f31
@@ -70,7 +70,7 @@ void UsmMemAllocPool::cleanup() {
|
||||
}
|
||||
|
||||
bool UsmMemAllocPool::alignmentIsAllowed(size_t alignment) {
|
||||
return alignment <= poolAlignment;
|
||||
return alignment % chunkAlignment == 0 && alignment <= poolAlignment;
|
||||
}
|
||||
|
||||
bool UsmMemAllocPool::sizeIsAllowed(size_t size) {
|
||||
@@ -83,8 +83,7 @@ bool UsmMemAllocPool::flagsAreAllowed(const UnifiedMemoryProperties &memoryPrope
|
||||
flagsWithoutCompression.flags.uncompressedHint = 0u;
|
||||
|
||||
return flagsWithoutCompression.allFlags == 0u &&
|
||||
memoryProperties.allocationFlags.allAllocFlags == 0u &&
|
||||
memoryProperties.allocationFlags.hostptr == 0u;
|
||||
memoryProperties.allocationFlags.allAllocFlags == 0u;
|
||||
}
|
||||
|
||||
double UsmMemAllocPool::getPercentOfFreeMemoryForRecycling(InternalMemoryType memoryType) {
|
||||
|
||||
@@ -29,11 +29,10 @@ TEST_F(UnifiedMemoryPoolingStaticTest, givenUsmAllocPoolWhenCallingStaticMethods
|
||||
EXPECT_EQ(0.02, UsmMemAllocPool::getPercentOfFreeMemoryForRecycling(InternalMemoryType::hostUnifiedMemory));
|
||||
EXPECT_EQ(0.00, UsmMemAllocPool::getPercentOfFreeMemoryForRecycling(InternalMemoryType::sharedUnifiedMemory));
|
||||
|
||||
EXPECT_TRUE(UsmMemAllocPool::alignmentIsAllowed(UsmMemAllocPool::chunkAlignment / 2));
|
||||
EXPECT_TRUE(UsmMemAllocPool::alignmentIsAllowed(UsmMemAllocPool::chunkAlignment));
|
||||
EXPECT_TRUE(UsmMemAllocPool::alignmentIsAllowed(UsmMemAllocPool::chunkAlignment * 2));
|
||||
EXPECT_TRUE(UsmMemAllocPool::alignmentIsAllowed(UsmMemAllocPool::poolAlignment));
|
||||
EXPECT_FALSE(UsmMemAllocPool::alignmentIsAllowed(UsmMemAllocPool::poolAlignment * 2));
|
||||
EXPECT_FALSE(UsmMemAllocPool::alignmentIsAllowed(UsmMemAllocPool::chunkAlignment / 2));
|
||||
EXPECT_FALSE(UsmMemAllocPool::alignmentIsAllowed(UsmMemAllocPool::poolAlignment + UsmMemAllocPool::chunkAlignment));
|
||||
|
||||
const RootDeviceIndicesContainer rootDeviceIndices;
|
||||
const std::map<uint32_t, DeviceBitfield> deviceBitfields;
|
||||
@@ -45,10 +44,6 @@ TEST_F(UnifiedMemoryPoolingStaticTest, givenUsmAllocPoolWhenCallingStaticMethods
|
||||
unifiedMemoryProperties.allocationFlags.allFlags = 0u;
|
||||
unifiedMemoryProperties.allocationFlags.allAllocFlags = 1u;
|
||||
EXPECT_FALSE(UsmMemAllocPool::flagsAreAllowed(unifiedMemoryProperties));
|
||||
unifiedMemoryProperties.allocationFlags.allFlags = 0u;
|
||||
unifiedMemoryProperties.allocationFlags.allAllocFlags = 0u;
|
||||
unifiedMemoryProperties.allocationFlags.hostptr = 0x1u;
|
||||
EXPECT_FALSE(UsmMemAllocPool::flagsAreAllowed(unifiedMemoryProperties));
|
||||
}
|
||||
|
||||
using UnifiedMemoryPoolingTest = Test<SVMMemoryAllocatorFixture<true>>;
|
||||
@@ -281,7 +276,7 @@ TEST_F(InitializedHostUnifiedMemoryPoolingTest, givenDifferentAllocationSizesWhe
|
||||
EXPECT_FALSE(usmMemAllocPool.canBePooled(poolAllocationThreshold + 1, memoryProperties));
|
||||
|
||||
memoryProperties.allocationFlags.allAllocFlags = 0u;
|
||||
constexpr auto notAllowedAlignment = UsmMemAllocPool::poolAlignment * 2;
|
||||
constexpr auto notAllowedAlignment = UsmMemAllocPool::chunkAlignment / 2;
|
||||
memoryProperties.alignment = notAllowedAlignment;
|
||||
EXPECT_FALSE(usmMemAllocPool.canBePooled(poolAllocationThreshold, memoryProperties));
|
||||
EXPECT_FALSE(usmMemAllocPool.canBePooled(poolAllocationThreshold + 1, memoryProperties));
|
||||
@@ -305,11 +300,10 @@ TEST_F(InitializedHostUnifiedMemoryPoolingTest, givenVariousPointersWhenCallingI
|
||||
}
|
||||
|
||||
TEST_F(InitializedHostUnifiedMemoryPoolingTest, givenAlignmentsWhenCallingAlignmentIsAllowedThenCorrectValueIsReturned) {
|
||||
EXPECT_TRUE(usmMemAllocPool.alignmentIsAllowed(UsmMemAllocPool::chunkAlignment / 2));
|
||||
EXPECT_FALSE(usmMemAllocPool.alignmentIsAllowed(UsmMemAllocPool::chunkAlignment / 2));
|
||||
EXPECT_TRUE(usmMemAllocPool.alignmentIsAllowed(UsmMemAllocPool::chunkAlignment));
|
||||
EXPECT_FALSE(usmMemAllocPool.alignmentIsAllowed(UsmMemAllocPool::chunkAlignment + UsmMemAllocPool::chunkAlignment / 2));
|
||||
EXPECT_TRUE(usmMemAllocPool.alignmentIsAllowed(UsmMemAllocPool::chunkAlignment * 2));
|
||||
EXPECT_TRUE(usmMemAllocPool.alignmentIsAllowed(UsmMemAllocPool::poolAlignment));
|
||||
EXPECT_FALSE(usmMemAllocPool.alignmentIsAllowed(UsmMemAllocPool::poolAlignment * 2));
|
||||
}
|
||||
|
||||
TEST_F(InitializedHostUnifiedMemoryPoolingTest, givenPoolableAllocationWhenUsingPoolThenAllocationIsPooledUnlessPoolIsFull) {
|
||||
@@ -518,7 +512,7 @@ TEST_P(UnifiedMemoryPoolingManagerTest, givenUsmMemAllocPoolsManagerWhenCallingC
|
||||
EXPECT_TRUE(usmMemAllocPoolsManager->canBePooled(maxPoolableSize, unifiedMemoryProperties));
|
||||
EXPECT_FALSE(usmMemAllocPoolsManager->canBePooled(maxPoolableSize + 1, unifiedMemoryProperties));
|
||||
|
||||
unifiedMemoryProperties.alignment = UsmMemAllocPool::poolAlignment * 2;
|
||||
unifiedMemoryProperties.alignment = UsmMemAllocPool::chunkAlignment / 2;
|
||||
EXPECT_FALSE(usmMemAllocPoolsManager->canBePooled(maxPoolableSize, unifiedMemoryProperties));
|
||||
|
||||
unifiedMemoryProperties.alignment = UsmMemAllocPool::chunkAlignment;
|
||||
|
||||
Reference in New Issue
Block a user