[cfe-dev] Emit LLVMIR for a CUDA kernel

Navdeep Kumar via cfe-dev cfe-dev at lists.llvm.org
Thu Feb 18 07:16:11 PST 2021


Hi Simeon,

Thanks! that worked.

Cheers,
Navdeep

On Thu, 18 Feb 2021 at 18:43, Simeon Ehrig <s.ehrig at hzdr.de> 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 listcfe-dev at lists.llvm.orghttps://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 2974http://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 2974http://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/787741a5/attachment.html>


More information about the cfe-dev mailing list