[clang] [llvm] [mlir] [Flang][OpenMP] Enable no-loop kernels (PR #155818)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 10 02:05:49 PDT 2025
================
@@ -3835,10 +3835,23 @@ let Visibility = [ClangOption, CC1Option, FC1Option, FlangOption] in {
let Group = f_Group in {
def fopenmp_target_debug_EQ : Joined<["-"], "fopenmp-target-debug=">;
-def fopenmp_assume_teams_oversubscription : Flag<["-"], "fopenmp-assume-teams-oversubscription">;
-def fopenmp_assume_threads_oversubscription : Flag<["-"], "fopenmp-assume-threads-oversubscription">;
-def fno_openmp_assume_teams_oversubscription : Flag<["-"], "fno-openmp-assume-teams-oversubscription">;
-def fno_openmp_assume_threads_oversubscription : Flag<["-"], "fno-openmp-assume-threads-oversubscription">;
+def fopenmp_assume_teams_oversubscription : Flag<["-"], "fopenmp-assume-teams-oversubscription">,
+ HelpText<"Allow enforcement to ensure there are enough teams to cover the "
+ "loop iteration space. It may ignore environment variables. "
+ "If the fopenmp-assume-teams-oversubscription and "
+ "fopenmp-assume-threads-oversubscription flags are set, Flang may "
+ "generate more optimized OpenMP kernels for target teams distribute "
+ "parallel do pragmas.">;
+def fopenmp_assume_threads_oversubscription : Flag<["-"], "fopenmp-assume-threads-oversubscription">,
+ HelpText<"Assume threads oversubscription. If the "
+ "fopenmp-assume-teams-oversubscription and "
+ "fopenmp-assume-threads-oversubscription flags are set, Flang may "
+ "generate more optimized OpenMP kernels for target teams distribute "
+ "parallel do pragmas.">;
----------------
Meinersbur wrote:
I find these HelpTexts more confusing than helpful. Proposal:
> Allow the optimizer to discretely increase the number of teams/threads. May cause ignore environment variables that set the number of teams/threads to be ignored. The combination of -fopenmp-assume-teams-oversubscription and -fopenmp-assume-threads-oversubscription may allow the conversion of loops into sequential code by ensuring that each team/thread executes at most one iteration.
(please adapt as you see fit)
The name "assume_threads/teams_oversubscription" seems disconnected from this function at first, but I think it comes from allowing oversubscription, where the "subscription" is the number of available teams/threads as determined by `thread_limit`, `num_teams`, `OMP_THREAD_LIMIT`, etc., and threfore allowing the optimzer to oversubscribe this amount. Maybe there is a way to make the description more connected to the flag name.
Avoid "Flang" in the HelpText. It might also made available in Clang on day.
https://github.com/llvm/llvm-project/pull/155818
More information about the llvm-commits
mailing list