Skip to content

[flang] Fix do concurrent CLI test for PowerPC #134249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

ergawy
Copy link
Member

@ergawy ergawy commented Apr 3, 2025

One of the do concurrent tests crashes on PowerPC (see #126026 (comment)). This PR tries to fix the issue by adding the -c flag to the test to avoid linking.

@llvmbot llvmbot added flang:driver flang Flang issues not falling into any other category labels Apr 3, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 3, 2025

@llvm/pr-subscribers-flang-driver

Author: Kareem Ergawy (ergawy)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/134249.diff

1 Files Affected:

  • (modified) flang/test/Driver/do_concurrent_to_omp_cli.f90 (+1-1)
diff --git a/flang/test/Driver/do_concurrent_to_omp_cli.f90 b/flang/test/Driver/do_concurrent_to_omp_cli.f90
index 41b7575e206af..58f9c01d1f5a7 100644
--- a/flang/test/Driver/do_concurrent_to_omp_cli.f90
+++ b/flang/test/Driver/do_concurrent_to_omp_cli.f90
@@ -1,4 +1,4 @@
-! UNSUPPORTED: system-windows
+! UNSUPPORTED: target=powerpc{{.*}}, system-windows
 
 ! RUN: %flang --help | FileCheck %s --check-prefix=FLANG
 

@ergawy
Copy link
Member Author

ergawy commented Apr 3, 2025

If anyone can confirm this does not crash on PowerPC, please add yourself as a reviewer and approve.

@kkwli
Copy link
Collaborator

kkwli commented Apr 3, 2025

Do we know the reason why the test crashes on PowerPC? I think the test is only to test the -help option.

@ergawy
Copy link
Member Author

ergawy commented Apr 3, 2025

Do we know the reason why the test crashes on PowerPC? I think the test is only to test the -help option.

I don't have a ppc system so unfortunately cannot debug it. The reason I disabled it is because this is just a test for CLI options, it should be enough to verify that it works on at least one system. Also, not sure if the test is just flakey or always crashes on ppc.

@luporl
Copy link
Contributor

luporl commented Apr 3, 2025

I'm also seeing a similar error on macOS.
Running the failing test command manually, I get:

$ .../flang -fdo-concurrent-to-openmp=host /Users/leandro.lupori/home/git/flang/llvm-project/flang/test/Driver/do_concurrent_to_omp_cli.f90
warning: OpenMP is required for lowering `do concurrent` loops to OpenMP.Enable OpenMP using `-fopenmp`.`do concurrent` loops will be serialized.
ld: library 'flang_rt.runtime' not found
flang-21: error: linker command failed with exit code 1 (use -v to see invocation)

I think the problem is that, after the switch to flang-rt, flang is unable to find flang_rt.runtime by itself on macOS. I'm working around it with -L/path/to/flang-rt. I reported it here: #127538 (comment)

Maybe the same issues exists for PowerPC.

About fixing the test, can't we just compile without linking? This works for me:

$ flang -v -fdo-concurrent-to-openmp=host -c /Users/leandro.lupori/home/git/flang/llvm-project/flang/test/Driver/do_concurrent_to_omp_cli.f90
flang version 21.0.0git (git@github.com:luporl/llvm-project.git 32dff270603bb2ea0f0002bf57d29c71319736d6)
Target: arm64-apple-darwin24.3.0
Thread model: posix
InstalledDir: /Users/leandro.lupori/home/git/flang/build/bin
Build config: +assertions
 "/Users/leandro.lupori/home/git/flang/build/bin/flang" -fc1 -triple arm64-apple-macosx15.2.0 -emit-obj -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -target-cpu apple-m1 -target-feature +zcm -target-feature +zcz -target-feature +v8.4a -target-feature +aes -target-feature +altnzcv -target-feature +ccdp -target-feature +ccpp -target-feature +complxnum -target-feature +crc -target-feature +dotprod -target-feature +flagm -target-feature +fp-armv8 -target-feature +fp16fml -target-feature +fptoint -target-feature +fullfp16 -target-feature +jsconv -target-feature +lse -target-feature +neon -target-feature +pauth -target-feature +perfmon -target-feature +predres -target-feature +ras -target-feature +rcpc -target-feature +rdm -target-feature +sb -target-feature +sha2 -target-feature +sha3 -target-feature +specrestrict -target-feature +ssbs -fdo-concurrent-to-openmp=host -resource-dir /Users/leandro.lupori/home/git/flang/build/lib/clang/21 -mframe-pointer=non-leaf -o do_concurrent_to_omp_cli.o -x f95-cpp-input /Users/leandro.lupori/home/git/flang/llvm-project/flang/test/Driver/do_concurrent_to_omp_cli.f90
warning: OpenMP is required for lowering `do concurrent` loops to OpenMP.Enable OpenMP using `-fopenmp`.`do concurrent` loops will be serialized.

EDIT: ignore the -v flag that I forgot to remove. The fix is to add -c only.

@ergawy
Copy link
Member Author

ergawy commented Apr 4, 2025

I'm also seeing a similar error on macOS. Running the failing test command manually, I get:

$ .../flang -fdo-concurrent-to-openmp=host /Users/leandro.lupori/home/git/flang/llvm-project/flang/test/Driver/do_concurrent_to_omp_cli.f90
warning: OpenMP is required for lowering `do concurrent` loops to OpenMP.Enable OpenMP using `-fopenmp`.`do concurrent` loops will be serialized.
ld: library 'flang_rt.runtime' not found
flang-21: error: linker command failed with exit code 1 (use -v to see invocation)

I think the problem is that, after the switch to flang-rt, flang is unable to find flang_rt.runtime by itself on macOS. I'm working around it with -L/path/to/flang-rt. I reported it here: #127538 (comment)

Maybe the same issues exists for PowerPC.

About fixing the test, can't we just compile without linking? This works for me:

$ flang -v -fdo-concurrent-to-openmp=host -c /Users/leandro.lupori/home/git/flang/llvm-project/flang/test/Driver/do_concurrent_to_omp_cli.f90
flang version 21.0.0git (git@github.com:luporl/llvm-project.git 32dff270603bb2ea0f0002bf57d29c71319736d6)
Target: arm64-apple-darwin24.3.0
Thread model: posix
InstalledDir: /Users/leandro.lupori/home/git/flang/build/bin
Build config: +assertions
 "/Users/leandro.lupori/home/git/flang/build/bin/flang" -fc1 -triple arm64-apple-macosx15.2.0 -emit-obj -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -target-cpu apple-m1 -target-feature +zcm -target-feature +zcz -target-feature +v8.4a -target-feature +aes -target-feature +altnzcv -target-feature +ccdp -target-feature +ccpp -target-feature +complxnum -target-feature +crc -target-feature +dotprod -target-feature +flagm -target-feature +fp-armv8 -target-feature +fp16fml -target-feature +fptoint -target-feature +fullfp16 -target-feature +jsconv -target-feature +lse -target-feature +neon -target-feature +pauth -target-feature +perfmon -target-feature +predres -target-feature +ras -target-feature +rcpc -target-feature +rdm -target-feature +sb -target-feature +sha2 -target-feature +sha3 -target-feature +specrestrict -target-feature +ssbs -fdo-concurrent-to-openmp=host -resource-dir /Users/leandro.lupori/home/git/flang/build/lib/clang/21 -mframe-pointer=non-leaf -o do_concurrent_to_omp_cli.o -x f95-cpp-input /Users/leandro.lupori/home/git/flang/llvm-project/flang/test/Driver/do_concurrent_to_omp_cli.f90
warning: OpenMP is required for lowering `do concurrent` loops to OpenMP.Enable OpenMP using `-fopenmp`.`do concurrent` loops will be serialized.

EDIT: ignore the -v flag that I forgot to remove. The fix is to add -c only.

Thanks for the suggestion. Added the -c flag.

@ergawy ergawy changed the title [flang] Disable test for PowerPC [flang] Fix do concurrent CLI test for PowerPC Apr 4, 2025
@DanielCChen
Copy link
Contributor

This test case passed on both AIX and LoP as is. Not sure if it is due to PR #131041 which uses the full path to libflang_rt.runtime.a.

There is also a pending PR #134362 that makes all platform using the full path.

@DanielCChen
Copy link
Contributor

I can also reproduce the failure if I don't have flang-rt specified in LLVM_ENABLE_RUNTIMES.
So I think the proper fix is to do bootstrap build for flang-rt and pull the change of PR #134362 .

@ergawy
Copy link
Member Author

ergawy commented Apr 15, 2025

Closing since this was fixed by #135485.

@ergawy ergawy closed this Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:driver flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants