Skip to content

Commit

Permalink
SWDEV-447525 - maxSize param for Mem pool props.
Browse files Browse the repository at this point in the history
Change-Id: Ib743611a66921aeaa449b6622b933cc8b9190d87
  • Loading branch information
jaydeeppatel1111 committed Mar 13, 2024
1 parent f1adecd commit b72d8da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hipamd/src/hip_mempool_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ void* MemoryPool::AllocateMemory(size_t size, Stream* stream, void* dptr) {
void* dev_ptr = nullptr;
amd::Memory* memory = free_heap_.FindMemory(size, stream, Opportunistic(), dptr);
if (memory == nullptr) {
if (Properties().maxSize != 0 && (max_total_size_ + size) > Properties().maxSize) {
return nullptr;
}
amd::Context* context = device_->asContext();
const auto& dev_info = context->devices()[0]->info();
if (dev_info.maxMemAllocSize_ < size) {
Expand Down
1 change: 1 addition & 0 deletions hipamd/src/hip_mempool_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ class MemoryPool : public amd::ReferenceCountedObject {
.handleTypes = hipMemHandleTypeNone,
.location = {.type = hipMemLocationTypeDevice, .id = device_->deviceId()},
.win32SecurityAttributes = nullptr,
.maxSize = 0;
.reserved = {}};
}
state_.interprocess_ = properties_.handleTypes != hipMemHandleTypeNone;
Expand Down

0 comments on commit b72d8da

Please sign in to comment.