SWDEV-255979 - Added support of __managed__ static variable

Change-Id: I9d5cbbecc8c19ec38a95c94ab4130465ba76c102


[ROCm/hip commit: 995e6336c6]
This commit is contained in:
agodavar
2021-02-16 07:20:58 -05:00
zatwierdzone przez Anusha Godavarthy Surya
rodzic db0c3fdaaf
commit 39c608e98d
11 zmienionych plików z 202 dodań i 16 usunięć
+4 -4
Wyświetl plik
@@ -25,8 +25,8 @@
#include "platform/command.hpp"
#include "platform/memory.hpp"
// Forward declaraiton of a static function
static hipError_t ihipMallocManaged(void** ptr, size_t size);
// Forward declaraiton of a function
hipError_t ihipMallocManaged(void** ptr, size_t size, unsigned int align = 0);
// Make sure HIP defines match ROCclr to avoid double conversion
static_assert(hipCpuDeviceId == amd::CpuDeviceId, "CPU device ID mismatch with ROCclr!");
@@ -186,7 +186,7 @@ hipError_t hipStreamAttachMemAsync(hipStream_t stream, hipDeviceptr_t* dev_ptr,
}
// ================================================================================================
static hipError_t ihipMallocManaged(void** ptr, size_t size) {
hipError_t ihipMallocManaged(void** ptr, size_t size, unsigned int align) {
if (size == 0) {
*ptr = nullptr;
return hipSuccess;
@@ -207,7 +207,7 @@ static hipError_t ihipMallocManaged(void** ptr, size_t size) {
// Allocate SVM fine grain buffer with the forced host pointer, avoiding explicit memory
// allocation in the device driver
*ptr = amd::SvmBuffer::malloc(ctx, CL_MEM_SVM_FINE_GRAIN_BUFFER | CL_MEM_ALLOC_HOST_PTR,
size, dev.info().memBaseAddrAlign_);
size, (align == 0) ? dev.info().memBaseAddrAlign_ : align);
if (*ptr == nullptr) {
return hipErrorMemoryAllocation;
}