In trying to optimize my program, I have narrowed down my bottlenecks to context recompilations.
In the specific case in question, I call many successive launches, while switching callable programs in between calls.
I seem to recall in some thread and/or the programming guide that the whole point of such callable programs is that their switching does not incur recompilation, so I guess I am using them wrong somewhere.
My flow is as follows:
- Load all programs beforehand using
optixu::Program switchableProg1 = m_Context->createProgramFromPTXFile( sFilePath, sProgName1 ); optixu::Program switchableProg2 = m_Context->createProgramFromPTXFile( sFilePath, sProgName2 ); optixu::Program switchableProg3 = m_Context->createProgramFromPTXFile( sFilePath, sProgName3 );
- Create (only once):
optixu::Variable pCallableProg = m_Context->declareVariable( "MyFunc" )
- And to toggle in between launches (this line is what triggers my recompiles)
pCallableProg->set( switchableProg );
Since I preloaded the progs into the context and am just attaching them to the variable, does anyone have any insights why I am getting these expensive recompiles all the time?