SWDEV-321723 - Refactor hipHostMalloc flags
Always choose fing grain memory pool for hipHostMalloc Choose coarse grain only if hipHostMallocNonCoherent is passed. Change-Id: I9a67ba77335d4f373d32fea4ecd7848c77f9c190
This commit is contained in:
@@ -510,15 +510,15 @@ hipError_t hipHostMalloc(void** ptr, size_t sizeBytes, unsigned int flags) {
|
|||||||
HIP_RETURN(hipErrorInvalidValue);
|
HIP_RETURN(hipErrorInvalidValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int ihipFlags = CL_MEM_SVM_FINE_GRAIN_BUFFER | (flags << 16);
|
// Always choose finegrain memory for hipHostMalloc
|
||||||
if (flags == 0 ||
|
unsigned int ihipFlags = CL_MEM_SVM_ATOMICS | CL_MEM_SVM_FINE_GRAIN_BUFFER | (flags << 16);
|
||||||
flags & (hipHostMallocCoherent | hipHostMallocMapped) ||
|
|
||||||
(!(flags & hipHostMallocNonCoherent) && HIP_HOST_COHERENT)) {
|
|
||||||
ihipFlags |= CL_MEM_SVM_ATOMICS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & hipHostMallocNumaUser) {
|
if (flags & hipHostMallocNumaUser) {
|
||||||
ihipFlags |= CL_MEM_FOLLOW_USER_NUMA_POLICY | CL_MEM_SVM_ATOMICS;
|
ihipFlags |= CL_MEM_FOLLOW_USER_NUMA_POLICY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags & hipHostMallocNonCoherent) {
|
||||||
|
ihipFlags &= ~CL_MEM_SVM_ATOMICS;
|
||||||
}
|
}
|
||||||
|
|
||||||
HIP_RETURN_DURATION(ihipMalloc(ptr, sizeBytes, ihipFlags), *ptr);
|
HIP_RETURN_DURATION(ihipMalloc(ptr, sizeBytes, ihipFlags), *ptr);
|
||||||
|
|||||||
Reference in New Issue
Block a user