I have been trying for some time to transition my code from OptiX 5 to 6, however I seem to be running into an issue with the maximum launch dimension, which appears different between OptiX 5 and 6.
The documentation for the launch functions (rtContextLaunch[*]D) states “For 3D launches, the product of width and depth must be smaller than 4294967296 (2^32).”. I have found this to be true, except for OptiX 6. It appears that for v6+, the product of launch dimensions cannot exceed 1024^3. This seems to be the case for any dimension launch. When the total launch dimension exceeds 1024^3, I receive the error:
OptiX Error: 'Unknown error (Details: Function “RTresult _rtContextLaunch2D(RTcontext, unsigned int, RTsize, RTsize)” caught exception: Encountered a rtcore error: m_api.launch3D( cmdlist, pipeline, launchBufferVA, scratchBufferVA, raygenSbtRecordVA, exceptionSbtRecordVA, firstMissSbtRecordVA, missSbtRecordSize, missSbtRecordCount, firstInstanceSbtRecordVA, instanceSbtRecordSize, instanceSbtRecordCount, firstCallableSbtRecordVA, callableSbtRecordSize, callableSbtRecordCount, toolsOutputVA, toolsOutputSize, scratchBufferSizeInBytes, width, height, depth ) returned (9): Launch failure)
This can be reproduced using one of the SDK examples, in my case I was using “optixSphere”. I made the following changes:
- optixSphere.cpp line 42: change “width” to 2048*1024 and “height” to 1024 (or any width*height>1024^3).
- optixSphere.cpp line ~150: decrease buffer size to avoid potential out of memory error RT_CHECK_ERROR( rtBufferSetSize2D( *output_buffer_obj, 1, 1 ) );
- pinholeCamera.cu line 60: add ‘return;’ to beginning of launch function to isolate issue to launch configuration.
In v6.0+ (tested several), this will produce the error above at launch. In lesser versions, it will run without error. As a side note, my much more complicated production code exhibits the same behavior. This is problematic for me, since I have fairly large launches. I could tile them to 1024^3, but that will result in a lot of launches (sidebar question: what is the potential performance hit for this?). I’d like to upgrade to OptiX 7 one day, but I don’t have the time for it anytime soon.
OS: tried on Debian 9 and Ubuntu 18.04.6
CUDA: tried CUDA 9.0, 9.2, and 11.2
GPU: tried Titan Xp, V100
Thank you.