[llvm] [Offload] Use `amd_signal_async_handler` for host function calls (PR #154131)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 1 07:05:39 PDT 2025
================
@@ -1525,13 +1530,22 @@ struct AMDGPUStreamTy {
InputSignal = consume(OutputSignal).second;
}
- // "Leaking" the thread here is consistent with other work added to the
- // queue. The input and output signals will remain valid until the output is
- // signaled.
- std::thread(CallbackWrapper, InputSignal, OutputSignal, Callback, UserData)
- .detach();
+ auto *CallbackData = new CallbackDataType{Callback, UserData, OutputSignal};
+ if (InputSignal && InputSignal->load()) {
+ hsa_status_t Status = hsa_amd_signal_async_handler(
+ InputSignal->get(), HSA_SIGNAL_CONDITION_EQ, 0, callbackWrapper,
+ CallbackData);
- return Plugin::success();
+ return Plugin::check(Status, "error in hsa_amd_signal_async_handler: %s");
+ } else {
----------------
arsenm wrote:
No else after return
https://github.com/llvm/llvm-project/pull/154131
More information about the llvm-commits
mailing list