Index: openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp =================================================================== --- openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp +++ openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp @@ -155,7 +155,14 @@ OMPX_InitialNumStreams("LIBOMPTARGET_NUM_INITIAL_STREAMS", 32), OMPX_InitialNumEvents("LIBOMPTARGET_NUM_INITIAL_EVENTS", 32), DeviceId(DeviceId), GridValues(OMPGridValues), - PeerAccesses(NumDevices, PeerAccessState::PENDING), PeerAccessesLock() { + PeerAccesses(NumDevices, PeerAccessState::PENDING), PeerAccessesLock() {} + +Error GenericDeviceTy::init(GenericPluginTy &Plugin) { + if (auto Err = initImpl(Plugin)) + return Err; + + // Limit the maximum number of teams and team threads determined by the envars + // OMP_NUM_TEAMS and OMP_TEAMS_THREAD_LIMIT (if needed). if (OMP_NumTeams > 0) GridValues.GV_Max_Teams = std::min(GridValues.GV_Max_Teams, uint32_t(OMP_NumTeams)); @@ -163,11 +170,6 @@ if (OMP_TeamsThreadLimit > 0) GridValues.GV_Max_WG_Size = std::min(GridValues.GV_Max_WG_Size, uint32_t(OMP_TeamsThreadLimit)); -} - -Error GenericDeviceTy::init(GenericPluginTy &Plugin) { - if (auto Err = initImpl(Plugin)) - return Err; // Read and reinitialize the envars that depend on the device initialization. // Notice these two envars may change the stack size and heap size of the