Page MenuHomePhabricator

[OpenMP] Only generate runtime flags with host input
ClosedPublic

Authored by jhuber6 on Jan 27 2022, 11:55 AM.

Details

Summary

This patch changes the code generation of runtime flags to only occur if
a host bitcode file was passed in. This is a cheap way to determine if
we are compiling the OpenMP device runtime itself or user code. This is
needed because the global flags we generate for the device runtime e.g.
__omp_rtl_debug_kind were being generated with default values when we
compiled the runtime library. This would then invalidate the ones we
want to be able to add in when the user defines it.

Diff Detail

Event Timeline

jhuber6 created this revision.Jan 27 2022, 11:55 AM
jhuber6 requested review of this revision.Jan 27 2022, 11:55 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJan 27 2022, 11:55 AM
This revision is now accepted and ready to land.Jan 27 2022, 12:07 PM

Do we have an alternative w/o need to add a flag dedicated for building a very specific target, OpenMP device runtime?

Do we have an alternative w/o need to add a flag dedicated for building a very specific target, OpenMP device runtime?

The only difference between building the OpenMP device runtime and user code is that we have -mlink-builtin-bitcode=bclib in the latter case. We could parse that but I felt like this is clearer.

Do we have an alternative w/o need to add a flag dedicated for building a very specific target, OpenMP device runtime?

The only difference between building the OpenMP device runtime and user code is that we have -mlink-builtin-bitcode=bclib in the latter case. We could parse that but I felt like this is clearer.

Actually I believe we might be able to just check for bitcode library input as well, since that's already forwarded to codegen from an existing flag that we only pass for host compilations.

jhuber6 retitled this revision from [OpenMP] Introduce new flag to indicate OpenMP runtime compilation to [OpenMP] Only generate runtime flags with host input.Jan 27 2022, 12:52 PM
jhuber6 edited the summary of this revision. (Show Details)
jhuber6 updated this revision to Diff 403762.Jan 27 2022, 12:52 PM

Changing to use host bitcode instead of adding a new flag.

Tests, if possible?

There's an existing flag for compile for device only, that's probably close enough to the right condition to not emit these flags.

Tests, if possible?

The flags being generated should be covered by an existing test, I'll add a line where we don't specify a bitcode library.

There's an existing flag for compile for device only, that's probably close enough to the right condition to not emit these flags.

We already check that before entering this code block, both the runtime and host code use that flag so we can't differentiate with it alone.

jhuber6 updated this revision to Diff 403775.Jan 27 2022, 1:16 PM

Adding test

This revision was landed with ongoing or failed builds.Jan 27 2022, 3:44 PM
This revision was automatically updated to reflect the committed changes.