Skip to content

Commit 8f8cc8f

Browse files
committed
Fix 887
Backend destruction was done along with _hipUnregisterFatBinary. delay destruction by using destructor attribute
1 parent 1f94cd5 commit 8f8cc8f

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

src/CHIPBindings.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4968,9 +4968,6 @@ extern "C" void __hipUnregisterFatBinary(void *Data) {
49684968

49694969
logDebug("Modules left: {}", NumBins - 1);
49704970

4971-
if (Backend && NumBins == 1)
4972-
CHIPUninitialize();
4973-
49744971
CHIP_CATCH_NO_RETURN
49754972
}
49764973

src/CHIPDriver.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ extern void CHIPInitialize();
9191
* @brief
9292
* Singleton backend initialization function outer wrapper
9393
*/
94-
extern void CHIPUninitialize();
94+
__attribute__((destructor)) extern void CHIPUninitialize();
9595

9696
/**
9797
* @brief
@@ -175,7 +175,7 @@ private:
175175
Type Type_;
176176

177177
public:
178-
BackendType(){};
178+
BackendType() {};
179179
BackendType(const std::string &StrIn) {
180180
if (StrIn == "opencl") {
181181
Type_ = BackendType::OpenCL;

0 commit comments

Comments
 (0)