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

Change-Id: I1bafeaa3096395c729723af958d609bc41e7845c
This commit is contained in:
Jaydeep Patel
2024-04-12 08:58:46 +00:00
committato da Jaydeepkumar Patel
parent 08889f438f
commit 1d48f2a1ab
6 ha cambiato i file con 15 aggiunte e 4 eliminazioni
+7 -1
Vedi File
@@ -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);