[llvm] [Offload] Add a function to register an RPC Server callback (PR #178774)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 30 05:59:47 PST 2026


================
@@ -573,3 +573,10 @@ EXTERN void __tgt_target_nowait_query(void **AsyncHandle) {
   delete AsyncInfo;
   *AsyncHandle = nullptr;
 }
+
+EXTERN void __tgt_register_rpc_callback(unsigned (*Callback)(void *,
+                                                             unsigned)) {
+  for (auto &Plugin : PM->plugins())
+    if (Plugin.is_initialized())
+      Plugin.getRPCServer().registerCallback(Callback);
----------------
jhuber6 wrote:

I guess? It wouldn't make a difference functionally because it resolves on the first match, but it would slow down the server if the user spammed it. I'm not sure what would compel a user to register the same callback multiple times but it will still function just fine, I don't think it's worth turning this into a map or anything just to save a few cycles in the event of catastrophic user error

https://github.com/llvm/llvm-project/pull/178774


More information about the llvm-commits mailing list