This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Only allow __global__ on free functions and static member functions.
ClosedPublic

Authored by jlebar on Jan 16 2016, 12:17 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

jlebar updated this revision to Diff 45080.Jan 16 2016, 12:17 PM
jlebar retitled this revision from to [CUDA] Only allow __global__ on free functions and static member functions..
jlebar updated this object.
jlebar added a reviewer: tra.
jlebar added subscribers: cfe-commits, echristo, jhen.
tra added inline comments.Jan 19 2016, 10:35 AM
include/clang/Basic/DiagnosticSemaKinds.td
6418 ↗(On Diff #45080)

There's an Extension<> tablegen class used to report various C and C++ extensions.
This looks like a good use case for it.

6421 ↗(On Diff #45080)

Perhaps we should use the same message as nvcc here:
'inline qualifier ignored for "global" function'

jlebar updated this revision to Diff 45297.Jan 19 2016, 1:12 PM
jlebar marked an inline comment as done.

Address tra's review.

Thank you for the review.

include/clang/Basic/DiagnosticSemaKinds.td
6418 ↗(On Diff #45080)

I'll also check that the rest of the CudaCompat warnings here shouldn't be Extension<>s.

6421 ↗(On Diff #45080)

Ah, yes, given that it's not an nvcc error, we should just warn. (Or even not say anything at all; it seems like a silly warning.)

Checked Thrust as we discussed. It doesn't seem to be getting hung up here.

tra accepted this revision.Jan 19 2016, 3:36 PM
tra edited edge metadata.

Small diags not. LGTM otherwise.

lib/Sema/SemaDeclAttr.cpp
3620–3629 ↗(On Diff #45297)

Perhaps we should emit diagnostics on device side only.

This revision is now accepted and ready to land.Jan 19 2016, 3:36 PM
jlebar added inline comments.Jan 19 2016, 3:44 PM
lib/Sema/SemaDeclAttr.cpp
3620–3629 ↗(On Diff #45297)

Hm. I don't feel strongly, but since we're talking about global functions, this seems sort of relevant for both host and device compilation?

tra added inline comments.Jan 19 2016, 3:59 PM
lib/Sema/SemaDeclAttr.cpp
3620–3629 ↗(On Diff #45297)

Host-only works, too. Printing this on both host and device is a bit too much.

This revision was automatically updated to reflect the committed changes.
jlebar marked 3 inline comments as done.