[PATCH] D78655: [CUDA][HIP] Let non-caputuring lambda be host device

2020-06-26 Thread Paul Fultz II via Phabricator via cfe-commits
pfultz2 added a comment. > What's the expected HD property of this template function clip? I think it is intended to be host-only. The function `f` will launch a kernel or threads to utilize the passed lambda. Ideally, it would be nice to make all inlineable functions implicitly HD. There is

[PATCH] D78655: [CUDA][HIP] Let non-caputuring lambda be host device

2020-06-26 Thread Michael Liao via Phabricator via cfe-commits
hliao added a comment. In D78655#2117216 , @pfultz2 wrote: > > Now, back to the specifics of your example. I'm still not 100% sure I > > understand what the problem is. Can you boil down the use case to an > > example on godbolt? > > I dont have a

[PATCH] D78655: [CUDA][HIP] Let non-caputuring lambda be host device

2020-06-26 Thread Paul Fultz II via Phabricator via cfe-commits
pfultz2 added a comment. > Now, back to the specifics of your example. I'm still not 100% sure I > understand what the problem is. Can you boil down the use case to an example > on godbolt? I dont have a specific example, but there could be code like this generic `clip` operator: template

[PATCH] D78655: [CUDA][HIP] Let non-caputuring lambda be host device

2020-06-25 Thread Aaron Enye Shi via Phabricator via cfe-commits
ashi1 added inline comments. Comment at: clang/test/CodeGenCUDA/lambda.cu:53 +// DEV: call void @_ZZ12test_resolvevENKUlvE_clEv +// DEV-LABE: define internal void @_ZZ12test_resolvevENKUlvE_clEv +// DEV: call i32 @_Z10overloadedIiET_v There is a typo here,

[PATCH] D78655: [CUDA][HIP] Let non-caputuring lambda be host device

2020-06-23 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. In D78655#2108047 , @pfultz2 wrote: > > Could you give an example to demonstrate current use and how it will break? > > Here is place where it would break: > >

[PATCH] D78655: [CUDA][HIP] Let non-caputuring lambda be host device

2020-06-22 Thread Paul Fultz II via Phabricator via cfe-commits
pfultz2 added a comment. > Could you give an example to demonstrate current use and how it will break? Here is place where it would break: https://github.com/ROCmSoftwarePlatform/AMDMIGraphX/blob/develop/src/targets/gpu/device/include/migraphx/gpu/device/multi_index.hpp#L129 This change was

[PATCH] D78655: [CUDA][HIP] Let non-caputuring lambda be host device

2020-06-22 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments. Comment at: clang/lib/Sema/SemaCUDA.cpp:753 return; + if (LI.Default == LCD_None && LI.Captures.size() == 0) { +Method->addAttr(CUDADeviceAttr::CreateImplicit(Context)); pfultz2 wrote: > There should at least be a flag to

[PATCH] D78655: [CUDA][HIP] Let non-caputuring lambda be host device

2020-06-22 Thread Paul Fultz II via Phabricator via cfe-commits
pfultz2 added inline comments. Comment at: clang/lib/Sema/SemaCUDA.cpp:753 return; + if (LI.Default == LCD_None && LI.Captures.size() == 0) { +Method->addAttr(CUDADeviceAttr::CreateImplicit(Context)); There should at least be a flag to enable capturing

[PATCH] D78655: [CUDA][HIP] Let non-caputuring lambda be host device

2020-06-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 272539. yaxunl added a comment. Only make non-capturing lambda host and device by default. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78655/new/ https://reviews.llvm.org/D78655 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D78655: [CUDA][HIP] Let non-caputuring lambda be host device

2020-06-22 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. In D78655#2107190 , @yaxunl wrote: > It seems we can only promote non-capturing lambdas, no matter whether it has > enclosing function or not. I'd be OK with promoting only non-capturing lambdas until we figure out a consistent

[PATCH] D78655: [CUDA][HIP] Let non-caputuring lambda be host device

2020-06-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked an inline comment as done. yaxunl added a comment. In D78655#2107016 , @tra wrote: > In D78655#2105058 , @yaxunl wrote: > > > - lambdas with any lambda-capture (which must therefore have an enclosing

[PATCH] D78655: [CUDA][HIP] Let non-caputuring lambda be host device

2020-06-22 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. In D78655#2105058 , @yaxunl wrote: > - lambdas with any lambda-capture (which must therefore have an enclosing > function) inherit the enclosing function's HDness. Nit: *any* capture does not necessarily imply existence of the

[PATCH] D78655: [CUDA][HIP] Let non-caputuring lambda be host device

2020-06-19 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 2 inline comments as done. yaxunl added a comment. In D78655#2019290 , @rsmith wrote: > There are two behaviors that seem to make sense: > > - Treat lambdas as implicitly HD (like constexpr functions) in all CUDA / HIP > language modes. I

[PATCH] D78655: [CUDA][HIP] Let non-caputuring lambda be host device

2020-06-19 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 272225. yaxunl marked 4 inline comments as done. yaxunl added a comment. improve diagnostic message CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78655/new/ https://reviews.llvm.org/D78655 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D78655: [CUDA][HIP] Let non-caputuring lambda be host device

2020-06-19 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 272171. yaxunl retitled this revision from "[HIP] Add -fhip-lambda-host-device" to "[CUDA][HIP] Let non-caputuring lambda be host device". yaxunl edited the summary of this revision. yaxunl added a comment. Revised by Richard's comments. CHANGES SINCE LAST