Make GPU mapping of memory as uncached if HSA_DISABLE_CACHE is set
Before gfx90a, coherent memory is uncached. So it was reasonable
when environment variable HSA_DISABLE_CACHE is set, memory is mapped
as coherent. On gfx90a, coherent memory can be cached, so mapping
memory as coherent can't guarantee memory is uncached. When
HSA_DISABLE_CACHE is set, we have to map memory as uncached.
Change-Id: Ia5ed4cf0ad6aef5644dc8c9e6632b52d606f06f4
Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
[ROCm/ROCR-Runtime commit: f132fb2cd0]
This commit is contained in:
@@ -1335,11 +1335,11 @@ void *fmm_allocate_device(uint32_t gpu_id, void *address, uint64_t MemorySizeInB
|
||||
aperture = &gpu_mem[gpu_mem_id].gpuvm_aperture;
|
||||
}
|
||||
|
||||
if (!flags.ui32.CoarseGrain || svm.disable_cache) {
|
||||
if (!flags.ui32.CoarseGrain)
|
||||
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_COHERENT;
|
||||
if (flags.ui32.Uncached)
|
||||
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_UNCACHED;
|
||||
}
|
||||
|
||||
if (flags.ui32.Uncached || svm.disable_cache)
|
||||
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_UNCACHED;
|
||||
|
||||
mem = __fmm_allocate_device(gpu_id, address, size, aperture, &mmap_offset,
|
||||
ioc_flags, &vm_obj);
|
||||
@@ -1544,11 +1544,12 @@ static void *fmm_allocate_host_gpu(uint32_t node_id, void *address,
|
||||
else
|
||||
aperture = svm.dgpu_alt_aperture; /* always coherent */
|
||||
|
||||
if (!flags.ui32.CoarseGrain || svm.disable_cache) {
|
||||
if (!flags.ui32.CoarseGrain)
|
||||
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_COHERENT;
|
||||
if (flags.ui32.Uncached)
|
||||
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_UNCACHED;
|
||||
}
|
||||
|
||||
if (flags.ui32.Uncached || svm.disable_cache)
|
||||
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_UNCACHED;
|
||||
|
||||
ioc_flags |= fmm_translate_hsa_to_ioc_flags(flags);
|
||||
|
||||
if (flags.ui32.AQLQueueMemory)
|
||||
|
||||
Reference in New Issue
Block a user