RTresult _rtContextLaunch2D(RTcontext, unsigned int, RTsize, RTsize)" caught exception

OptiX Error: ‘Unknown error (Details: Function “RTresult _rtContextLaunch2D(RTcontext, unsigned int, RTsize, RTsize)” caught exception: Encountered a CUDA error: cudaDriver().CuEventSynchronize( m_event ) returned (718): Invalid program counter, file: , line: 0)’
terminate called after throwing an instance of ‘optix::Exception’
what(): Unknown error (Details: Function “RTresult _rtVariableSet1ui(RTvariable, unsigned int)” caught exception: Assertion failed: “!m_launching”, file: , line: 211)

GTX 2060.
Driver Version:470.
OptiX6.5, CUDA Version:11.4

This error occurs randomly when “setUint” is used in a new frame

void display()
{
static unsigned int accumulationFrame = 0;
if (_renderer.getCamera().is_dirty())
{
_renderer.updateCamera();
accumulationFrame = 0;
}

_renderer.getContext()["frame"]->setUint(accumulationFrame++);
_renderer.getContext()->launch(0, _renderer.getWidth(), _renderer.getHeight());


}

There is not enough information to be able to tell what is going wrong.

There are two things you could try first:

1.) R470 drivers are really old. I would recommend updating to newer driver branches and check if that changes the behavior.

2.) With “CUDA Version 11.4” you mean you’re using CUDA Toolkit 11.4 to compile the input PTX code?
The OptiX SDK 6.5.0 Release Notes say that this SDK version has been built with CUDA 10.1, so that SDK was released well before any CUDA 11.x version was available.
You could try testing if using CUDA Toolkit 10.x versions changes the behavior.

To which streaming multiprocessor target are you compiling your PTX input code?
OptiX 6 versions support Maxwell and newer GPU architectures so targeting SM 5.0 for the PTX code would cover all supported GPU generations. Try SM 5.0 in case you’re using a higher SM target for your Turing board.

If updating drivers doesn’t solve the issue, there is little to be done about that without a complete and minimal reproducer.

Note that OptiX SDK 6.5.0 is a legacy SDKs version and we recommend since years to port older OptiX applications using the legacy API to the newer OptiX 7 resp. now 8 versions. It’s offering a more modern, explicit and always faster API. https://raytracing-docs.nvidia.com/