From 94352f3e24c16bfd6436b63dd2143d68e1e685d1 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Thu, 30 Sep 2021 03:03:45 -0500 Subject: [PATCH] Close KFD when failing due to debugger state. Change-Id: I6a6890fd9e86d27f87ae96de1c47c89d40a4e010 [ROCm/ROCR-Runtime commit: 234ef77e3212b4510e890d19a614a3530071b98e] --- .../runtime/hsa-runtime/core/runtime/amd_topology.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_topology.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_topology.cpp index db6a71dc19..36d49cf5dd 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_topology.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_topology.cpp @@ -372,6 +372,7 @@ bool Load() { if (hsaKmtOpenKFD() != HSAKMT_STATUS_SUCCESS) { return false; } + MAKE_NAMED_SCOPE_GUARD(kfd, [&]() { hsaKmtCloseKFD(); }); // Register runtime and optionally enable the debugger HSAKMT_STATUS err = @@ -382,6 +383,7 @@ bool Load() { // Build topology table. BuildTopology(); + kfd.Dismiss(); return true; }