[cfe-dev] Emit LLVMIR for a CUDA kernel

Simeon Ehrig via cfe-dev cfe-dev at lists.llvm.org
Thu Feb 18 05:13:45 PST 2021


Hi Navdeep,

you can emit the llvm IR code of the device side with `clang -S 
-emit-llvm --cuda-gpu-arch=sm_75 --cuda-device-only code.cu -o code.ll`

and with `clang -S --cuda-gpu-arch=sm_75 --cuda-device-only code.cu -o 
code.ptx` you can emit the ptx code.

Cheers,
Simeon

On 2/18/21 11:35 AM, Navdeep Kumar via cfe-dev wrote:
> Hi all,
>
> Does anyone know how to emit LLVM IR for the kernel of a CUDA C++ 
> code? `clang++ -emit-llvm --cuda-gpu-arch=sm_75 x.cu <http://x.cu/>` 
> somehow only emits code for the host side code.
>
> Thanks,
> Navdeep
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

-- 
Simeon Ehrig
Institut für Strahlenphysik
Helmholtz-Zentrum Dresden - Rossendorf e.V. (HZDR)
Bautzner Landstr. 400 | 01328 Dresden | Deutschland
Tel: +49 (0) 351 260 2974
http://www.hzdr.de
Vorstand: Prof. Dr. Sebastian M. Schmidt, Dr. Diana Stiller
Vereinsregister: VR 1693 beim Amtsgericht Dresden

Simeon Ehrig
Institute of Radiation Physics
Helmholtz-Zentrum Dresden - Rossendorf (HZDR)
Bautzner Landstr. 400 | 01328 Dresden | Germany
Phone: +49 351 260 2974
http://www.hzdr.de
Board of Directors: Prof. Dr. Sebastian M. Schmidt, Dr. Diana Stiller
Company Registration Number VR 1693, Amtsgericht Dresden

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210218/20b01f30/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5366 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210218/20b01f30/attachment.bin>


More information about the cfe-dev mailing list