Emit LLVMIR for a CUDA kernel

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Emit LLVMIR for a CUDA kernel

shirley breuer via cfe-dev
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` somehow only emits code for the host side code.

Thanks,
Navdeep

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Emit LLVMIR for a CUDA kernel

shirley breuer via cfe-dev

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` somehow only emits code for the host side code.

Thanks,
Navdeep

_______________________________________________
cfe-dev mailing list
[hidden email]
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

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

smime.p7s (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Emit LLVMIR for a CUDA kernel

shirley breuer via cfe-dev
Hi Simeon,

Thanks! that worked.

Cheers,
Navdeep

On Thu, 18 Feb 2021 at 18:43, Simeon Ehrig <[hidden email]> wrote:

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` somehow only emits code for the host side code.

Thanks,
Navdeep

_______________________________________________
cfe-dev mailing list
[hidden email]
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

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev