From 58e18670792013fa87e17baac75e0ef8ce4d25ea Mon Sep 17 00:00:00 2001 From: haoyuan2 Date: Fri, 25 Feb 2022 11:30:22 -0800 Subject: [PATCH] SWDEV-298331 - Fix FreeLibrary throw exception issue on Windows release HIP resource at DLL_PROCESS_DETACH point Change-Id: I884ab028eeec1aaa2f655746f7eeae130fd009e4 --- rocclr/platform/runtime.cpp | 3 ++- rocclr/platform/runtime.hpp | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/rocclr/platform/runtime.cpp b/rocclr/platform/runtime.cpp index 63dfa37de6..c3ecae6b51 100644 --- a/rocclr/platform/runtime.cpp +++ b/rocclr/platform/runtime.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2008 - 2021 Advanced Micro Devices, Inc. +/* Copyright (c) 2008 - 2022 Advanced Micro Devices, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -142,6 +142,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) { #endif // DEBUG break; case DLL_PROCESS_DETACH: + amd::shutDown(); break; case DLL_THREAD_DETACH: { amd::Thread* thread = amd::Thread::current(); diff --git a/rocclr/platform/runtime.hpp b/rocclr/platform/runtime.hpp index 60ab44e1db..3f33dfd455 100644 --- a/rocclr/platform/runtime.hpp +++ b/rocclr/platform/runtime.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2008 - 2021 Advanced Micro Devices, Inc. +/* Copyright (c) 2008 - 2022 Advanced Micro Devices, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -82,6 +82,8 @@ public: inline bool Runtime::initialized() { return initialized_; } +extern void shutDown(); + } // namespace amd #endif /*RUNTIME_HPP_*/