This is an archive of the discontinued LLVM Phabricator instance.

[libc][rpc] Allocate locks array within process
ClosedPublic

Authored by JonChesterfield on May 10 2023, 2:28 PM.

Details

Summary

Replaces the globals currently used. Worth changing to a bitmap
before allowing runtime number of ports >> 64. One bit per port is likely
to be cheap enough that sizing for the worst case is always fine, otherwise
in the future we can change to dynamically allocating it.

Diff Detail

Event Timeline

Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 10 2023, 2:28 PM
JonChesterfield requested review of this revision.May 10 2023, 2:28 PM

Main motivation is to make the client/server allocation simpler before extending the test coverage for these classes

libc/src/__support/RPC/rpc.h
107

Number doesn't matter hugely at this point, have gone with deliberately != default_port_count.

jhuber6 added inline comments.May 10 2023, 2:37 PM
libc/src/__support/RPC/rpc.h
107

What's the point of keeping both around?

libc/utils/gpu/loader/amdgpu/Loader.cpp
362

Needs the same in the nvptx loader.

JonChesterfield planned changes to this revision.May 10 2023, 3:24 PM
JonChesterfield added inline comments.
libc/src/__support/RPC/rpc.h
107

I'm expecting the number of ports to be chosen at runtime based on the GPU and the number of locks to be a fixed worst case thing using a couple of kb of device memory

libc/utils/gpu/loader/amdgpu/Loader.cpp
362

Ah yes, will fix. Thanks

  • also nvptx loader
  • fold counts together for now
jhuber6 accepted this revision.May 10 2023, 4:33 PM
This revision is now accepted and ready to land.May 10 2023, 4:33 PM
This revision was automatically updated to reflect the committed changes.