This is an archive of the discontinued LLVM Phabricator instance.

[libc] Partially implement `atexit` on the GPU
ClosedPublic

Authored by jhuber6 on Apr 25 2023, 7:37 PM.

Details

Summary

The atexit function controls registering functions to call at the end
of the program. This is difficult to do in general on the GPU because of
the lack of a real mutex implementation. We primarily provide this for
testing where we can explicitly restrict how the atexit registration
functions are called. So we simply create a passthrough Mutex to get
past the usage of it as per @sivachandra's suggestion.

Depends on D149225

Diff Detail

Event Timeline

jhuber6 created this revision.Apr 25 2023, 7:37 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 25 2023, 7:37 PM
jhuber6 requested review of this revision.Apr 25 2023, 7:37 PM

I will assume that the correctness on the GPU side will be ensured by other means.

libc/src/__support/threads/gpu/mutex.h
19

s/locks/lock

sivachandra accepted this revision.Apr 25 2023, 10:44 PM
This revision is now accepted and ready to land.Apr 25 2023, 10:44 PM
This revision was landed with ongoing or failed builds.Apr 26 2023, 2:53 PM
This revision was automatically updated to reflect the committed changes.