From a2fb1cbfbcecc07c4e90d3bca88754c5e2da4832 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Thu, 30 Sep 2021 21:05:39 -0500 Subject: [PATCH] Correct GetSvmAttrib coherency query. Early exit if the range is found to be fine grain. Indeterminate should only apply if the range is neither coarse nor fine. Change-Id: I54133e14f4e8cfa53e2d612f6112cdcdb5a47dfa --- runtime/hsa-runtime/core/runtime/runtime.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/hsa-runtime/core/runtime/runtime.cpp b/runtime/hsa-runtime/core/runtime/runtime.cpp index 22b8e0486b..59980fa928 100644 --- a/runtime/hsa-runtime/core/runtime/runtime.cpp +++ b/runtime/hsa-runtime/core/runtime/runtime.cpp @@ -1895,8 +1895,10 @@ hsa_status_t Runtime::GetSvmAttrib(void* ptr, size_t size, switch (attrib) { case HSA_AMD_SVM_ATTRIB_GLOBAL_FLAG: { - if (attribs[attribs.size() - 1].value & HSA_SVM_FLAG_COHERENT) + if (attribs[attribs.size() - 1].value & HSA_SVM_FLAG_COHERENT) { value = HSA_AMD_SVM_GLOBAL_FLAG_FINE_GRAINED; + break; + } if (attribs[attribs.size() - 2].value & HSA_SVM_FLAG_COHERENT) value = HSA_AMD_SVM_GLOBAL_FLAG_COARSE_GRAINED; else