[Offload] Stop the RPC server faiilng with more than one GPU (#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 7a8779422dad058f11cd473d409f42e32859788d)
This commit is contained in:
Joseph Huber 2025-02-05 20:51:28 -06:00 committed by Tom Stellard
parent e40790864b
commit dbb2699d2e

View File

@ -1057,8 +1057,9 @@ Error GenericDeviceTy::setupRPCServer(GenericPluginTy &Plugin,
if (auto Err = Server.initDevice(*this, Plugin.getGlobalHandler(), Image))
return Err;
if (auto Err = Server.startThread())
return Err;
if (!Server.Thread->Running.load(std::memory_order_acquire))
if (auto Err = Server.startThread())
return Err;
RPCServer = &Server;
DP("Running an RPC server on device %d\n", getDeviceId());
@ -1633,7 +1634,7 @@ Error GenericPluginTy::deinit() {
if (GlobalHandler)
delete GlobalHandler;
if (RPCServer && RPCServer->Thread->Running.load(std::memory_order_relaxed))
if (RPCServer && RPCServer->Thread->Running.load(std::memory_order_acquire))
if (Error Err = RPCServer->shutDown())
return Err;