separate compileKernels() function