2
0

libhsakmt: add new flag for memory mapped as uncached

It is to provide an option to map specific memory as
uncached on A+A HW platform.

Signed-off-by: Eric Huang <JinhuiEric.Huang@amd.com>
Change-Id: Ib665cb306a0e78aba3ea5ee2f0e46cb62ae139f8


[ROCm/ROCR-Runtime commit: 2464bfc714]
Este cometimento está contido em:
Eric Huang
2020-05-12 15:12:52 -04:00
cometido por Kent Russell
ascendente 61cb037044
cometimento 9f7ae5b9e2
3 ficheiros modificados com 11 adições e 3 eliminações
+2 -1
Ver ficheiro
@@ -541,7 +541,8 @@ typedef struct _HsaMemFlags
// and optimal alignment requirements
unsigned int FixedAddress : 1; // Allocate memory at specified virtual address. Fail if address is not free.
unsigned int NoNUMABind: 1; // Don't bind system memory to a specific NUMA node
unsigned int Reserved : 15;
unsigned int Uncached: 1; // Caching flag for fine-grained memory on A+A HW platform
unsigned int Reserved : 14;
} ui32;
HSAuint32 Value;
+1
Ver ficheiro
@@ -479,6 +479,7 @@ struct kfd_ioctl_acquire_vm_args {
#define KFD_IOC_ALLOC_MEM_FLAGS_NO_SUBSTITUTE (1 << 28)
#define KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM (1 << 27)
#define KFD_IOC_ALLOC_MEM_FLAGS_COHERENT (1 << 26)
#define KFD_IOC_ALLOC_MEM_FLAGS_UNCACHED (1 << 25)
/* Allocate memory for later SVM (shared virtual memory) mapping.
*
+8 -2
Ver ficheiro
@@ -1334,8 +1334,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 || svm.disable_cache) {
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_COHERENT;
if (flags.ui32.Uncached)
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_UNCACHED;
}
mem = __fmm_allocate_device(gpu_id, address, size, aperture, &mmap_offset,
ioc_flags, &vm_obj);
@@ -1540,8 +1543,11 @@ 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 || svm.disable_cache) {
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_COHERENT;
if (flags.ui32.Uncached)
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_UNCACHED;
}
ioc_flags |= fmm_translate_hsa_to_ioc_flags(flags);
if (flags.ui32.AQLQueueMemory)