[Openmp-commits] [PATCH] D110193: [RFC] Initial documentation for declare target indirect support.

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Sep 21 18:35:02 PDT 2021

jdoerfert added inline comments.

Comment at: openmp/libomptarget/docs/declare_target_indirect.md:35
+FE generates runtime lookup code to match the function address against the key `host_ptr` and produce the new function address `tgt_ptr` that is then used for the indirect function call.
vzakhari wrote:
> If needed, we can isolate the lookup implementation into a device RTL API, so that FE just generates a lookup call to map the original function address to the device function address.
API, please: `fp()` -> `(lookupDevPtr(fp))()`

Comment at: openmp/libomptarget/docs/declare_target_indirect.md:39
+Since all pointers are supposed to be translated/mapped, when program does not use **required unified_shared_memory**, it is possible to avoid generating the runtime dispatch code for indirect function calls. The mapping between host and device address of an indirect function will be established by `libomptarget` during processing of the offload entries table.
How would we translate/map all pointers? I fail to see how we could even identify all (function) pointers (see below). Or did we add wording to the standard to forbid this?

char data[sizeof(fp)];
memcpy(data, &fp, sizeof(fp));

#pragma omp target map(to:data[:sizeof(fp)])
  void (*fpc)();
  memcpy(&fpc, data, sizeof(fp));

Modulo my syntax errors ;)

  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list