[Openmp-commits] [PATCH] D109277: [OpenMP][libomptarget] Change internal return status to enum type

Ye Luo via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Sep 5 23:38:40 PDT 2021

ye-luo added a comment.

In D109277#2984460 <https://reviews.llvm.org/D109277#2984460>, @tianshilei1992 wrote:

> `__tgt_target` series is emitted by the compiler, and the return value is also checked. If the offloading fails, it calls a host version. Currently if offloading is mandatory, the program immediately `abort` in `libomptarget`. That being said, the return value of those interface functions are being used.

My puzzle is how the compiler generated callers understand what are the meanings of return value. It seems like based on an agreement without any communication.

> If you want a cleaner way, I think we can define a set of return values for plug-in, another set of return values for those `libomptarget` interfaces, and a set of return values for internal functions. The first two sets have to be integer as they are for C functions. The last one can be anything you want, enum, enum class, or even a real class.

1. return values for plug-in
2. `libomptarget` interface
3. internal functions

I found 1 and 2 actually doesn't mean precisely the same thing. So I took out D109304 <https://reviews.llvm.org/D109304>. For simplicity, I will using the same enum for 1 and 3.

So keep 1 as it was int32_t.  keep 2 as it was int.
Then change 3 from int to int32_t if not already on int32_t

  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list