This is an archive of the discontinued LLVM Phabricator instance.

[libc] Fix the implementation of exit on the GPU
ClosedPublic

Authored by jhuber6 on Jun 29 2023, 10:09 AM.

Details

Summary

The RPC calls all have delays associated with them. Currently the exit
function does an async send and immediately exits the GPU. This can have
the effect that the RPC server never sees the exit call and we continue.
This patch changes that to first sync with the server before continuing
to perform its exit. There is still a hazard here, where the kernel can
complete before the RPC call reads back its response, but this is simply
multi-threaded hazards. This change ensures that the server *will*
always exit some time after the GPU exits.

Diff Detail

Event Timeline

jhuber6 created this revision.Jun 29 2023, 10:09 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 29 2023, 10:09 AM
jhuber6 requested review of this revision.Jun 29 2023, 10:09 AM
libc/docs/gpu/support.rst
102

Copy paste error?

libc/src/__support/OSUtil/gpu/quick_exit.cpp
22

I expected the status to go in the first call but it probably doesn't matter. Maybe leave a comment in the client similar to the one in the server?

libc/utils/gpu/server/rpc_server.cpp
106

Sync is a bit overloaded. The idea here is for the client to wait until it's sure something on the server is listening to it before it sends the exit code into the void?

jhuber6 updated this revision to Diff 535887.Jun 29 2023, 10:35 AM

Addressing comments

JonChesterfield accepted this revision.Jun 29 2023, 10:37 AM
This revision is now accepted and ready to land.Jun 29 2023, 10:37 AM
This revision was landed with ongoing or failed builds.Jun 29 2023, 11:22 AM
This revision was automatically updated to reflect the committed changes.