SWDEV-380903 - Add program lock

Create seperate locks for program and HSAIL

Change-Id: I7c826ed9c2f2d839d359e5158f578830655616fd
Cette révision appartient à :
taosang2
2023-03-20 12:06:19 -04:00
révisé par Maneesh Gupta
Parent 7b419f42eb
révision 82d2213cfa
4 fichiers modifiés avec 29 ajouts et 31 suppressions
+7 -16
Voir le fichier
@@ -227,10 +227,6 @@ device::Program* Program::getDeviceProgram(const Device& device) const {
return it->second;
}
#if defined(WITH_COMPILER_LIB)
Monitor Program::buildLock_("OCL build program", true);
#endif
static bool adjustOptionsOnIgnoreEnv(std::string &cppstr) {
// if there is a -ignore-env, adjust options.
bool optionChangable = true;
@@ -252,9 +248,8 @@ int32_t Program::compile(const std::vector<Device*>& devices, size_t numHeaders,
const char** headerIncludeNames, const char* options,
void(CL_CALLBACK* notifyFptr)(cl_program, void*), void* data,
bool optionChangable) {
#if defined(WITH_COMPILER_LIB)
ScopedLock sl(!amd::IS_HIP && useHsail(devices) ? &buildLock_ : nullptr);
#endif
ScopedLock sl(&programLock_);
int32_t retval = CL_SUCCESS;
// Clear the program object
@@ -324,9 +319,8 @@ int32_t Program::link(const std::vector<Device*>& devices, size_t numInputs,
const std::vector<Program*>& inputPrograms, const char* options,
void(CL_CALLBACK* notifyFptr)(cl_program, void*), void* data,
bool optionChangable) {
#if defined(WITH_COMPILER_LIB)
ScopedLock sl(!amd::IS_HIP && useHsail(devices) ? &buildLock_ : nullptr);
#endif
ScopedLock sl(&programLock_);
int32_t retval = CL_SUCCESS;
if (symbolTable_ == NULL) {
@@ -494,9 +488,8 @@ void Program::StubProgramSource(const std::string& app_name) {
int32_t Program::build(const std::vector<Device*>& devices, const char* options,
void(CL_CALLBACK* notifyFptr)(cl_program, void*), void* data,
bool optionChangable, bool newDevProg) {
#if defined(WITH_COMPILER_LIB)
ScopedLock sl(!amd::IS_HIP && useHsail(devices) ? &buildLock_ : nullptr);
#endif
ScopedLock sl(&programLock_);
int32_t retval = CL_SUCCESS;
if (symbolTable_ == NULL) {
@@ -603,9 +596,7 @@ int32_t Program::build(const std::vector<Device*>& devices, const char* options,
}
bool Program::load(const std::vector<Device*>& devices) {
#if defined(WITH_COMPILER_LIB)
ScopedLock sl(!amd::IS_HIP && useHsail(devices) ? &buildLock_ : nullptr);
#endif
ScopedLock sl(&programLock_);
for (const auto& it : devicePrograms_) {
const Device& device = *(it.first);