SWDEV-307185 - Create heap for device memory allocator

Pass the allocated heap with the kernel arguments

Change-Id: Icdec09b7f937845c39e21cbca7071dc3ba791af9
This commit is contained in:
German Andryeyev
2022-03-02 19:19:29 -05:00
parent a6bcb4435a
commit 7b114a2b8b
11 changed files with 103 additions and 29 deletions
+12 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (c) 2008 - 2021 Advanced Micro Devices, Inc.
/* Copyright (c) 2008 - 2022 Advanced Micro Devices, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -1086,7 +1086,6 @@ bool Device::populateOCLDeviceConstants() {
info_.uuid_[i] = unique_id[i+4];
}
}
if (HSA_STATUS_SUCCESS !=
hsa_agent_get_info(_bkendDevice,
(hsa_agent_info_t)HSA_AMD_AGENT_INFO_COOPERATIVE_COMPUTE_UNIT_COUNT,
@@ -1867,6 +1866,17 @@ device::Memory* Device::createMemory(amd::Memory& owner) const {
return memory;
}
// ================================================================================================
device::Memory* Device::createMemory(size_t size) const {
auto buffer = new roc::Buffer(*this, size);
static constexpr bool LocalAlloc = true;
if ((buffer == nullptr) || !buffer->create(LocalAlloc)) {
LogError("Couldn't allocate memory on device!");
return nullptr;
}
return buffer;
}
// ================================================================================================
void* Device::hostAlloc(size_t size, size_t alignment, MemorySegment mem_seg) const {
void* ptr = nullptr;