[SOLVED] rtcore Link Error after 45 animation frames

my application uses OptiX 6.0.0 CUDA 10.0 Win10PRO 64bit VS2017 (toolset v140 of VS2015) Driver 419.17 GTX 1050 2GB

on using setGeometry(): everything (including animated mesh; geometry rebuild; mark dirty) works fine.

on using setGeometryTriangles(): as long as the geometry is unaffected, the scene renders fine; but when the animation comes to
animation frame 45 (45x times mesh replacement; destroy; mark dirty) this exception occurs:

OptiX Error: Unknown error (Details: Function “_rtContextLaunch2D” caught exception:
Encountered a rtcore error:
m_exports->rtcPipelineCreate( context, pipelineOptions, compileOptions, modules, moduleCount, pipepline )
returned (8): Link error)

In my code I used:
context->setMaxTraceDepth( 25 );
context->setMaxCallableProgramDepth( 25 );

when changing to:
context->setMaxTraceDepth( 40 );
context->setMaxCallableProgramDepth( 40 );
then this message occurs (before the first frame was rendered):

OptiX Error: Unknown error (Details: Function “_rtContextLaunch2D” caught exception:
Encountered a rtcore error:
m_exports->rtcPipelineCreate( context, pipelineOptions, compileOptions, modules, moduleCount, pipepline )
returned (1): Invalid value)

I tried out value 10: then exception on animation frame 46. and link error 8
I tried out value 6: then exception on animation frame 46 and link error 8

Any ideas what the root for this issue could be?
I think its no memory leak, cause all the geometry instances and the geometryTriangles are destroyed with the ->destroy() method and the GPU memory is not completely full.
EDIT: it was a memory leak.

After setting Acceleration Properties Trbvh correctly, still the same exception occurs, but now on animation frame 51.
Also removing the property settings does not help.

UPDATE:
So I tried to use “setGeometry()” instances only (no setGeometryTriangles).

But after many more animation frames (not only 50) and many light moves, unfortunately the same exception now also occured there.
Unknown reason.

I assume your’re still using my OptiX Introduction based path tracer architecture.
That only has an rtTrace depth maximum of two. raygeneration shoots radiance ray, closest hit program shoots shadow ray, that’s it. This requires only setMaxTraceDepth(2);

Then, are you even nesting calls to callable programs? If not setMaxCallableProgramDepth(1);

I think the maximum value in both these trace depth calls is 31 in OptiX 6.0.0.

If it still fails after that stack space reduction, a running reproducer in failing state would be required for analysis. As always, the samller, the better.

thank you for your answer.

yes, I use still the same architecture. same exception at same frame on simple materials also on max trace depth 2 and max callable depth 1.

I also tried to use a simple solid color in the closesthit.cu using RTX mode + GeometryTriangles:
that works for 75 animated frames until the exception occurs.

Then I switched off RTX mode (and so there’s also no usage of GeometryTriangles): Now the animation runs without problems; Also after many animation frames and many manually light moves no exception. The only difference is, that its much slower.

I also did a test replacing the geometry within the optixGeometryTriangles SDK example on each frame. That works fine
Also I setup optixIntro_07 with OptiX 6.0.0 + CUDA 10.0 from your original Introduction Sample again… That also runs without any exception after I inserted the GeometryTriangles replacement handling for a simple sphere.

So there seems to be some deeper issue in my app, which is obivoulsy tolerated by the megakernel strategy, but RTX mode doesn’t accept it. I will try again.

I also got very similar error message:
Unknown error (Details: Function “_rtContextLaunch2D” caught exception: Encountered a rtcore error: m_exports->rtcPipelineCreate( context, pipelineOptions, compileOptions, modules, moduleCount, pipeline ) returned (8): Link error)

The only difference is the returned value, it is 8 instead of 1 here.
The program never launches a kernel because it is a link error in my case.
This error doesn’t occur if I disabled RTX mode.

However the program works various input scenes except one scene. Failed scene includes alpha textures.
My program adds any hit program when an input scene includes alpha textures, so I think that the error suggests OptiX fails to link the any hit program.
On the other hand, however I’ve observed that the program works other scenes including alpha textures.
It fails to link something for a specific scene.

OptiX appears to cause some memory corruption or some inconsistency in some situtation if RTX mode is on.
Or I had a mistake in my program but it happen not to have the error.

Thanks @shocker.0x15 for your message! I tested before with the opaque materials only.
So this time I used the “cutout” material for the sphere (which has an “alpha”-similar handling)

And on frame 248 (248x times replacement + destroy + mark dirty) the exception was thrown:


ReplaceGeometry ‘244’
ReplaceGeometry ‘245’
ReplaceGeometry ‘246’
ReplaceGeometry ‘247’
ReplaceGeometry ‘248’
Unknown error (Details: Function “_rtContextLaunch2D” caught exception: Encountered a rtcore error: m_exports->rtcPipelineCreate( context, pipelineOptions, compileOptions, modules, moduleCount, pipeline ) returned (8): Link error)
ReplaceGeometry ‘249’
Unknown error (Details: Function “_rtContextLaunch2D” caught exception: Assertion failed: “!m_enteredFromAPI : Memory manager already entered from API”, file: , line: 1071)
ReplaceGeometry ‘250’
Unknown error (Details: Function “_rtContextLaunch2D” caught exception: Assertion failed: “!m_enteredFromAPI : Memory manager already entered from API”, file: , line: 1071)

I sent the source code (which can be directly plugged into a sample) for my test by private message to Detlef.

Thanks to Detlefs help I was able to find the reason for the exception:
it was a memory leak.
I did clear the geoInst[ “XXXX_buffer”] variables on replacement, but there was no call to -> destroy() on these buffers. Since they are properly destroyed now; not one time the exception happened again. So using RTX mode works fine now.