This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Add hack so code which includes "curand.h" doesn't break.
ClosedPublic

Authored by jlebar on Feb 23 2016, 10:52 PM.

Details

Summary

curand.h includes curand_mtgp32_kernel.h. In host mode, this header
redefines threadIdx and blockDim, giving them their "proper" types of
uint3 and dim3, respectively.

clang has its own plan for these variables -- their types are magic
builtin classes. So these redefinitions are incompatible.

As a hack, we force-include the offending CUDA header and use #defines
to get the right types for threadIdx and blockDim.

Diff Detail

Repository
rL LLVM

Event Timeline

jlebar updated this revision to Diff 48885.Feb 23 2016, 10:52 PM
jlebar retitled this revision from to [CUDA] Add hack so code which includes "curand.h" doesn't break..
jlebar updated this object.
jlebar added a reviewer: tra.
jlebar added subscribers: cfe-commits, echristo.
tra accepted this revision.Feb 24 2016, 11:38 AM
tra edited edge metadata.

OK.

This revision is now accepted and ready to land.Feb 24 2016, 11:38 AM
This revision was automatically updated to reflect the committed changes.