[Openmp-commits] [PATCH] D113126: [OpenMP][NFCI] Embed the source location string size in the ident_t

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Dec 28 21:02:18 PST 2021

jdoerfert added a comment.

In D113126#3211935 <https://reviews.llvm.org/D113126#3211935>, @tianshilei1992 wrote:

> In D113126#3122947 <https://reviews.llvm.org/D113126#3122947>, @jdoerfert wrote:
>> In D113126#3122659 <https://reviews.llvm.org/D113126#3122659>, @tianshilei1992 wrote:
>>> I'm not convinced. `std::strlen` can do the job. Can you explain more why need it?
>> Because the ident_t is on the device and you want to grab it from the host.
> So you mean `strlen` is not available on device?

We have a device pointer to an ident_t object. We don't know the corresponding host address and we are on the host. We can copy over the ident_t with a single d2h but for the string we now need to either launch a kernel that computes `strlen` on the device or copy it byte-by-byte, neither are good options. Instead, we can simply embed the string length in the otherwise unused ident_t field and copy it over with a second d2h memcpy.

  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list