[libc-commits] [PATCH] D149897: [libc][rpc] Update locking to work on volta
Jon Chesterfield via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu May 4 13:26:09 PDT 2023
JonChesterfield added a comment.
We might end up with memory fences in lock/unlock but I'm hopeful the ones associated with send/recv will be sufficient.
Unlock is straightforward - fetch_and is doing the same thing as store zero, except making sure that at most one write of zero occurs in the warp.
Lock took a while to derive. The problem is that fetch_or can be run by threads which are not in lane_mask, or by a subset of lane_mask, and the threads outside of lane_mask may be the ones that win the fetch_or to set the bit. It might be clearer to use is_first_lane in lock instead of having all threads try to take the lock.
Both avoid branching in is_first_lane, partly on performance grounds and partly because simpler control flow seems to compile more reliably. This might allow removing the broadcast functions in util.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149897/new/
https://reviews.llvm.org/D149897
More information about the libc-commits
mailing list