[Openmp-commits] [openmp] [OpenMP][libomptarget][RFC] extend libomptarget with mechanism to execute fill memory on the target (PR #73801)
Matt Arsenault via Openmp-commits
openmp-commits at lists.llvm.org
Tue Jan 9 00:38:37 PST 2024
================
@@ -1895,6 +1903,29 @@ int32_t __tgt_rtl_data_exchange_async(int32_t SrcDeviceId, void *SrcPtr,
return OFFLOAD_SUCCESS;
}
+int32_t __tgt_rtl_fill_memory(int32_t DevId, void *Ptr, int32_t ByteVal,
+ int64_t NumBytes) {
+ return __tgt_rtl_fill_memory_async(DevId, Ptr, ByteVal, NumBytes,
+ /* AsyncInfoPtr */ nullptr);
+}
+
+int32_t __tgt_rtl_fill_memory_async(int32_t DevId, void *Ptr, int32_t Val,
+ int64_t NumValues,
+ __tgt_async_info *AsyncInfo) {
+ printf("--> in function %s\n", __FUNCTION__);
+ printf("--> Dev: %d, Ptr: %p, Val: %d, NumValues: %ld\n", DevId, Ptr, Val,
+ NumValues);
+ GenericDeviceTy &Device = Plugin::get().getDevice(DevId);
+ auto Err = Device.fillMemory(Ptr, Val, NumValues, AsyncInfo);
+ if (Err) {
+ REPORT("Failure to fill memory on device (%d) at pointer " DPxMOD
+ " with byte value %d and %" PRId64 " values: %s\n",
+ DevId, DPxPTR(Ptr), Val, NumValues, toString(std::move(Err)).data());
----------------
arsenm wrote:
Is there really no better way to print the error here?
https://github.com/llvm/llvm-project/pull/73801
More information about the Openmp-commits
mailing list