[llvm] [OFFLOAD] Add missing data fence API for libomptarget migration (PR #172223)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 14 12:54:49 PST 2025
https://github.com/fineg74 created https://github.com/llvm/llvm-project/pull/172223
Add missing liboffload data fence API for libomptarget migration
This PR adds liboffload data fence API that needed to make libomptarget to use liboffload
>From 87a0f3e3e3257799f846a15e467d2aa76e04fd8c Mon Sep 17 00:00:00 2001
From: "Fine, Gregory" <gregory.fine at intel.com>
Date: Fri, 12 Dec 2025 16:43:02 -0800
Subject: [PATCH] Add data fence API
---
offload/liboffload/API/Queue.td | 9 +++++++++
offload/liboffload/src/OffloadImpl.cpp | 9 +++++++++
2 files changed, 18 insertions(+)
diff --git a/offload/liboffload/API/Queue.td b/offload/liboffload/API/Queue.td
index ededa9cc92fef..40280fb013528 100644
--- a/offload/liboffload/API/Queue.td
+++ b/offload/liboffload/API/Queue.td
@@ -125,3 +125,12 @@ def olLaunchHostFunction : Function {
];
let returns = [];
}
+
+def olDataFence : Function {
+ let desc = "Insert a data fence between previous data operations and the following operations if necessary for the device.";
+ let details = [];
+ let params = [
+ Param<"ol_queue_handle_t", "Queue", "handle of the queue", PARAM_IN>
+ ];
+ let returns = [];
+}
diff --git a/offload/liboffload/src/OffloadImpl.cpp b/offload/liboffload/src/OffloadImpl.cpp
index eab9627217ca8..c82ec0cc02db4 100644
--- a/offload/liboffload/src/OffloadImpl.cpp
+++ b/offload/liboffload/src/OffloadImpl.cpp
@@ -1214,5 +1214,14 @@ Error olLaunchHostFunction_impl(ol_queue_handle_t Queue,
Queue->AsyncInfo);
}
+Error olDataFence_impl(ol_queue_handle_t Queue) {
+ if (Queue->AsyncInfo->Queue) {
+ if (auto Err = Queue->Device->Device->dataFence(Queue->AsyncInfo))
+ return Err;
+ }
+
+ return Error::success();
+}
+
} // namespace offload
} // namespace llvm
More information about the llvm-commits
mailing list