Skip to content

[flang][OpenMP] Compiler crash with nowait on target construct #124578

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
abidh opened this issue Jan 27, 2025 · 2 comments · Fixed by #124720
Closed

[flang][OpenMP] Compiler crash with nowait on target construct #124578

abidh opened this issue Jan 27, 2025 · 2 comments · Fixed by #124720
Assignees
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] llvm:openmpirbuilder Issues related to problems in the llvm-project/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Comments

@abidh
Copy link
Contributor

abidh commented Jan 27, 2025

Consider the following program.

program nowait_reproducer
   implicit none

   real x

   !$omp target map(tofrom: x) nowait
      x = 5
   !$omp end target

end program nowait_reproducer

Compiling it with the following cause the compiler to crash

flang -fopenmp test.f90

Note that adding --offload-arch makes the crash go away. The call stack of the crash site looks like as follows:

llvm::CallInst::init
llvm::IRBuilderBase::CreateCall
llvm::OpenMPIRBuilder::emitTargetTask
llvm::OpenMPIRBuilder::finalize
mlir::LLVM::ModuleTranslation::~ModuleTranslation
@llvmbot llvmbot added the flang Flang issues not falling into any other category label Jan 27, 2025
@abidh
Copy link
Contributor Author

abidh commented Jan 27, 2025

Hi @ergawy
I thought I will bring it to your notice as you seem to have worked in this area.

@ergawy
Copy link
Member

ergawy commented Jan 27, 2025

Thanks Abid. I will take a look at this.

@ergawy ergawy self-assigned this Jan 27, 2025
@EugeneZelenko EugeneZelenko added crash Prefer [crash-on-valid] or [crash-on-invalid] flang:openmp and removed flang Flang issues not falling into any other category labels Jan 27, 2025
ergawy added a commit to ergawy/llvm-project that referenced this issue Jan 28, 2025
Fixes llvm#124578

Handles the `nowait` clause for `omp.target` ops when the actual target
is the host (i.e. there is no target device). Rather than only checking
for the `HasNoWait` boolean, we also check for the presence/absence of a
`DeviceID` value. We only emit the target task if both are present.
@ergawy ergawy closed this as completed in 83433d9 Jan 28, 2025
github-actions bot pushed a commit to arm/arm-toolchain that referenced this issue Jan 28, 2025
…n targets host (#124720)

Fixes llvm/llvm-project#124578

Handles the `nowait` clause for `omp.target` ops when the actual target
is the host (i.e. there is no target device). Rather than only checking
for the `HasNoWait` boolean, we also check for the presence/absence of a
`DeviceID` value. We only emit the target task if both are present.
@EugeneZelenko EugeneZelenko added llvm:openmpirbuilder Issues related to problems in the llvm-project/lib/Frontend/OpenMP/OMPIRBuilder.cpp and removed flang:openmp labels Jan 28, 2025
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] llvm:openmpirbuilder Issues related to problems in the llvm-project/lib/Frontend/OpenMP/OMPIRBuilder.cpp
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants