Very slow nvcc compilation Because of large kernel


I am making a raytracer. The problem is that the compilation times are getting really bad now - about 15 mins and it’s completely killing my PC at the same time. I think it’s because of my massive kernel and the fact that lots of code is getting inlined. Has anyone got any ideas how I can speed this up? I’ve considered separating into different kernels, one for ray generation, another for shading, but with secondary rays getting spawned it might be a lot of hassle and I don’t know whether it will work either.

If anyone has done this or has any ideas let me know. Register usage is also very high at 117 registers. :(