[OpenMP] Add an option to limit shared memory usage in OpenMPOpt
authorJoseph Huber <jhuber6@vols.utk.edu>
Thu, 17 Feb 2022 20:48:12 +0000 (15:48 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Fri, 18 Feb 2022 13:35:26 +0000 (08:35 -0500)
commit0136a4401f90b1effd07b3ac8575fdb155f9984d
treea54c56367e426f0032a74fedcbeac0d62c7a89d0
parent0870a4f59aef21bf7707b00ebd4dcad7ce7ef807
[OpenMP] Add an option to limit shared memory usage in OpenMPOpt

One of the optimizations performed in OpenMPOpt pushes globalized
variables to static shared memory. This is preferable to keeping the
runtime call in all cases, however if too many variables are pushed to
hared memory the kernel will crash. Since this is an optimization and
not something the user specified explicitly, there should be an option
to limit this optimization in those cases. This path introduces the
`-openmp-opt-shared-limit=` option to limit the amount of bytes that
will be placed in shared memory from HeapToShared.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D120079
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
llvm/test/Transforms/OpenMP/replace_globalization.ll