From 6789a0f3bd71fc86631967b2fd4b268461e940da Mon Sep 17 00:00:00 2001 From: Alex Sierra Date: Mon, 31 Oct 2022 21:29:39 +0000 Subject: [PATCH] libhsakmt: add env var to en/dis registration through SVM Setting this variable to '0' will force to disable memory registration/allocation through SVM API mechanism. Not setting this or setting to '1', SVM API will be used only if all GPUs support it. Signed-off-by: Alex Sierra Change-Id: Icdf7656de09aa9988b567ec6c024953398e9bb48 [ROCm/ROCR-Runtime commit: 8a746bdaed664ef7884f0a2726b6843d1c39b1c0] --- projects/rocr-runtime/src/fmm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/rocr-runtime/src/fmm.c b/projects/rocr-runtime/src/fmm.c index b2ce7da43e..67d0d0bb09 100644 --- a/projects/rocr-runtime/src/fmm.c +++ b/projects/rocr-runtime/src/fmm.c @@ -2263,7 +2263,7 @@ HSAKMT_STATUS fmm_init_process_apertures(unsigned int NumNodes) uint32_t num_of_sysfs_nodes; HSAKMT_STATUS ret = HSAKMT_STATUS_SUCCESS; char *disableCache, *pagedUserptr, *checkUserptr, *guardPagesStr, *reserveSvm; - char *maxVaAlignStr; + char *maxVaAlignStr, *useSvmStr; unsigned int guardPages = 1; uint64_t svm_base = 0, svm_limit = 0; uint32_t svm_alignment = 0; @@ -2302,6 +2302,9 @@ HSAKMT_STATUS fmm_init_process_apertures(unsigned int NumNodes) if (!maxVaAlignStr || sscanf(maxVaAlignStr, "%u", &svm.alignment_order) != 1) svm.alignment_order = 9; + useSvmStr = getenv("HSA_USE_SVM"); + svm.is_svm_api_supported = !(useSvmStr && !strcmp(useSvmStr, "0")); + gpu_mem_count = 0; g_first_gpu_mem = NULL; @@ -2319,7 +2322,6 @@ HSAKMT_STATUS fmm_init_process_apertures(unsigned int NumNodes) */ is_dgpu = false; - svm.is_svm_api_supported = true; for (i = 0; i < NumNodes; i++) { HsaNodeProperties props;