1

How do I obtain an LLVM-IR file(.ll) from OpenCL Kernel file with clang?

The solution in this link seems working with some files, but for the codes which contains OpenCL vector types such as uchar4, seems not working (emitting type errors).

Is there an easy way to do this or is it not possible to gain LLVM-IR form with clang?

Community
  • 1
  • 1
izazu
  • 87
  • 9

1 Answers1

1

At least on OS X, there's an LLVM-based offline compiler for OpenCL kernels, you can find it in the following location:

/System/Library/Frameworks/OpenCL.framework/Libraries/openclc

(It supports the --help command line argument showing you the possible options.)

I'm not aware of any published source code for openclc so I guess that means you can't use it on other platforms, but as far as I'm aware, there's no standardised binary format for OpenCL kernels anyway, so you couldn't achieve platform independence with it.

pmdj
  • 22,018
  • 3
  • 52
  • 103