From faa5102340acb9901f0926f32b103de043c46442 Mon Sep 17 00:00:00 2001 From: Harish Kasiviswanathan Date: Mon, 24 Jul 2017 15:12:24 -0400 Subject: [PATCH] Support IPC sharing of non paged system memory Non paged system memory is allocated with node id 0. However, since a gpu node is required for allocating system memory via KFD, the first dgpu is used. In hsaKmtShareMemory() if system memory use the same (first) dgpu. Change-Id: I85789a89a4e4f7888e3826826401ea89ce4d1718 Signed-off-by: Harish Kasiviswanathan [ROCm/ROCR-Runtime commit: 186527d0b7b9eb5e7ddb7dbb11f16799ac92d086] --- projects/rocr-runtime/src/fmm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/rocr-runtime/src/fmm.c b/projects/rocr-runtime/src/fmm.c index cbec8c9a6c..5695ece5b4 100644 --- a/projects/rocr-runtime/src/fmm.c +++ b/projects/rocr-runtime/src/fmm.c @@ -2597,7 +2597,14 @@ HSAKMT_STATUS fmm_share_memory(void *MemoryAddress, r = validate_nodeid(obj->node_id, &gpu_id); if (r != HSAKMT_STATUS_SUCCESS) return r; - + if (!gpu_id && is_dgpu) { + /* Sharing non paged system memory. Use first dgpu which was + * used during allocation. See fmm_allocate_host_gpu() + */ + r = find_first_dgpu(&gpu_id); + if (r != HSAKMT_STATUS_SUCCESS) + return r; + } exportArgs.handle = obj->handle; exportArgs.gpu_id = gpu_id;