SWDEV-507019 - Change the function lock to the module lock

Multiple functions can be located in the same module.

Change-Id: Ia4ca3db64fe5b0822584059d3770c91103665c63


[ROCm/clr commit: 45a12208b6]
This commit is contained in:
German Andryeyev
2025-01-08 15:54:51 -05:00
parent ef2a812d0a
commit 5a76761960
3 changed files with 5 additions and 2 deletions
+4
View File
@@ -109,6 +109,9 @@ public:
return hipSuccess;
}
//! Returns the lock for this fatbinary access
amd::Monitor& FatBinaryLock() { return fb_lock_; }
private:
std::string fname_; //!< File name
amd::Os::FileDesc fdesc_; //!< File descriptor
@@ -126,6 +129,7 @@ private:
std::vector<FatBinaryDeviceInfo*> fatbin_dev_info_;
std::shared_ptr<UniqueFD> ufd_; //!< Unique file descriptor
amd::Monitor fb_lock_{true}; //!< Lock for the fat binary access
};
}; // namespace hip
+1 -1
View File
@@ -162,7 +162,7 @@ hipError_t Function::getStatFunc(hipFunction_t* hfunc, int deviceId) {
*hfunc = dFunc_[deviceId]->asHipFunction();
return hipSuccess;
}
amd::ScopedLock lock(fc_lock_);
amd::ScopedLock lock((*modules_)->FatBinaryLock());
// Check for the compiled kernel again, to make sure only one thread does compilation
if (dFunc_[deviceId] != nullptr) {
*hfunc = dFunc_[deviceId]->asHipFunction();
-1
View File
@@ -96,7 +96,6 @@ private:
std::vector<DeviceFunc*> dFunc_; //!< DeviceFuncObj per Device
std::string name_; //!< name of the func(not unique identifier)
FatBinaryInfo** modules_; //!< static module where it is referenced
amd::Monitor fc_lock_{true}; //!< Lock for the function create
};
class Var {