SWDEV-456279 - Adding new hip flag to access contiguous memory and pass the flag to HSA API.

Change-Id: I1bafeaa3096395c729723af958d609bc41e7845c


[ROCm/clr commit: 1d48f2a1ab]
This commit is contained in:
Jaydeep Patel
2024-04-12 08:58:46 +00:00
کامیت شده توسط Jaydeepkumar Patel
والد af5aaa806f
کامیت ab70925687
6فایلهای تغییر یافته به همراه15 افزوده شده و 4 حذف شده
@@ -2331,7 +2331,8 @@ void Device::deviceVmemRelease(uint64_t mem_handle) const {
}
}
void* Device::deviceLocalAlloc(size_t size, bool atomics, bool pseudo_fine_grain) const {
void* Device::deviceLocalAlloc(size_t size, bool atomics, bool pseudo_fine_grain,
bool contiguous) const {
const hsa_amd_memory_pool_t& pool = (pseudo_fine_grain) ? gpu_ext_fine_grained_segment_
: (atomics) ? gpu_fine_grained_segment_ : gpuvm_segment_;
@@ -2341,6 +2342,11 @@ void* Device::deviceLocalAlloc(size_t size, bool atomics, bool pseudo_fine_grain
return nullptr;
}
uint32_t hsa_mem_flags = 0;
if (contiguous) {
hsa_mem_flags = HSA_AMD_MEMORY_POOL_CONTIGUOUS_FLAG;
}
void* ptr = nullptr;
hsa_status_t stat = hsa_amd_memory_pool_allocate(pool, size, 0, &ptr);
ClPrint(amd::LOG_DEBUG, amd::LOG_MEM, "Allocate hsa device memory %p, size 0x%zx", ptr, size);