From cf6745a36c5fc51f61bc3fa268ed02fa3ae6d02b Mon Sep 17 00:00:00 2001 From: Philip Yang Date: Wed, 4 Oct 2023 08:41:18 -0400 Subject: [PATCH] libhsakmt: Set CWSR range granularity Set CWSR svm range granularity to 0xff, then KFD will migrate the entire CWSR range from VRAM back to system memory when recovering the CPU page fault if rocgdb access CWSR area, this avoid the partial CWSR range migration and stall CWSR GPU mapping issue. This is a temporary workaround, it should be reverted once the KFD is fixed. Change-Id: I80a7248244574edba25b13858b7ebcf1c77b8930 Signed-off-by: Philip Yang [ROCm/ROCR-Runtime commit: 85a47fa66b2c9506809ab3552873227597682543] --- projects/rocr-runtime/src/queues.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/rocr-runtime/src/queues.c b/projects/rocr-runtime/src/queues.c index 992290c791..f62e862b03 100644 --- a/projects/rocr-runtime/src/queues.c +++ b/projects/rocr-runtime/src/queues.c @@ -413,7 +413,7 @@ static HSAKMT_STATUS register_svm_range(void *mem, uint32_t size, flags |= HSA_SVM_FLAG_GPU_ALWAYS_MAPPED; } - nattr = 5; + nattr = 6; s_attr = sizeof(*attrs) * nattr; attrs = (HSA_SVM_ATTRIBUTE *)alloca(s_attr); @@ -427,6 +427,8 @@ static HSAKMT_STATUS register_svm_range(void *mem, uint32_t size, attrs[3].value = flags; attrs[4].type = HSA_SVM_ATTR_ACCESS; attrs[4].value = gpuNode; + attrs[5].type = HSA_SVM_ATTR_GRANULARITY; + attrs[5].value = 0xFF; return hsaKmtSVMSetAttr(mem, size, nattr, attrs); }