[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 20:48:46 PDT 2021


ye-luo added a comment.

Luckily I sniffed a can of worms and put up this patch.

I grep "omptarget.h" and "OFFLOAD_SUCCESS" through out the repository and found zero hit outside libomptarget directory.
So I think no matter whatever value is returned via __tgt_target_* as int, the value is ignored.

Here is the list of __tgt_target funciton which returns int.

  openmp/libomptarget/include/omptarget.h:int __tgt_target_nowait(int64_t device_id, void *host_ptr, int32_t arg_num,
  openmp/libomptarget/include/omptarget.h:int __tgt_target_mapper(ident_t *loc, int64_t device_id, void *host_ptr,
  openmp/libomptarget/include/omptarget.h:int __tgt_target_nowait_mapper(ident_t *loc, int64_t device_id, void *host_ptr,
  openmp/libomptarget/include/omptarget.h:int __tgt_target_teams(int64_t device_id, void *host_ptr, int32_t arg_num,
  openmp/libomptarget/include/omptarget.h:int __tgt_target_teams_nowait(int64_t device_id, void *host_ptr,
  openmp/libomptarget/include/omptarget.h:int __tgt_target_teams_mapper(ident_t *loc, int64_t device_id, void *host_ptr,
  openmp/libomptarget/include/omptarget.h:int __tgt_target_teams_nowait_mapper(

All those without _mapper calls a version with _mapper and it always call handleTargetOutcome before return.
This function stops the code based on the TargetOffloadPolicy.

@grokos could you confirm that the return to outside libomptarget is not used?
if this is the case, I'm in favor of use int32_t as __tgt_rtl_* have and update all internal function targetDataBegin/targetDataEnd/targetDataUpdate/target return type to enum.
leave __tgt_target_* return type as int just for backward compatibility.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109277/new/

https://reviews.llvm.org/D109277



More information about the Openmp-commits mailing list