Skip to content

Commit dbb2699

Browse files
jhuber6tstellar
authored andcommitted
[Offload] Stop the RPC server faiilng with more than one GPU (llvm#125982)
Summary: Pretty dumb mistake of me, forgot that this is run per-device and per-plugin, which fell through the cracks with my testing because I have two GPUs that use different plugins. (cherry picked from commit 7a87794)
1 parent e407908 commit dbb2699

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

offload/plugins-nextgen/common/src/PluginInterface.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,8 +1057,9 @@ Error GenericDeviceTy::setupRPCServer(GenericPluginTy &Plugin,
10571057
if (auto Err = Server.initDevice(*this, Plugin.getGlobalHandler(), Image))
10581058
return Err;
10591059

1060-
if (auto Err = Server.startThread())
1061-
return Err;
1060+
if (!Server.Thread->Running.load(std::memory_order_acquire))
1061+
if (auto Err = Server.startThread())
1062+
return Err;
10621063

10631064
RPCServer = &Server;
10641065
DP("Running an RPC server on device %d\n", getDeviceId());
@@ -1633,7 +1634,7 @@ Error GenericPluginTy::deinit() {
16331634
if (GlobalHandler)
16341635
delete GlobalHandler;
16351636

1636-
if (RPCServer && RPCServer->Thread->Running.load(std::memory_order_relaxed))
1637+
if (RPCServer && RPCServer->Thread->Running.load(std::memory_order_acquire))
16371638
if (Error Err = RPCServer->shutDown())
16381639
return Err;
16391640

0 commit comments

Comments
 (0)