[CPU] MEMC loading failed RuntimeError: There should be only one inst… (#15380)
* [CPU] MEMC loading failed RuntimeError: There should be only one instance of RegistersPool per thread. * Fixes as per comments.
This commit is contained in:
parent
5388a6f2af
commit
d167f4c733
@ -30,6 +30,7 @@ using namespace dnnl::impl::cpu;
|
||||
class RegistersPool {
|
||||
public:
|
||||
using Ptr = std::shared_ptr<RegistersPool>;
|
||||
using WeakPtr = std::weak_ptr<RegistersPool>;
|
||||
static constexpr int anyIdx = -1;
|
||||
|
||||
/**
|
||||
@ -65,12 +66,12 @@ public:
|
||||
return lhs.operator Xbyak::RegExp() + rhs;
|
||||
}
|
||||
void release() {
|
||||
if (regPool) {
|
||||
regPool->returnToPool(reg);
|
||||
if (auto pool = regPool.lock()) {
|
||||
pool->returnToPool(reg);
|
||||
regPool.reset();
|
||||
}
|
||||
}
|
||||
bool isInitialized() const { return static_cast<bool>(regPool); }
|
||||
bool isInitialized() const { return !regPool.expired(); }
|
||||
|
||||
private:
|
||||
void ensureValid() const {
|
||||
@ -91,7 +92,7 @@ public:
|
||||
|
||||
private:
|
||||
TReg reg;
|
||||
RegistersPool::Ptr regPool;
|
||||
RegistersPool::WeakPtr regPool;
|
||||
};
|
||||
|
||||
virtual ~RegistersPool() {
|
||||
|
Loading…
Reference in New Issue
Block a user