[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.
This commit is contained in:
Joseph Huber 2025-02-05 20:51:28 -06:00 committed by GitHub
parent ed8a6d6155
commit 7a8779422d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1058,8 +1058,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());
@ -1634,7 +1635,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;