This is an archive of the discontinued LLVM Phabricator instance.

[LIBOMPTARGET]Ignore empty target descriptors.
ClosedPublic

Authored by ABataev on Jan 9 2020, 12:04 PM.

Details

Summary

If the dynamically loaded module has been compiled with -fopenmp-targets
and has no target regions, it has empty target descriptor. It leads to a
crash at the runtime if another module has at least one target region
and at least one entry in its descriptor. The runtime library is unable
to load the empty binary descriptor and terminates the execution.
Caused by a clang-offload-wrapper.

Diff Detail

Event Timeline

ABataev created this revision.Jan 9 2020, 12:04 PM
Herald added a project: Restricted Project. · View Herald Transcript
This revision is now accepted and ready to land.Jan 9 2020, 12:29 PM

Unit tests: pass. 61723 tests passed, 0 failed and 779 were skipped.

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

This revision was automatically updated to reflect the committed changes.

I got a question: since there is no target region in the shared library at all, why is desc->NumDeviceImages = 1 where desc is the one in the shared library?

I got a question: since there is no target region in the shared library at all, why is desc->NumDeviceImages = 1 where desc is the one in the shared library?

It is an empty target region with no entries at all. It has some data inside (mostly, metadata, I assume), but no real target entries.