[Openmp-commits] [PATCH] D140477: [OpenMP][libomptarget] Considering OMP_NUM_TEAMS and OMP_TEAMS_THREAD_LIMIT in NextGen plugins
Kevin Sala Penadés via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Wed Dec 21 06:44:30 PST 2022
kevinsala created this revision.
kevinsala added reviewers: jdoerfert, jhuber6, tianshilei1992.
kevinsala added a project: OpenMP.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
kevinsala requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Until now both OMP_NUM_TEAMS and OMP_TEAMS_THREAD_LIMIT were accidentally ignored in the NextGen plugins. The maximum values reported by the devices were always used to compute the maximum number of teams and threads per team. This patch fixes this error and considers the values defined by those envars.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D140477
Files:
openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140477.484567.patch
Type: text/x-patch
Size: 1514 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221221/b1be45ad/attachment.bin>
More information about the Openmp-commits
mailing list