This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Add flag for disabling thread state in runtime
ClosedPublic

Authored by jhuber6 on Feb 17 2022, 7:19 PM.

Details

Summary

The runtime uses thread state values to indicate when we use an ICV or
are in nested parallelism. This is done for OpenMP correctness, but it
not needed in the majority of cases. The new flag added is
-fopenmp-assume-no-thread-state.

Diff Detail

Event Timeline

jhuber6 created this revision.Feb 17 2022, 7:19 PM
jhuber6 requested review of this revision.Feb 17 2022, 7:19 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 17 2022, 7:19 PM

I'd go with config::mayRequireThreadSpecificState or sth.
Also some documentation there.

you should be able to use assertions, like ASSERT(false && "...."). Which gives us messages in assert mode if violated.

Clang documentation should be something like
no thread in parallel region will modify an ICV.

jhuber6 updated this revision to Diff 409845.Feb 17 2022, 7:35 PM

Making suggested changes.

jhuber6 updated this revision to Diff 409847.Feb 17 2022, 7:40 PM

Change name

jdoerfert accepted this revision.Feb 17 2022, 8:02 PM

Last nit, otherwise LG

openmp/libomptarget/DeviceRTL/src/State.cpp
385

My bad, should have been

ASSERT(config::mayUseThreadStates() && "...").

also below.

This revision is now accepted and ready to land.Feb 17 2022, 8:02 PM
jhuber6 updated this revision to Diff 409850.Feb 17 2022, 8:04 PM

Changing assert

ye-luo added a subscriber: ye-luo.Feb 17 2022, 10:01 PM

Change title
threat state
to
thread state

jhuber6 retitled this revision from [OpenMP] Add flag for disabling threat state in runtime to [OpenMP] Add flag for disabling thread state in runtime.Feb 18 2022, 5:28 AM
jhuber6 edited the summary of this revision. (Show Details)
This revision was automatically updated to reflect the committed changes.