Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is just-in-time (jit) compilation of a CUDA kernel possible?

Tags:

jit

cuda

Does CUDA support JIT compilation of a CUDA kernel?

I know that OpenCL offers this feature.

I have some variables which are not changed during runtime (i.e. only depend on the input file), therefore I would like to define these values with a macro at kernel compile time (i.e at runtime).

If I define these values manually at compile time my register usage drops from 53 to 46, what greatly improves performance.

like image 752
user1829358 Avatar asked Nov 04 '22 10:11

user1829358


1 Answers

If it is feasible for you to use Python, you can use the excellent pycuda module to compile your kernels at runtime. Combined with a templating engine such as Mako, you will have a very powerful meta-programming environment that will allow you to dynamically tune your kernels for whatever architecture and specific device properties happen to be available to you (obviously some things will be difficult to make fully dynamic and automatic).

You could also consider just maintaining a few distinct versions of your kernel with different parameters, between which your program could choose at runtime based on whatever input you are feeding to it.

like image 199
Brendan Wood Avatar answered Nov 08 '22 16:11

Brendan Wood