[Openmp-commits] [PATCH] D112894: [OpenMP][FIX] Do not signal SPMD-mode but then keep generic-mode

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Oct 31 12:52:26 PDT 2021


jdoerfert created this revision.
jdoerfert added reviewers: jhuber6, ggeorgakoudis, tianshilei1992.
Herald added subscribers: ormris, guansong, bollu, hiraditya, yaxunl.
jdoerfert requested review of this revision.
Herald added a reviewer: sstefan1.
Herald added subscribers: llvm-commits, sstefan1.
Herald added a reviewer: baziotis.
Herald added a project: LLVM.

If we assume SPMD-mode during the fixpoint iteration we have to execute
the kernel in SPMD-mode. If we change our mind during manifest there is
the chance of a mismatch between the simplification, e.g., of
`__kmpc_is_spmd_exec_mode` calls, and the execution mode. This problem
was introduced in D109438 <https://reviews.llvm.org/D109438>.

This patch is compromise to resolve the problem purely in OpenMP-opt
while trying to keep the benefits of D109438 <https://reviews.llvm.org/D109438> around. This might not
always work, see `get_hardware_num_threads_in_block_fold` but it often
does. At the same time we do keep value specialization and execution
mode in sync.

Proper solutions to this problem should be considered. I believe a new
execution mode is the easiest way forward (Singleton-SPMD).
Alternatively, SPMD-mode execution can be used with a way to provide a
new thread_limit (here 1) to the runtime. This is more general and could
be useful if we see `num_threads` clauses or workshared loops with small
trip counts in the kernel. In either proposal we need to disable the
guarding for the kernel (which was the motivation for D109438 <https://reviews.llvm.org/D109438>).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112894

Files:
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/test/Transforms/OpenMP/always_inline_device.ll
  llvm/test/Transforms/OpenMP/get_hardware_num_threads_in_block_fold.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112894.383677.patch
Type: text/x-patch
Size: 9234 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20211031/d424de3e/attachment.bin>


More information about the Openmp-commits mailing list