llvm-mingw icon indicating copy to clipboard operation
llvm-mingw copied to clipboard

CUDA cross-compilation? Possible?

Open cesss opened this issue 5 years ago • 2 comments

Hi!!

Given that nvcc requires Microsoft compilers for compiling for Windows, the currently accepted answer is that it's not possible to cross-compile CUDA from Linux to Windows because NVIDIA doesn't support the gcc toolchain for Windows targets.

However... recent LLVM releases do support CUDA compilation, so... just wondering... could you compile CUDA without nvcc, using LLVM instead? If that's possible, then this opens a shockingly exciting window of opportunity for cross-compiling CUDA using llvm-mingw!!!

Do you think this would be possible?

cesss avatar Jan 27 '20 08:01 cesss

I'm not familiar with the CUDA bits of LLVM at all, unfortunately.

If I've understood correctly, even if you build CUDA code with LLVM, you still need to compile the output from LLVM using nvcc.

mstorsjo avatar Jan 27 '20 08:01 mstorsjo

I'm not familiar either. Searching a bit more, this ffmpeg patch claims to be able to build CUDA even without installing the CUDA SDK at all (if I'm reading it correctly).

That's a bit extreme (they are reimplementing a minimalistic version of the headers), but the interesting bit is that they seem to be doing it without nvcc (again, if I'm reading it correctly, because not using the CUDA SDK means not using nvcc, at least that's what I understand).

cesss avatar Jan 27 '20 08:01 cesss