mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-22 10:17:01 +08:00
Revert "performance: Prefer to assign new gpu va rather than reuse"
This reverts commit 0f2f3c3764.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
45a26c22dd
commit
aca7875dfd
@@ -36,34 +36,32 @@ uint64_t HeapAllocator::allocateWithCustomAlignment(size_t &sizeToAllocate, size
|
||||
uint32_t defragmentCount = 0;
|
||||
|
||||
for (;;) {
|
||||
uint64_t ptrReturn = 0llu;
|
||||
|
||||
if (sizeToAllocate > sizeThreshold) {
|
||||
const uint64_t misalignment = alignUp(pLeftBound, alignment) - pLeftBound;
|
||||
if (pLeftBound + misalignment + sizeToAllocate <= pRightBound) {
|
||||
if (misalignment) {
|
||||
storeInFreedChunks(pLeftBound, static_cast<size_t>(misalignment), freedChunks);
|
||||
pLeftBound += misalignment;
|
||||
}
|
||||
ptrReturn = pLeftBound;
|
||||
pLeftBound += sizeToAllocate;
|
||||
}
|
||||
} else {
|
||||
const uint64_t pStart = pRightBound - sizeToAllocate;
|
||||
const uint64_t misalignment = pStart - alignDown(pStart, alignment);
|
||||
if (pLeftBound + sizeToAllocate + misalignment <= pRightBound) {
|
||||
if (misalignment) {
|
||||
pRightBound -= misalignment;
|
||||
storeInFreedChunks(pRightBound, static_cast<size_t>(misalignment), freedChunks);
|
||||
}
|
||||
pRightBound -= sizeToAllocate;
|
||||
ptrReturn = pRightBound;
|
||||
}
|
||||
}
|
||||
|
||||
size_t sizeOfFreedChunk = 0;
|
||||
uint64_t ptrReturn = getFromFreedChunks(sizeToAllocate, freedChunks, sizeOfFreedChunk, alignment);
|
||||
|
||||
if (ptrReturn == 0llu) {
|
||||
ptrReturn = getFromFreedChunks(sizeToAllocate, freedChunks, sizeOfFreedChunk, alignment);
|
||||
if (sizeToAllocate > sizeThreshold) {
|
||||
const uint64_t misalignment = alignUp(pLeftBound, alignment) - pLeftBound;
|
||||
if (pLeftBound + misalignment + sizeToAllocate <= pRightBound) {
|
||||
if (misalignment) {
|
||||
storeInFreedChunks(pLeftBound, static_cast<size_t>(misalignment), freedChunks);
|
||||
pLeftBound += misalignment;
|
||||
}
|
||||
ptrReturn = pLeftBound;
|
||||
pLeftBound += sizeToAllocate;
|
||||
}
|
||||
} else {
|
||||
const uint64_t pStart = pRightBound - sizeToAllocate;
|
||||
const uint64_t misalignment = pStart - alignDown(pStart, alignment);
|
||||
if (pLeftBound + sizeToAllocate + misalignment <= pRightBound) {
|
||||
if (misalignment) {
|
||||
pRightBound -= misalignment;
|
||||
storeInFreedChunks(pRightBound, static_cast<size_t>(misalignment), freedChunks);
|
||||
}
|
||||
pRightBound -= sizeToAllocate;
|
||||
ptrReturn = pRightBound;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ptrReturn != 0llu) {
|
||||
|
||||
Reference in New Issue
Block a user