mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-29 17:13:29 +08:00
refactor: decrease UsmMemAllocPoolsManager pool sizes in unit tests
Related-To: NEO-16082 Might fix NEO-16307 Signed-off-by: Aleksander Czerwionka <aleksander.czerwionka@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
a05ce05af6
commit
cfbbe04e32
@@ -171,7 +171,7 @@ uint64_t UsmMemAllocPool::getPoolAddress() const {
|
||||
return castToUint64(this->pool);
|
||||
}
|
||||
|
||||
UsmMemAllocPool::PoolInfo UsmMemAllocPool::getPoolInfo() const {
|
||||
PoolInfo UsmMemAllocPool::getPoolInfo() const {
|
||||
return poolInfo;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ bool UsmMemAllocPoolsManager::initialize(SVMAllocsManager *svmMemoryManager) {
|
||||
poolMemoryType != InternalMemoryType::hostUnifiedMemory);
|
||||
DEBUG_BREAK_IF(device == nullptr && poolMemoryType == InternalMemoryType::deviceUnifiedMemory);
|
||||
this->svmMemoryManager = svmMemoryManager;
|
||||
for (const auto &poolInfo : this->poolInfos) {
|
||||
for (const auto &poolInfo : PoolInfo::getPoolInfos()) {
|
||||
this->pools[poolInfo] = std::vector<std::unique_ptr<UsmMemAllocPool>>();
|
||||
auto pool = tryAddPool(poolInfo);
|
||||
if (nullptr == pool) {
|
||||
@@ -212,7 +212,7 @@ void *UsmMemAllocPoolsManager::createUnifiedMemoryAllocation(size_t size, const
|
||||
}
|
||||
std::unique_lock<std::mutex> lock(mtx);
|
||||
void *ptr = nullptr;
|
||||
for (const auto &poolInfo : this->poolInfos) {
|
||||
for (const auto &poolInfo : PoolInfo::getPoolInfos()) {
|
||||
if (size <= poolInfo.maxServicedSize) {
|
||||
for (auto &pool : this->pools[poolInfo]) {
|
||||
if (nullptr != (ptr = pool->createUnifiedMemoryAllocation(size, memoryProperties))) {
|
||||
@@ -247,6 +247,12 @@ bool UsmMemAllocPoolsManager::canAddPool(PoolInfo poolInfo) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UsmMemAllocPoolsManager::canBePooled(size_t size, const UnifiedMemoryProperties &memoryProperties) {
|
||||
return size <= PoolInfo::getMaxPoolableSize() &&
|
||||
UsmMemAllocPool::alignmentIsAllowed(memoryProperties.alignment) &&
|
||||
UsmMemAllocPool::flagsAreAllowed(memoryProperties);
|
||||
}
|
||||
|
||||
void UsmMemAllocPoolsManager::trimEmptyPools(PoolInfo poolInfo) {
|
||||
std::lock_guard lock(mtx);
|
||||
auto &bucket = pools[poolInfo];
|
||||
@@ -297,7 +303,7 @@ size_t UsmMemAllocPoolsManager::getOffsetInPool(const void *ptr) {
|
||||
|
||||
UsmMemAllocPool *UsmMemAllocPoolsManager::getPoolContainingAlloc(const void *ptr) {
|
||||
std::unique_lock<std::mutex> lock(mtx);
|
||||
for (const auto &poolInfo : this->poolInfos) {
|
||||
for (const auto &poolInfo : PoolInfo::getPoolInfos()) {
|
||||
for (auto &pool : this->pools[poolInfo]) {
|
||||
if (pool->isInPool(ptr)) {
|
||||
return pool.get();
|
||||
|
||||
Reference in New Issue
Block a user