[PATCH] D108493: [HIP] Allow capture this pointer in device lambda
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 8 09:10:34 PDT 2021
yaxunl marked an inline comment as done.
yaxunl added inline comments.
================
Comment at: clang/lib/Sema/SemaCUDA.cpp:881-882
+ } else if (Capture.isThisCapture() && !LangOpts.HIP) {
+ // Capture of this pointer is allowed for HIP since this pointer may be
+ // pointing to managed memory which is accessible on both device and
+ // host sides.
----------------
tra wrote:
> I assume there's no easy way to tell if it's a managed pointer or not.
> Capturing a non-managed pointer would still be bad.
> Should we make it a warning instead?
>
>
warning makes sense. will do.
Also this should apply to CUDA too. Although clang does not support `__managed__` keyword for CUDA, `this` pointer may be allocated in managed memory through host API's.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108493/new/
https://reviews.llvm.org/D108493
More information about the cfe-commits
mailing list