These functions are inlined by OptiX anyway. Putting the implementation inside headers is fine.
For these functions I’m always using forceinlinedevice to be sure that the CUDA compiler actually inlines them. I use a #define RT_FUNCTION forceinlinedevice
for these to match the look to OptiX RT_PROGRAM and RT_CALLABLE_PROGRAM notions.
When using just inline that’s only a hint and depending on the code size or number of function arguments the compiler sometimes generates a call which wasn’t handled by OptiX in the past. In the meantime it’s able to inline PTX call instructions. Won’t harm to help the compiler with the decision.
Real function calls in OptiX are done via its callable programs mechanism.
If you need to implement something like a virtual function table, that isn’t going to work with standard C++ mechanisms in OptiX, but you can build a buffer of bindless callable program IDs which is effectively your function table and you can pick any of the functions simply by indexing into that buffer.