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. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113126/new/ https://reviews.llvm.org/D113126 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits