libhsakmt: Support contiguous VRAM allocation flag
Add HsaMemFlags Contiguous bit for hsaKmtAllocMemory to allocate
contiguous VRAM, to support RDMA device with limited scatter-gather
ability.
Check KFD ioctl minor version >= 17.
Change-Id: I0db00dad125b2b7be523f343082641f59b850423
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
[ROCm/ROCR-Runtime commit: 97497c7efc]
Bu işleme şunda yer alıyor:
@@ -569,7 +569,8 @@ typedef struct _HsaMemFlags
|
||||
unsigned int ExtendedCoherent: 1; // system-scope coherence on atomic instructions
|
||||
unsigned int GTTAccess: 1; // default = 0; If 1: The caller indicates this memory will be mapped to GART for MES
|
||||
// KFD will allocate GTT memory with the Preferred_node set as gpu_id for GART mapping
|
||||
unsigned int Reserved: 10;
|
||||
unsigned int Contiguous: 1; // Allocate contiguous VRAM
|
||||
unsigned int Reserved: 9;
|
||||
|
||||
} ui32;
|
||||
HSAuint32 Value;
|
||||
|
||||
@@ -1029,6 +1029,7 @@ struct kfd_ioctl_acquire_vm_args {
|
||||
#define KFD_IOC_ALLOC_MEM_FLAGS_COHERENT (1 << 26)
|
||||
#define KFD_IOC_ALLOC_MEM_FLAGS_UNCACHED (1 << 25)
|
||||
#define KFD_IOC_ALLOC_MEM_FLAGS_EXT_COHERENT (1 << 24)
|
||||
#define KFD_IOC_ALLOC_MEM_FLAGS_CONTIGUOUS_BEST_EFFORT (1 << 23)
|
||||
|
||||
/* Allocate memory for later SVM (shared virtual memory) mapping.
|
||||
*
|
||||
|
||||
@@ -1579,6 +1579,9 @@ void *fmm_allocate_device(uint32_t gpu_id, uint32_t node_id, void *address,
|
||||
if (mflags.ui32.ExtendedCoherent)
|
||||
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_EXT_COHERENT;
|
||||
|
||||
if (mflags.ui32.Contiguous)
|
||||
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_CONTIGUOUS_BEST_EFFORT;
|
||||
|
||||
mem = __fmm_allocate_device(gpu_id, address, size, aperture, &mmap_offset,
|
||||
ioc_flags, &vm_obj);
|
||||
|
||||
|
||||
@@ -115,6 +115,9 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtAllocMemory(HSAuint32 PreferredNode,
|
||||
|
||||
CHECK_KFD_OPEN();
|
||||
|
||||
if (MemFlags.ui32.Contiguous)
|
||||
CHECK_KFD_MINOR_VERSION(17);
|
||||
|
||||
pr_debug("[%s] node %d\n", __func__, PreferredNode);
|
||||
|
||||
result = validate_nodeid(PreferredNode, &gpu_id);
|
||||
|
||||
Yeni konuda referans
Bir kullanıcı engelle