diff options
| author | Tim Gymnich <tim@gymni.ch> | 2024-06-14 16:35:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-14 07:35:23 -0700 |
| commit | 597d2f7662c31cae4c8a54cc27e2ea12833380ea (patch) | |
| tree | 3eba2299c868a698fead7b8f75f6e6d8f0fd3518 /offload/plugins-nextgen/common/src/PluginInterface.cpp | |
| parent | 43e6f46936e177e47de6627a74b047ba27561b44 (diff) | |
[OpenMP] Add Environment Variable to disable Reuse of Blocks for High Loop Trip Counts (#89239)
Sometimes it might be beneficial to spawn more thread blocks instead of
reusing existing for multiple loop iterations.
**Alternatives considered:**
Make `DefaultNumBlocks` settable via an environment variable.
---------
Co-authored-by: Joseph Huber <huberjn@outlook.com>
Diffstat (limited to 'offload/plugins-nextgen/common/src/PluginInterface.cpp')
| -rw-r--r-- | offload/plugins-nextgen/common/src/PluginInterface.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/offload/plugins-nextgen/common/src/PluginInterface.cpp b/offload/plugins-nextgen/common/src/PluginInterface.cpp index 94f9d4670b67..118265973f32 100644 --- a/offload/plugins-nextgen/common/src/PluginInterface.cpp +++ b/offload/plugins-nextgen/common/src/PluginInterface.cpp @@ -701,8 +701,11 @@ uint64_t GenericKernelTy::getNumBlocks(GenericDeviceTy &GenericDevice, TripCountNumBlocks = LoopTripCount; } } + + uint32_t PreferredNumBlocks = TripCountNumBlocks; // If the loops are long running we rather reuse blocks than spawn too many. - uint32_t PreferredNumBlocks = std::min(TripCountNumBlocks, DefaultNumBlocks); + if (GenericDevice.getReuseBlocksForHighTripCount()) + PreferredNumBlocks = std::min(TripCountNumBlocks, DefaultNumBlocks); return std::min(PreferredNumBlocks, GenericDevice.getBlockLimit()); } |
