[Openmp-commits] [PATCH] D152054: [OpenMP] Codegen support for thread_limit on target directive
Kazushi Marukawa via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Mon Sep 11 06:53:47 PDT 2023
kaz7 added a comment.
I figure out the reason of strange behavior I mentioned last night. However, I'm still not sure what is the good way to solve this problem. Can someone check the behavior with `-O2` option please? Thanks!
================
Comment at: openmp/runtime/test/target/target_thread_limit.cpp:73
+ printf("\nsecond target: thread_limit = %d", omp_get_thread_limit());
+// OMP51: second target: thread_limit = 3
+#pragma omp parallel
----------------
Last night, I cannot use inline comment, but now I can. So, I'm writing down my comments here.
The problem I mentioned last night was caused by optimization. This works fine with optimization level by default, but this doesn't work with `-O2` even on x86_64. I'm using `-O2` for tests, so I come across this problem. I'll write command lines to reproduce my problem below. As you see, there is a warning message at `-O2`. So, this behavior may be expected, though. In addition, I'm using f8efa65 to produce following results.
```
$ cd build
$ ninja
...
$ ./bin/clang++ -fopenmp -I runtimes/runtimes-x86_64-unknown-linux-gnu-bins/openmp/runtime/src -I ../llvm-project/openmp/runtime/test -L runtimes/runtimes-x86_64-unknown-linux-gnu-bins/openmp/runtime/src -fno-omit-frame-pointer -I ../llvm-project/openmp/runtime/test/ompt -std=c++17 ../llvm-project/openmp/runtime/test/target/target_thread_limit.cpp -o ok -lm -latomic -fopenmp-version=51
$ LD_LIBRARY_PATH=runtimes/runtimes-x86_64-unknown-linux-gnu-bins/openmp/runtime/src ./ok | grep "second target: thread_limit"
second target: thread_limit = 3
$ ./bin/clang++ -fopenmp -I runtimes/runtimes-x86_64-unknown-linux-gnu-bins/openmp/runtime/src -I ../llvm-project/openmp/runtime/test -L runtimes/runtimes-x86_64-unknown-linux-gnu-bins/openmp/runtime/src -fno-omit-frame-pointer -I ../llvm-project/openmp/runtime/test/ompt -std=c++17 ../llvm-project/openmp/runtime/test/target/target_thread_limit.cpp -o bad -lm -latomic -fopenmp-version=51 -O2
warning: loop not vectorized: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
1 warning generated.
$ LD_LIBRARY_PATH=runtimes/runtimes-x86_64-unknown-linux-gnu-bins/openmp/runtime/src ./bad | grep "second target: thread_limit"
second target: thread_limit = 2147483647
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152054/new/
https://reviews.llvm.org/D152054
More information about the Openmp-commits
mailing list