Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CUDA mixed host/device source files #15

Open
jeroenk opened this issue Dec 17, 2017 · 1 comment
Open

Support CUDA mixed host/device source files #15

jeroenk opened this issue Dec 17, 2017 · 1 comment

Comments

@jeroenk
Copy link
Collaborator

jeroenk commented Dec 17, 2017

CUDA mixed host/device source files are much better supported in Clang nowadays, it might be worth revisiting whether this can be supported.

@jeroenk
Copy link
Collaborator Author

jeroenk commented Jan 5, 2018

A possible approach is to pull in the libcxx C++ library and the musl C library. Then, pass -nostdinc to clang and also pass the locations of the libcxx and musl include files:

  • For libcxx this means the include directory that occurs in the root of the repository.
  • For musl this also means the include directory that occurs in the root of the repository. In addition, for 32-bit, and 64-bit pointers, pointers also arch/i386, and arch/x86_64, should be passed, respectively.

For the libraries to work correctly, a variation on the following will be required.

  • libcxx: define __ELF__ and _GNU_SOURCE. Add definitions of _LIBCPP_HAS_THREAD_API_PTHREAD and _LIBCPP_HAS_MUSL_LIBC to the start of __config.
  • musl: generate a bits/alltypes.h based on arch/.../bits/alltypes.h.in. This depends on the pointer width.

Besides the above, we will also need prototypes for CUDA runtime API functions (see runtime_patch.txt for a very minimal version).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant