Skip to content
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

[Flang] [OpenMP] omp.distribute unsupported but test passes #112567

Open
Luigi-Crisci opened this issue Oct 16, 2024 · 1 comment
Open

[Flang] [OpenMP] omp.distribute unsupported but test passes #112567

Luigi-Crisci opened this issue Oct 16, 2024 · 1 comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] flang:ir flang:openmp

Comments

@Luigi-Crisci
Copy link

When compiling a simple fortran program, flang fails saying that omp.distribute is unsupported

program vector_add
    use omp_lib
        implicit none
                integer, dimension(100) :: a, b, c
                integer :: i 
                !$omp target  map(to: a, b) map(from: c)
                !$omp teams
                !$omp distribute parallel do simd
                do i = 1, 100
                   c(i) = a(i) + b(i)
                end do
                !$omp end distribute parallel do simd

                !$omp end teams    
                !$omp end target 
end program vector_add
/software-local/sources/llvm-20/bin/flang -fopenmp test_offload_stack.F90

flang-20: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
error: loc("/home/lcrisci/workspace/BGK2D_GPU_SYCL/benchmark/test_offload_stack.F90":8:43): unsupported OpenMP operation: omp.distribute
error: loc("/home/lcrisci/workspace/BGK2D_GPU_SYCL/benchmark/test_offload_stack.F90":8:43): LLVM Translation failed for operation: omp.distribute
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /software-local/sources/llvm-20/bin/flang -fc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -fopenmp -resource-dir /software-local/sources/llvm-20/lib/clang/20 -mframe-pointer=all -o /tmp/test_offload_stack-7fc176.o -x f95-cpp-input test_offload_stack.F90
 #0 0x00005a72532ce170 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/software-local/sources/llvm-20/bin/flang+0x19b7170)
 #1 0x00005a72532cb72e SignalHandler(int) Signals.cpp:0:0
 #2 0x00007619b7642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00005a725724f1a2 llvm::CodeExtractor::findAllocas(llvm::CodeExtractorAnalysisCache const&, llvm::SetVector<llvm::Value*, llvm::SmallVector<llvm::Value*, 0u>, llvm::DenseSet<llvm::Value*, llvm::DenseMapInfo<llvm::Value*, void>>, 0u>&, llvm::SetVector<llvm::Value*, llvm::SmallVector<llvm::Value*, 0u>, llvm::DenseSet<llvm::Value*, llvm::DenseMapInfo<llvm::Value*, void>>, 0u>&, llvm::BasicBlock*&) const (/software-local/sources/llvm-20/bin/flang+0x59381a2)
 #4 0x00005a7256da48ad llvm::OpenMPIRBuilder::createParallel(llvm::OpenMPIRBuilder::LocationDescription const&, llvm::IRBuilderBase::InsertPoint, llvm::function_ref<void (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)>, llvm::function_ref<llvm::IRBuilderBase::InsertPoint (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint, llvm::Value&, llvm::Value&, llvm::Value*&)>, std::function<void (llvm::IRBuilderBase::InsertPoint)>, llvm::Value*, llvm::Value*, llvm::omp::ProcBindKind, bool) (/software-local/sources/llvm-20/bin/flang+0x548d8ad)
 #5 0x00005a7254c41971 convertOmpParallel(mlir::omp::ParallelOp, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) OpenMPToLLVMIRTranslation.cpp:0:0
 #6 0x00005a7254c54871 convertHostOrTargetOperation(mlir::Operation*, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) OpenMPToLLVMIRTranslation.cpp:0:0
 #7 0x00005a725662058e mlir::LLVM::ModuleTranslation::convertOperation(mlir::Operation&, llvm::IRBuilderBase&, bool) (/software-local/sources/llvm-20/bin/flang+0x4d0958e)
 #8 0x00005a72566250f3 mlir::LLVM::ModuleTranslation::convertBlockImpl(mlir::Block&, bool, llvm::IRBuilderBase&, bool) (/software-local/sources/llvm-20/bin/flang+0x4d0e0f3)
 #9 0x00005a7254c3c086 convertOmpOpRegions(mlir::Region&, llvm::StringRef, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&, llvm::LogicalResult&, llvm::SmallVectorImpl<llvm::PHINode*>*) OpenMPToLLVMIRTranslation.cpp:0:0
#10 0x00005a7254c56e01 void llvm::function_ref<void (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)>::callback_fn<convertOmpTeams(mlir::omp::TeamsOp, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&)::'lambda'(llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)>(long, llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint) OpenMPToLLVMIRTranslation.cpp:0:0
#11 0x00005a7256d9bee6 llvm::OpenMPIRBuilder::createTeams(llvm::OpenMPIRBuilder::LocationDescription const&, llvm::function_ref<void (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)>, llvm::Value*, llvm::Value*, llvm::Value*, llvm::Value*) (/software-local/sources/llvm-20/bin/flang+0x5484ee6)
#12 0x00005a7254c5684c convertHostOrTargetOperation(mlir::Operation*, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) OpenMPToLLVMIRTranslation.cpp:0:0
#13 0x00005a725662058e mlir::LLVM::ModuleTranslation::convertOperation(mlir::Operation&, llvm::IRBuilderBase&, bool) (/software-local/sources/llvm-20/bin/flang+0x4d0958e)
#14 0x00005a72566250f3 mlir::LLVM::ModuleTranslation::convertBlockImpl(mlir::Block&, bool, llvm::IRBuilderBase&, bool) (/software-local/sources/llvm-20/bin/flang+0x4d0e0f3)
#15 0x00005a7254c3c086 convertOmpOpRegions(mlir::Region&, llvm::StringRef, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&, llvm::LogicalResult&, llvm::SmallVectorImpl<llvm::PHINode*>*) OpenMPToLLVMIRTranslation.cpp:0:0
#16 0x00005a7254c4c9c6 convertOmpTarget(mlir::Operation&, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&)::'lambda'(llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)::operator()(llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint) const (.isra.0) OpenMPToLLVMIRTranslation.cpp:0:0
#17 0x00005a7254c4d10c llvm::IRBuilderBase::InsertPoint llvm::function_ref<llvm::IRBuilderBase::InsertPoint (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)>::callback_fn<convertOmpTarget(mlir::Operation&, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&)::'lambda'(llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)>(long, llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint) OpenMPToLLVMIRTranslation.cpp:0:0
#18 0x00005a7256d99929 createOutlinedFunction(llvm::OpenMPIRBuilder&, llvm::IRBuilderBase&, llvm::StringRef, llvm::SmallVectorImpl<llvm::Value*>&, llvm::function_ref<llvm::IRBuilderBase::InsertPoint (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)>&, llvm::function_ref<llvm::IRBuilderBase::InsertPoint (llvm::Argument&, llvm::Value*, llvm::Value*&, llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)>&) OMPIRBuilder.cpp:0:0
#19 0x00005a7256d9a259 std::_Function_handler<llvm::Function* (llvm::StringRef), emitTargetOutlinedFunction(llvm::OpenMPIRBuilder&, llvm::IRBuilderBase&, bool, llvm::TargetRegionEntryInfo&, llvm::Function*&, llvm::Constant*&, llvm::SmallVectorImpl<llvm::Value*>&, llvm::function_ref<llvm::IRBuilderBase::InsertPoint (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)>&, llvm::function_ref<llvm::IRBuilderBase::InsertPoint (llvm::Argument&, llvm::Value*, llvm::Value*&, llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)>&)::'lambda'(llvm::StringRef)>::_M_invoke(std::_Any_data const&, llvm::StringRef&&) OMPIRBuilder.cpp:0:0
#20 0x00005a7256d88e2d llvm::OpenMPIRBuilder::emitTargetRegionFunction(llvm::TargetRegionEntryInfo&, std::function<llvm::Function* (llvm::StringRef)>&, bool, llvm::Function*&, llvm::Constant*&) (/software-local/sources/llvm-20/bin/flang+0x5471e2d)
#21 0x00005a7256dabd04 llvm::OpenMPIRBuilder::createTarget(llvm::OpenMPIRBuilder::LocationDescription const&, bool, llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint, llvm::TargetRegionEntryInfo&, llvm::ArrayRef<int>, llvm::ArrayRef<int>, llvm::SmallVectorImpl<llvm::Value*>&, llvm::function_ref<llvm::OpenMPIRBuilder::MapInfosTy& (llvm::IRBuilderBase::InsertPoint)>, llvm::function_ref<llvm::IRBuilderBase::InsertPoint (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)>, llvm::function_ref<llvm::IRBuilderBase::InsertPoint (llvm::Argument&, llvm::Value*, llvm::Value*&, llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)>, llvm::SmallVector<llvm::OpenMPIRBuilder::DependData, 2u>, bool) (/software-local/sources/llvm-20/bin/flang+0x5494d04)
#22 0x00005a7254c45681 convertOmpTarget(mlir::Operation&, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) (.part.0) OpenMPToLLVMIRTranslation.cpp:0:0
#23 0x00005a7254c55f47 convertHostOrTargetOperation(mlir::Operation*, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) OpenMPToLLVMIRTranslation.cpp:0:0
#24 0x00005a725662058e mlir::LLVM::ModuleTranslation::convertOperation(mlir::Operation&, llvm::IRBuilderBase&, bool) (/software-local/sources/llvm-20/bin/flang+0x4d0958e)
#25 0x00005a72566250f3 mlir::LLVM::ModuleTranslation::convertBlockImpl(mlir::Block&, bool, llvm::IRBuilderBase&, bool) (/software-local/sources/llvm-20/bin/flang+0x4d0e0f3)
#26 0x00005a72566282ee mlir::LLVM::ModuleTranslation::convertOneFunction(mlir::LLVM::LLVMFuncOp) (/software-local/sources/llvm-20/bin/flang+0x4d112ee)
#27 0x00005a7256629818 mlir::LLVM::ModuleTranslation::convertFunctions() (/software-local/sources/llvm-20/bin/flang+0x4d12818)
#28 0x00005a7256632a44 mlir::translateModuleToLLVMIR(mlir::Operation*, llvm::LLVMContext&, llvm::StringRef, bool) (/software-local/sources/llvm-20/bin/flang+0x4d1ba44)
#29 0x00005a72536967a8 Fortran::frontend::CodeGenAction::generateLLVMIR() (/software-local/sources/llvm-20/bin/flang+0x1d7f7a8)
#30 0x00005a7253699dc8 Fortran::frontend::CodeGenAction::executeAction() (/software-local/sources/llvm-20/bin/flang+0x1d82dc8)
#31 0x00005a7253313d91 Fortran::frontend::FrontendAction::execute() (/software-local/sources/llvm-20/bin/flang+0x19fcd91)
#32 0x00005a725330212f Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/software-local/sources/llvm-20/bin/flang+0x19eb12f)
#33 0x00005a725331bbbd Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/software-local/sources/llvm-20/bin/flang+0x1a04bbd)
#34 0x00005a725289ce98 fc1_main(llvm::ArrayRef<char const*>, char const*) (/software-local/sources/llvm-20/bin/flang+0xf85e98)
#35 0x00005a72527b293f main (/software-local/sources/llvm-20/bin/flang+0xe9b93f)
#36 0x00007619b7629d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#37 0x00007619b7629e40 call_init ./csu/../csu/libc-start.c:128:20
#38 0x00007619b7629e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#39 0x00005a725289bd15 _start (/software-local/sources/llvm-20/bin/flang+0xf84d15)
flang-20: error: unable to execute command: Segmentation fault (core dumped)
flang-20: error: flang frontend command failed due to signal (use -v to see invocation)
flang version 20.0.0git (https://github.com/llvm/llvm-project 70334081f75d67900c6ffa193c60c4d6f4767354)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /software-local/sources/llvm-20/bin
flang-20: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
flang-20: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
flang-20: note: diagnostic msg: /tmp/test_offload_stack-038dfb
flang-20: note: diagnostic msg: /tmp/test_offload_stack-038dfb.sh
flang-20: note: diagnostic msg: 

********************

However, running the distribute-parallel-do-simd.f90 test gives no error

./build/bin/llvm-lit -v flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90

-- Testing: 1 tests, 1 workers --
PASS: Flang :: Lower/OpenMP/distribute-parallel-do-simd.f90 (1 of 1)
Exit Code: 0

Command Output (stderr):
--
RUN: at line 4: bbc -fopenmp -emit-hlfir /software-local/sources/llvm-project/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90 -o - | /software-local/sources/llvm-project/build/bin/FileCheck /software-local/sources/llvm-project/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90
+ bbc -fopenmp -emit-hlfir /software-local/sources/llvm-project/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90 -o -
+ /software-local/sources/llvm-project/build/bin/FileCheck /software-local/sources/llvm-project/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90
RUN: at line 5: /software-local/sources/llvm-project/build/bin/flang -fc1 -fopenmp -emit-hlfir /software-local/sources/llvm-project/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90 -o - | /software-local/sources/llvm-project/build/bin/FileCheck /software-local/sources/llvm-project/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90
+ /software-local/sources/llvm-project/build/bin/flang -fc1 -fopenmp -emit-hlfir /software-local/sources/llvm-project/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90 -o -
+ /software-local/sources/llvm-project/build/bin/FileCheck /software-local/sources/llvm-project/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90

--

********************

Testing Time: 0.07s

Total Discovered Tests: 1
  Passed: 1 (100.00%)

LLVM commit: 7033408
LLVM build options:

CC=gcc
CXX=g++
BUILD_TYPE=Release
TARGETS_TO_BUILD="AMDGPU;X86"
NUMTHREADS=$(nproc)
LLVM_PATH=$1
INSTALL_DIR=$2

CMAKE_OPTIONS="-DLLVM_ENABLE_PROJECTS=clang;flang;compiler-rt;lld \
               -DLLVM_ENABLE_RUNTIMES=openmp;offload \
	       -DOPENMP_ENABLE_LIBOMPTARGET=ON \
	       -DLIBOMPTARGET_DEVICE_ARCHITECTURES=gfx908 \
	       -DLLVM_ENABLE_TESTS=ON \
	       -DFLANG_INCLUDE_TESTS=ON \
	       -DCMAKE_C_COMPILER=$CC \
               -DCMAKE_CXX_COMPILER=$CXX \
               -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
               -DLLVM_ENABLE_ASSERTIONS=OFF \
               -DLLVM_TARGETS_TO_BUILD=$TARGETS_TO_BUILD \
               -DCLANG_ANALYZER_ENABLE_Z3_SOLVER=0 \
               -DLLVM_INCLUDE_BENCHMARKS=0 \
               -DLLVM_ENABLE_OCAMLDOC=OFF \
               -DLLVM_ENABLE_BINDINGS=OFF \
               -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=OFF \
               -DLLVM_ENABLE_DUMP=OFF \
               -DLLVM_BUILD_LLVM_DYLIB=ON \
               -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR"

cmake -S $LLVM_PATH/llvm -B $LLVM_PATH/build -G Ninja $CMAKE_OPTIONS

Is something breaking during the installation process?

@github-actions github-actions bot added the flang Flang issues not falling into any other category label Oct 16, 2024
@EugeneZelenko EugeneZelenko added flang:ir crash Prefer [crash-on-valid] or [crash-on-invalid] flang:openmp and removed flang Flang issues not falling into any other category labels Oct 16, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Oct 16, 2024

@llvm/issue-subscribers-flang-ir

Author: Luigi Crisci (Luigi-Crisci)

When compiling a simple fortran program, flang fails saying that `omp.distribute` is unsupported ```fortran program vector_add use omp_lib implicit none integer, dimension(100) :: a, b, c integer :: i !$omp target map(to: a, b) map(from: c) !$omp teams !$omp distribute parallel do simd do i = 1, 100 c(i) = a(i) + b(i) end do !$omp end distribute parallel do simd
            !$omp end teams    
            !$omp end target 

end program vector_add

```bash
/software-local/sources/llvm-20/bin/flang -fopenmp test_offload_stack.F90

flang-20: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
error: loc("/home/lcrisci/workspace/BGK2D_GPU_SYCL/benchmark/test_offload_stack.F90":8:43): unsupported OpenMP operation: omp.distribute
error: loc("/home/lcrisci/workspace/BGK2D_GPU_SYCL/benchmark/test_offload_stack.F90":8:43): LLVM Translation failed for operation: omp.distribute
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /software-local/sources/llvm-20/bin/flang -fc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -fopenmp -resource-dir /software-local/sources/llvm-20/lib/clang/20 -mframe-pointer=all -o /tmp/test_offload_stack-7fc176.o -x f95-cpp-input test_offload_stack.F90
 #<!-- -->0 0x00005a72532ce170 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/software-local/sources/llvm-20/bin/flang+0x19b7170)
 #<!-- -->1 0x00005a72532cb72e SignalHandler(int) Signals.cpp:0:0
 #<!-- -->2 0x00007619b7642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->3 0x00005a725724f1a2 llvm::CodeExtractor::findAllocas(llvm::CodeExtractorAnalysisCache const&amp;, llvm::SetVector&lt;llvm::Value*, llvm::SmallVector&lt;llvm::Value*, 0u&gt;, llvm::DenseSet&lt;llvm::Value*, llvm::DenseMapInfo&lt;llvm::Value*, void&gt;&gt;, 0u&gt;&amp;, llvm::SetVector&lt;llvm::Value*, llvm::SmallVector&lt;llvm::Value*, 0u&gt;, llvm::DenseSet&lt;llvm::Value*, llvm::DenseMapInfo&lt;llvm::Value*, void&gt;&gt;, 0u&gt;&amp;, llvm::BasicBlock*&amp;) const (/software-local/sources/llvm-20/bin/flang+0x59381a2)
 #<!-- -->4 0x00005a7256da48ad llvm::OpenMPIRBuilder::createParallel(llvm::OpenMPIRBuilder::LocationDescription const&amp;, llvm::IRBuilderBase::InsertPoint, llvm::function_ref&lt;void (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)&gt;, llvm::function_ref&lt;llvm::IRBuilderBase::InsertPoint (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint, llvm::Value&amp;, llvm::Value&amp;, llvm::Value*&amp;)&gt;, std::function&lt;void (llvm::IRBuilderBase::InsertPoint)&gt;, llvm::Value*, llvm::Value*, llvm::omp::ProcBindKind, bool) (/software-local/sources/llvm-20/bin/flang+0x548d8ad)
 #<!-- -->5 0x00005a7254c41971 convertOmpParallel(mlir::omp::ParallelOp, llvm::IRBuilderBase&amp;, mlir::LLVM::ModuleTranslation&amp;) OpenMPToLLVMIRTranslation.cpp:0:0
 #<!-- -->6 0x00005a7254c54871 convertHostOrTargetOperation(mlir::Operation*, llvm::IRBuilderBase&amp;, mlir::LLVM::ModuleTranslation&amp;) OpenMPToLLVMIRTranslation.cpp:0:0
 #<!-- -->7 0x00005a725662058e mlir::LLVM::ModuleTranslation::convertOperation(mlir::Operation&amp;, llvm::IRBuilderBase&amp;, bool) (/software-local/sources/llvm-20/bin/flang+0x4d0958e)
 #<!-- -->8 0x00005a72566250f3 mlir::LLVM::ModuleTranslation::convertBlockImpl(mlir::Block&amp;, bool, llvm::IRBuilderBase&amp;, bool) (/software-local/sources/llvm-20/bin/flang+0x4d0e0f3)
 #<!-- -->9 0x00005a7254c3c086 convertOmpOpRegions(mlir::Region&amp;, llvm::StringRef, llvm::IRBuilderBase&amp;, mlir::LLVM::ModuleTranslation&amp;, llvm::LogicalResult&amp;, llvm::SmallVectorImpl&lt;llvm::PHINode*&gt;*) OpenMPToLLVMIRTranslation.cpp:0:0
#<!-- -->10 0x00005a7254c56e01 void llvm::function_ref&lt;void (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)&gt;::callback_fn&lt;convertOmpTeams(mlir::omp::TeamsOp, llvm::IRBuilderBase&amp;, mlir::LLVM::ModuleTranslation&amp;)::'lambda'(llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)&gt;(long, llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint) OpenMPToLLVMIRTranslation.cpp:0:0
#<!-- -->11 0x00005a7256d9bee6 llvm::OpenMPIRBuilder::createTeams(llvm::OpenMPIRBuilder::LocationDescription const&amp;, llvm::function_ref&lt;void (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)&gt;, llvm::Value*, llvm::Value*, llvm::Value*, llvm::Value*) (/software-local/sources/llvm-20/bin/flang+0x5484ee6)
#<!-- -->12 0x00005a7254c5684c convertHostOrTargetOperation(mlir::Operation*, llvm::IRBuilderBase&amp;, mlir::LLVM::ModuleTranslation&amp;) OpenMPToLLVMIRTranslation.cpp:0:0
#<!-- -->13 0x00005a725662058e mlir::LLVM::ModuleTranslation::convertOperation(mlir::Operation&amp;, llvm::IRBuilderBase&amp;, bool) (/software-local/sources/llvm-20/bin/flang+0x4d0958e)
#<!-- -->14 0x00005a72566250f3 mlir::LLVM::ModuleTranslation::convertBlockImpl(mlir::Block&amp;, bool, llvm::IRBuilderBase&amp;, bool) (/software-local/sources/llvm-20/bin/flang+0x4d0e0f3)
#<!-- -->15 0x00005a7254c3c086 convertOmpOpRegions(mlir::Region&amp;, llvm::StringRef, llvm::IRBuilderBase&amp;, mlir::LLVM::ModuleTranslation&amp;, llvm::LogicalResult&amp;, llvm::SmallVectorImpl&lt;llvm::PHINode*&gt;*) OpenMPToLLVMIRTranslation.cpp:0:0
#<!-- -->16 0x00005a7254c4c9c6 convertOmpTarget(mlir::Operation&amp;, llvm::IRBuilderBase&amp;, mlir::LLVM::ModuleTranslation&amp;)::'lambda'(llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)::operator()(llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint) const (.isra.0) OpenMPToLLVMIRTranslation.cpp:0:0
#<!-- -->17 0x00005a7254c4d10c llvm::IRBuilderBase::InsertPoint llvm::function_ref&lt;llvm::IRBuilderBase::InsertPoint (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)&gt;::callback_fn&lt;convertOmpTarget(mlir::Operation&amp;, llvm::IRBuilderBase&amp;, mlir::LLVM::ModuleTranslation&amp;)::'lambda'(llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)&gt;(long, llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint) OpenMPToLLVMIRTranslation.cpp:0:0
#<!-- -->18 0x00005a7256d99929 createOutlinedFunction(llvm::OpenMPIRBuilder&amp;, llvm::IRBuilderBase&amp;, llvm::StringRef, llvm::SmallVectorImpl&lt;llvm::Value*&gt;&amp;, llvm::function_ref&lt;llvm::IRBuilderBase::InsertPoint (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)&gt;&amp;, llvm::function_ref&lt;llvm::IRBuilderBase::InsertPoint (llvm::Argument&amp;, llvm::Value*, llvm::Value*&amp;, llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)&gt;&amp;) OMPIRBuilder.cpp:0:0
#<!-- -->19 0x00005a7256d9a259 std::_Function_handler&lt;llvm::Function* (llvm::StringRef), emitTargetOutlinedFunction(llvm::OpenMPIRBuilder&amp;, llvm::IRBuilderBase&amp;, bool, llvm::TargetRegionEntryInfo&amp;, llvm::Function*&amp;, llvm::Constant*&amp;, llvm::SmallVectorImpl&lt;llvm::Value*&gt;&amp;, llvm::function_ref&lt;llvm::IRBuilderBase::InsertPoint (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)&gt;&amp;, llvm::function_ref&lt;llvm::IRBuilderBase::InsertPoint (llvm::Argument&amp;, llvm::Value*, llvm::Value*&amp;, llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)&gt;&amp;)::'lambda'(llvm::StringRef)&gt;::_M_invoke(std::_Any_data const&amp;, llvm::StringRef&amp;&amp;) OMPIRBuilder.cpp:0:0
#<!-- -->20 0x00005a7256d88e2d llvm::OpenMPIRBuilder::emitTargetRegionFunction(llvm::TargetRegionEntryInfo&amp;, std::function&lt;llvm::Function* (llvm::StringRef)&gt;&amp;, bool, llvm::Function*&amp;, llvm::Constant*&amp;) (/software-local/sources/llvm-20/bin/flang+0x5471e2d)
#<!-- -->21 0x00005a7256dabd04 llvm::OpenMPIRBuilder::createTarget(llvm::OpenMPIRBuilder::LocationDescription const&amp;, bool, llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint, llvm::TargetRegionEntryInfo&amp;, llvm::ArrayRef&lt;int&gt;, llvm::ArrayRef&lt;int&gt;, llvm::SmallVectorImpl&lt;llvm::Value*&gt;&amp;, llvm::function_ref&lt;llvm::OpenMPIRBuilder::MapInfosTy&amp; (llvm::IRBuilderBase::InsertPoint)&gt;, llvm::function_ref&lt;llvm::IRBuilderBase::InsertPoint (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)&gt;, llvm::function_ref&lt;llvm::IRBuilderBase::InsertPoint (llvm::Argument&amp;, llvm::Value*, llvm::Value*&amp;, llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)&gt;, llvm::SmallVector&lt;llvm::OpenMPIRBuilder::DependData, 2u&gt;, bool) (/software-local/sources/llvm-20/bin/flang+0x5494d04)
#<!-- -->22 0x00005a7254c45681 convertOmpTarget(mlir::Operation&amp;, llvm::IRBuilderBase&amp;, mlir::LLVM::ModuleTranslation&amp;) (.part.0) OpenMPToLLVMIRTranslation.cpp:0:0
#<!-- -->23 0x00005a7254c55f47 convertHostOrTargetOperation(mlir::Operation*, llvm::IRBuilderBase&amp;, mlir::LLVM::ModuleTranslation&amp;) OpenMPToLLVMIRTranslation.cpp:0:0
#<!-- -->24 0x00005a725662058e mlir::LLVM::ModuleTranslation::convertOperation(mlir::Operation&amp;, llvm::IRBuilderBase&amp;, bool) (/software-local/sources/llvm-20/bin/flang+0x4d0958e)
#<!-- -->25 0x00005a72566250f3 mlir::LLVM::ModuleTranslation::convertBlockImpl(mlir::Block&amp;, bool, llvm::IRBuilderBase&amp;, bool) (/software-local/sources/llvm-20/bin/flang+0x4d0e0f3)
#<!-- -->26 0x00005a72566282ee mlir::LLVM::ModuleTranslation::convertOneFunction(mlir::LLVM::LLVMFuncOp) (/software-local/sources/llvm-20/bin/flang+0x4d112ee)
#<!-- -->27 0x00005a7256629818 mlir::LLVM::ModuleTranslation::convertFunctions() (/software-local/sources/llvm-20/bin/flang+0x4d12818)
#<!-- -->28 0x00005a7256632a44 mlir::translateModuleToLLVMIR(mlir::Operation*, llvm::LLVMContext&amp;, llvm::StringRef, bool) (/software-local/sources/llvm-20/bin/flang+0x4d1ba44)
#<!-- -->29 0x00005a72536967a8 Fortran::frontend::CodeGenAction::generateLLVMIR() (/software-local/sources/llvm-20/bin/flang+0x1d7f7a8)
#<!-- -->30 0x00005a7253699dc8 Fortran::frontend::CodeGenAction::executeAction() (/software-local/sources/llvm-20/bin/flang+0x1d82dc8)
#<!-- -->31 0x00005a7253313d91 Fortran::frontend::FrontendAction::execute() (/software-local/sources/llvm-20/bin/flang+0x19fcd91)
#<!-- -->32 0x00005a725330212f Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&amp;) (/software-local/sources/llvm-20/bin/flang+0x19eb12f)
#<!-- -->33 0x00005a725331bbbd Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/software-local/sources/llvm-20/bin/flang+0x1a04bbd)
#<!-- -->34 0x00005a725289ce98 fc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*) (/software-local/sources/llvm-20/bin/flang+0xf85e98)
#<!-- -->35 0x00005a72527b293f main (/software-local/sources/llvm-20/bin/flang+0xe9b93f)
#<!-- -->36 0x00007619b7629d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#<!-- -->37 0x00007619b7629e40 call_init ./csu/../csu/libc-start.c:128:20
#<!-- -->38 0x00007619b7629e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#<!-- -->39 0x00005a725289bd15 _start (/software-local/sources/llvm-20/bin/flang+0xf84d15)
flang-20: error: unable to execute command: Segmentation fault (core dumped)
flang-20: error: flang frontend command failed due to signal (use -v to see invocation)
flang version 20.0.0git (https://github.com/llvm/llvm-project 70334081f75d67900c6ffa193c60c4d6f4767354)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /software-local/sources/llvm-20/bin
flang-20: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
flang-20: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
flang-20: note: diagnostic msg: /tmp/test_offload_stack-038dfb
flang-20: note: diagnostic msg: /tmp/test_offload_stack-038dfb.sh
flang-20: note: diagnostic msg: 

********************

However, running the distribute-parallel-do-simd.f90 test gives no error

./build/bin/llvm-lit -v flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90

-- Testing: 1 tests, 1 workers --
PASS: Flang :: Lower/OpenMP/distribute-parallel-do-simd.f90 (1 of 1)
Exit Code: 0

Command Output (stderr):
--
RUN: at line 4: bbc -fopenmp -emit-hlfir /software-local/sources/llvm-project/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90 -o - | /software-local/sources/llvm-project/build/bin/FileCheck /software-local/sources/llvm-project/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90
+ bbc -fopenmp -emit-hlfir /software-local/sources/llvm-project/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90 -o -
+ /software-local/sources/llvm-project/build/bin/FileCheck /software-local/sources/llvm-project/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90
RUN: at line 5: /software-local/sources/llvm-project/build/bin/flang -fc1 -fopenmp -emit-hlfir /software-local/sources/llvm-project/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90 -o - | /software-local/sources/llvm-project/build/bin/FileCheck /software-local/sources/llvm-project/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90
+ /software-local/sources/llvm-project/build/bin/flang -fc1 -fopenmp -emit-hlfir /software-local/sources/llvm-project/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90 -o -
+ /software-local/sources/llvm-project/build/bin/FileCheck /software-local/sources/llvm-project/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90

--

********************

Testing Time: 0.07s

Total Discovered Tests: 1
  Passed: 1 (100.00%)

LLVM commit: 7033408
LLVM build options:

CC=gcc
CXX=g++
BUILD_TYPE=Release
TARGETS_TO_BUILD="AMDGPU;X86"
NUMTHREADS=$(nproc)
LLVM_PATH=$1
INSTALL_DIR=$2

CMAKE_OPTIONS="-DLLVM_ENABLE_PROJECTS=clang;flang;compiler-rt;lld \
               -DLLVM_ENABLE_RUNTIMES=openmp;offload \
	       -DOPENMP_ENABLE_LIBOMPTARGET=ON \
	       -DLIBOMPTARGET_DEVICE_ARCHITECTURES=gfx908 \
	       -DLLVM_ENABLE_TESTS=ON \
	       -DFLANG_INCLUDE_TESTS=ON \
	       -DCMAKE_C_COMPILER=$CC \
               -DCMAKE_CXX_COMPILER=$CXX \
               -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
               -DLLVM_ENABLE_ASSERTIONS=OFF \
               -DLLVM_TARGETS_TO_BUILD=$TARGETS_TO_BUILD \
               -DCLANG_ANALYZER_ENABLE_Z3_SOLVER=0 \
               -DLLVM_INCLUDE_BENCHMARKS=0 \
               -DLLVM_ENABLE_OCAMLDOC=OFF \
               -DLLVM_ENABLE_BINDINGS=OFF \
               -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=OFF \
               -DLLVM_ENABLE_DUMP=OFF \
               -DLLVM_BUILD_LLVM_DYLIB=ON \
               -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR"

cmake -S $LLVM_PATH/llvm -B $LLVM_PATH/build -G Ninja $CMAKE_OPTIONS

Is something breaking during the installation process?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] flang:ir flang:openmp
Projects
None yet
Development

No branches or pull requests

3 participants