This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Use the OpenMPIRBuilder for `cancel` directives

Authored by jdoerfert on Dec 27 2019, 2:24 PM.



An omp cancel parallel needs to be emitted by the OpenMPIRBuilder if
the parallel was emitted by the OpenMPIRBuilder. This patch makes
this possible. The cancel logic is shared with the cancel barriers.
Testing is done via unit tests and the clang cancel_codegen.cpp file
once D70290 lands.

Diff Detail

Event Timeline

jdoerfert created this revision.Dec 27 2019, 2:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 27 2019, 2:24 PM

Unit tests: fail. 61126 tests passed, 1 failed and 728 were skipped.

failed: libc++.std/thread/thread_mutex/thread_mutex_requirements/thread_mutex_requirements_mutex/thread_mutex_class/try_lock.pass.cpp

clang-tidy: fail. Please fix clang-tidy findings.

clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

JonChesterfield accepted this revision.Dec 30 2019, 4:18 AM

I like this, thanks. Very clear.


The integer numbers correspond to the kmp_cancel_kind_t enum in runtime/src/kmp.h. The target offloading presently ignores this argument, but the host version has a control flow dependency on it.

I think the enum should be shared between the compiler and the runtime, or failing that, some test code should include kmp.h and check the numbers still match.

This feels like a familiar point - I've just sent an email to openmp-dev to discuss whether we can share constants between the two without copy & paste.

This revision is now accepted and ready to land.Dec 30 2019, 4:18 AM
jdoerfert marked 2 inline comments as done.Dec 30 2019, 9:38 AM
jdoerfert added inline comments.

I move them into OMPKinds.def, we can share them from there. I'll respond to the mailing list.

This revision was automatically updated to reflect the committed changes.
jdoerfert marked an inline comment as done.