SWDEV-380903 - Add program lock

Create seperate locks for program and HSAIL

Change-Id: I7c826ed9c2f2d839d359e5158f578830655616fd


[ROCm/clr commit: 82d2213cfa]
Αυτή η υποβολή περιλαμβάνεται σε:
taosang2
2023-03-20 12:06:19 -04:00
υποβλήθηκε από Maneesh Gupta
γονέας 67536316e7
υποβολή 632822bdf5
4 αρχεία άλλαξαν με 29 προσθήκες και 31 διαγραφές
@@ -119,6 +119,8 @@ class Program : public RuntimeObject {
std::string programLog_; //!< Log for parsing options, etc.
Monitor programLock_; //!< Lock to protect program data structure
protected:
//! Destroy this program.
~Program();
@@ -126,19 +128,6 @@ class Program : public RuntimeObject {
//! Clears the program object if the app attempts to rebuild the program
void clear();
#if defined(WITH_COMPILER_LIB)
//! Global HSAIL build lock (remove when HSAIL is thread-safe).
static Monitor buildLock_;
//! Check if any device uses HSAIL
bool useHsail(const std::vector<Device*>& devices) const {
for (const auto& it : devices) {
if (!it->settings().useLightning_) return true;
}
return false;
}
#endif
public:
//! Construct a new program to be compiled from the given source code.
Program(Context& context, const std::string& sourceCode, Language language,
@@ -147,7 +136,8 @@ class Program : public RuntimeObject {
sourceCode_(sourceCode),
language_(language),
symbolTable_(NULL),
programLog_() {
programLog_(),
programLock_("Program lock", true) {
for (auto i = 0; i != numHeaders; ++i) {
headers_.emplace_back(headers[i]);
headerNames_.emplace_back(headerNames[i]);
@@ -157,7 +147,8 @@ class Program : public RuntimeObject {
//! Construct a new program associated with a context.
Program(Context& context, Language language = Binary)
: context_(context), language_(language),
symbolTable_(NULL) {}
symbolTable_(NULL),
programLock_("Program lock", true) {}
//! Returns context, associated with the current program.
const Context& context() const { return context_(); }