[Openmp-commits] [PATCH] D109304: [OpenMP][libomptarget] Add __tgt_target_return_t enum for __tgt_target_XXX return int
Ye Luo via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Sun Sep 5 23:14:22 PDT 2021
ye-luo created this revision.
Herald added subscribers: guansong, yaxunl.
ye-luo requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.
The defintion of OFFLOAD_SUCCESS and OFFLOAD_FAIL used in plugin APIs and libomptarget public APIs are not consistent.
Create __tgt_target_return_t for libomptarget public APIs.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D109304
Files:
openmp/libomptarget/src/interface.cpp
Index: openmp/libomptarget/src/interface.cpp
===================================================================
--- openmp/libomptarget/src/interface.cpp
+++ openmp/libomptarget/src/interface.cpp
@@ -21,6 +21,18 @@
#include <cstdlib>
#include <mutex>
+/// return flags of __tgt_target_XXX public APIs
+enum __tgt_target_return_t : int {
+ /// successful offload executed on a target device
+ OMP_TGT_SUCCESS = 0,
+ /// offload may not execute on the requested target device
+ /// this scenario can be caused by the device not available or unsupported
+ /// as described in the Execution Model in the specifcation
+ /// this status may not be used for target device execution failure
+ /// which should be handled internally in libomptarget
+ OMP_TGT_FAIL = ~0
+};
+
////////////////////////////////////////////////////////////////////////////////
/// adds requires flags
EXTERN void __tgt_register_requires(int64_t flags) {
@@ -284,7 +296,7 @@
DPxPTR(host_ptr), device_id);
if (checkDeviceAndCtors(device_id, loc) != OFFLOAD_SUCCESS) {
DP("Not offloading to device %" PRId64 "\n", device_id);
- return OFFLOAD_FAIL;
+ return OMP_TGT_FAIL;
}
if (getInfoLevel() & OMP_INFOTYPE_KERNEL_ARGS)
@@ -307,7 +319,7 @@
if (rc == OFFLOAD_SUCCESS)
rc = AsyncInfo.synchronize();
handleTargetOutcome(rc == OFFLOAD_SUCCESS, loc);
- return rc;
+ return OMP_TGT_SUCCESS;
}
EXTERN int __tgt_target_nowait_mapper(
@@ -357,7 +369,7 @@
DPxPTR(host_ptr), device_id);
if (checkDeviceAndCtors(device_id, loc) != OFFLOAD_SUCCESS) {
DP("Not offloading to device %" PRId64 "\n", device_id);
- return OFFLOAD_FAIL;
+ return OMP_TGT_FAIL;
}
if (getInfoLevel() & OMP_INFOTYPE_KERNEL_ARGS)
@@ -380,7 +392,7 @@
if (rc == OFFLOAD_SUCCESS)
rc = AsyncInfo.synchronize();
handleTargetOutcome(rc == OFFLOAD_SUCCESS, loc);
- return rc;
+ return OMP_TGT_SUCCESS;
}
EXTERN int __tgt_target_teams_nowait_mapper(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109304.370849.patch
Type: text/x-patch
Size: 1976 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210906/ae9c4291/attachment.bin>
More information about the Openmp-commits
mailing list