This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] renamed cuda_runtime.h wrapper to __clang_cuda_runtime_wrapper.h
ClosedPublic

Authored by tra on Dec 15 2015, 10:30 AM.

Details

Summary

Currently it's easy to break CUDA compilation by passing
"-isystem /path/to/cuda/include" to compiler which leads to
compiler including real cuda_runtime.h from there instead
of the wrapper we need.

Renaming the wrapper ensures that we can include the wrapper
regardless of user-specified include paths and files.

The file is only intended to be -include'd by clang and should never be included by users, hence '__'.

Diff Detail

Repository
rL LLVM

Event Timeline

tra updated this revision to Diff 42875.Dec 15 2015, 10:30 AM
tra retitled this revision from to [CUDA] renamed cuda_runtime.h wrapper to __cuda_runtime.h.
tra updated this object.
tra added a reviewer: echristo.
tra added a subscriber: cfe-commits.
tra updated this revision to Diff 42882.Dec 15 2015, 11:26 AM
tra retitled this revision from [CUDA] renamed cuda_runtime.h wrapper to __cuda_runtime.h to [CUDA] renamed cuda_runtime.h wrapper to __clang_cuda_runtime_wrapper.h.
tra updated this object.
tra added a reviewer: chandlerc.

Changed name to __clang_cuda_runtime_wrapper.h
Added comments in the header explaining intended use.

chandlerc accepted this revision.Dec 15 2015, 4:55 PM
chandlerc edited edge metadata.

The substance of the patch LGTM. My nit picking is just on the wording of the comment. =] Submit whenever.

lib/Headers/__clang_cuda_runtime_wrapper.h
25–26 ↗(On Diff #42882)

"by compiler" -> "by the compiler"

28–29 ↗(On Diff #42882)

You say above that they'll be included by clang directly?

I think instead of "impossible to use them by clang directly" you want to say something more along the lines of "impossible for user code to #include directly when compiling with clang".

30–34 ↗(On Diff #42882)

I would consistently capitalize "CUDA" when not talking about a particular header like cuda_runtime.h, and "Clang" and "NVCC" unless talking about running a command.

Some other nits:

"included from" -> "included"

"so we have to abuse preprocessor in order to" -> "so we use the preprocessor to"

"shape CUDA headers into something" -> "force the headers into a form that"

This revision is now accepted and ready to land.Dec 15 2015, 4:55 PM
jhen added a subscriber: jhen.Dec 15 2015, 5:13 PM
jhen added inline comments.
lib/Headers/__clang_cuda_runtime_wrapper.h
95 ↗(On Diff #42882)

Now that the name of this header has been changed, would it be appropriate to change this #include_next to a simple #include?

tra updated this revision to Diff 43025.Dec 16 2015, 10:21 AM
tra edited edge metadata.
tra marked 3 inline comments as done.

Incorporated Chandler's suggestions.
Fixed #include_next -> #include.

lib/Headers/__clang_cuda_runtime_wrapper.h
95 ↗(On Diff #42882)

Fixed.

This revision was automatically updated to reflect the committed changes.
cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h