SWDEV-329646 - MicroStation app crash upon closing

Change-Id: Ie3422788c80b233c836e319c355214ca076e5d4f


[ROCm/clr commit: 3d514c85b9]
Bu işleme şunda yer alıyor:
Alex (Bin) Xie
2022-04-20 11:57:24 -04:00
işlemeyi yapan: Alex Xie
ebeveyn 1320312a62
işleme ad6b22597e
3 değiştirilmiş dosya ile 17 ekleme ve 2 silme
+7 -2
Dosyayı Görüntüle
@@ -27,6 +27,7 @@
#include "platform/perfctr.hpp"
#include "platform/threadtrace.hpp"
#include "platform/memory.hpp"
#include "platform/runtime.hpp"
#include "utils/concurrent.hpp"
#include "thread/thread.hpp"
#include "thread/monitor.hpp"
@@ -405,8 +406,12 @@ class Device : public NullDevice {
//! Free resource cache on device if OCL context was destroyed.
//! @note: Backend device doesn't track resources per context and releases all resources, regardless
//! the number of still active contexts
virtual void ContextDestroy() { resourceCache().free(); }
virtual void ContextDestroy() {
// The if condition is a best effort to avoid crash if the function is called after DLL detached
if (!amd::Runtime::isLibraryDetached()) {
resourceCache().free();
}
}
//! Validates kernel before execution
virtual bool validateKernel(const amd::Kernel& kernel, //!< AMD kernel object
const device::VirtualDevice* vdev, bool coop_group = false);
+1
Dosyayı Görüntüle
@@ -46,6 +46,7 @@
namespace amd {
volatile bool Runtime::initialized_ = false;
bool Runtime::LibraryDetached = false;
bool Runtime::init() {
if (initialized_) {
+9
Dosyayı Görüntüle
@@ -32,6 +32,7 @@ namespace amd {
class Runtime : AllStatic {
static volatile bool initialized_;
static bool LibraryDetached;
public:
//! Return true if the OpencCL runtime is already initialized
@@ -45,6 +46,14 @@ class Runtime : AllStatic {
//! Return true if the Runtime is still single-threaded.
static bool singleThreaded() { return !initialized(); }
//! Return whether the library is detached by OS
static bool isLibraryDetached() { return LibraryDetached; }
//! Set the library has been detached.
static void setLibraryDetached() {
LibraryDetached = true;
}
};
#if 0