This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Allow external variables in separate compilation
ClosedPublic

Authored by Hahnfeld on Feb 5 2018, 11:23 AM.

Details

Summary

According to the CUDA Programming Guide this is prohibited in
whole program compilation mode. This makes sense because external
references cannot be satisfied in that mode anyway. However,
such variables are allowed in separate compilation mode which
is a valid use case.

Diff Detail

Repository
rC Clang

Event Timeline

Hahnfeld created this revision.Feb 5 2018, 11:23 AM
tra accepted this revision.Feb 12 2018, 11:51 AM

LGTM.

test/SemaCUDA/extern-shared.cu
4

Nit. -verify=rdc is somewhat confusing as there's no rdc prefixes in the checks below. Perhaps something along the lines of -verify=there-should-be-no-errors would be more descriptive.

This revision is now accepted and ready to land.Feb 12 2018, 11:51 AM
Hahnfeld added inline comments.Feb 12 2018, 11:58 AM
test/SemaCUDA/extern-shared.cu
4

There is: rdc-no-diagnostics.

But given that you missed it, maybe I should move the comment declarations are fine between RUN lines and no-diagnostics? Don't know if that helps much though...

tra added inline comments.Feb 12 2018, 12:50 PM
test/SemaCUDA/extern-shared.cu
4

Oh! I did miss it. Never mind then.

This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.