Attribute 'offset' not found - OptiX 6

I recently tried upgrading OptiX to version 6 (cannot upgrade to 7 yet as it will require a substantial re-write), and I’m getting a new error that I’ve never seen before. Specifically, I tried OptiX 6.0 and 6.5. The following error is thrown when running the launch kernel:

OptiX Error: Unknown error (Details: Function “RTresult _rtContextLaunch3D(RTcontext, unsigned int, RTsize, RTsize, RTsize)” caught exception: Assertion failed: “offset != offsets.end() : Attribute offset not found”, file: , line: 1141)

For OptiX 3, 4, and 5, I don’t get this error and my benchmarks validate with the correct answers. I was thinking perhaps it might have to do with setting the primitive offset for a geometric object. I had not been explicitly setting that before, but I tried making sure to explicitly set the primitive object to 0 for each geometry type, but that made no difference. Also, this tends to happen when the number of primitives/rays is ‘sufficiently’ large, as my very simple benchmark tests with only a few primitives passes without error.

I’m wondering if you have any suggestions for how to start debugging this? Running with cuda-gdb does not provide any additional information.

Please always provide the following system configuration information when asking about OptiX issues:
OS version, installed GPU(s), VRAM amount, display driver version, OptiX (major.minor.micro) version, CUDA toolkit version (major.minor) used to generate the input PTX, host compiler version.

Using cuda-gdb implies a Linux OS.

Also, this tends to happen when the number of primitives/rays is ‘sufficiently’ large, as my very simple benchmark tests with only a few primitives passes without error.

If you are saying that the failure depends on the width, height, depth argument values of your 3D launch, then an important information in your question would have been the values where it still worked and the values where it started to fail.
With the given information so far, it would be possible that you exceeded the maximum launch size limit in the newer versions.
In that case please read this post:

If you say that is related to the scene size in number of primitives, the same information about those sizes would be interesting.

Some general information about what the application does to understand the dependency between number of primitves and number of rays you mentioned would also be helpful.

An assertion inside OptiX normally indicates an issue inside OptiX itself. There might be seldom cases where this is an application error and OptiX isn’t reporting it correctly.
In that case the first thing to try is upgrading the display drivers to a newer version if available because the OptiX core implementation lives inside the driver since OptiX 6.
If that is not helping, we’d need a minimal, complete reproducer project in failing state.

Normally correct OptiX host and device code from older versions should work, except when using Selector nodes which have been removed, and there are some cases where OptiX 6.5 got pickier about some device code constructs (e.g. pairing of rtPotentialIntersection and rtReportIntersection calls) but those get the correct error messages.

Other than that, if you’re running the same old code from OptiX 3/4/5 with OptiX 6.5 (please do not use OptiX 6.0 anymore), that would mean not using the built-in triangle primitives, which will not use the hardware ray-triangle intersection on RTX boards, which is the crucial part for better performance.

I don’t think this “Attribute” error has something to do with intersection attributes. Also because your application is running in some cases, there is most likely not a systematic error with those, but note that OptiX 6 changed the intersection attribute handling due to the added built-in triangle primitives by adding attribute programs:

(In OptiX 7, intersection attributes are a set of at most 8 registers and surface attribute calculation needs to happen explicitly inside the hit programs.)