[llvm] [OFFLOAD] Add missing initialize record replay API for libomptarget migration (PR #172232)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 14 14:11:15 PST 2025
https://github.com/fineg74 created https://github.com/llvm/llvm-project/pull/172232
Add missing liboffload initialize record replay API for libomptarget migration
This PR adds liboffload initialize record replay API that needed to make libomptarget to use liboffload
>From 3557a88eb0e1e8c1516dc65cd0348366a83e2fd4 Mon Sep 17 00:00:00 2001
From: "Fine, Gregory" <gregory.fine at intel.com>
Date: Fri, 12 Dec 2025 12:44:02 -0800
Subject: [PATCH] Add missing Replay API
---
offload/liboffload/API/Device.td | 13 +++++++++++++
offload/liboffload/src/OffloadImpl.cpp | 15 +++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/offload/liboffload/API/Device.td b/offload/liboffload/API/Device.td
index 6ada191089674..8a7735354e0a9 100644
--- a/offload/liboffload/API/Device.td
+++ b/offload/liboffload/API/Device.td
@@ -131,3 +131,16 @@ def olGetDeviceInfoSize : Function {
Return<"OL_ERRC_INVALID_DEVICE">
];
}
+
+def olInitializeRecordReplay : Function {
+ let desc = "Initializes the record and replay mechanism.";
+ let params = [
+ Param<"ol_device_handle_t", "Device", "handle of the device", PARAM_IN>,
+ Param<"uint64_t", "MemorySize", " The number of bytes to be (pre-)allocated by the bump allocator", PARAM_IN>,
+ Param<"void *", "VAddr", "handle of the destination device", PARAM_IN>,
+ Param<"bool", "IsRecord", "Activates the record replay mechanism in 'record' mode or 'replay' mode", PARAM_IN>,
+ Param<"bool", "SaveOutput", "Store the device memory after kernel execution on persistent storage", PARAM_IN>,
+ Param<"uint64_t *", "ReqPtrArgOffset", "handle of the destination device", PARAM_OUT>,
+ ];
+ let returns = [];
+}
diff --git a/offload/liboffload/src/OffloadImpl.cpp b/offload/liboffload/src/OffloadImpl.cpp
index eab9627217ca8..78ff8750b94bc 100644
--- a/offload/liboffload/src/OffloadImpl.cpp
+++ b/offload/liboffload/src/OffloadImpl.cpp
@@ -1214,5 +1214,20 @@ Error olLaunchHostFunction_impl(ol_queue_handle_t Queue,
Queue->AsyncInfo);
}
+Error olInitializeRecordReplay_impl(ol_device_handle_t Device,
+ uint64_t MemorySize, void *VAddr,
+ bool IsRecord, bool SaveOutput,
+ uint64_t *ReqPtrArgOffset) {
+ uint64_t ReqPtrArgOffsetOut = 0;
+ Expected<int> Rc = Device->Device->Plugin.initialize_record_replay(
+ Device->DeviceNum, MemorySize, VAddr, IsRecord, SaveOutput,
+ ReqPtrArgOffsetOut);
+ if (Rc) {
+ return Rc.takeError();
+ }
+ *ReqPtrArgOffset = ReqPtrArgOffsetOut;
+ return Error::success();
+}
+
} // namespace offload
} // namespace llvm
More information about the llvm-commits
mailing list