For #1, this would also require having separate contexts for each IAS to associate with the different launches right?
Not sure why you think that. An OptiX 7 context controls a single GPU. (The first chapter in the Programming Guide explains that.) Means there is no need to have multiple OptiX contexts on one GPU at all.
You only need multiple CUDA and OptiX contexts in an application when targeting multiple GPU devices. OptiX 7 knows nothing about multi-GPU, that is all managed with CUDA host code. My examples show how.
An IAS is just a 64-bit handle and a buffer with the AS data. You can have as many IAS in an OptiX 7 context as fit into your VRAM.
For #2, is there a performance cost associated with essentially padding the SBTs to all have the same size? Basically, for one of the pipelines I have 2 ray types and the other ones have 1 ray type.
I have not benchmarked that specifically. I wouldn’t expect a performance difference due to the number of SBT entries alone. Think of SBTs as jump tables, indexing into them is not expensive.
What makes a difference is the pipeline when adding more shaders.
Please read all posts I linked to. Those explain potential differences and synchronization points which affect performance.
With a pipeline using one and a pipeline using two ray types I see no problem having two different SBTs.
Mind that sbtOffsets are handled with a stride, so having one, two, or three ray types combined in an SBT wouldn’t necessarily mean different sbtOffsets in the instance.
For #3, if I understand the example correctly, this would require updating the SBT before each launch?
No, that would be too costly. I was still thinking about having different SBTs for the two pipelines.
My point was to make the sbtOffsets inside the IAS constant. That was one of the main questions about your SBT layout. If the sbtOffsets are not changing between SBTs, then you can use the same IAS for multiple pipelines and SBTs (or build the SBT to fit.)
But if you need completely different sbtOffsets, like one pipeline has multiple hit records for different materials and the other only one (e.g. ambient occlusion would only need one shader for all) then you would have completely different SBT layouts and sbtOffset.
Still all three solutions would be possible then. There are even more possibilities if the behavior of the ray types could be folded into shaders as special cases. Means there might not be a need for the second pipeline and SBT at all, at the cost of deciding between these cases at runtime depending on some per-ray flag. There is not enough information to say what other options exist in your case.
I think keeping the pipelines and SBTs separate is cleaner since they really share nothing other than the geometry (and some material parameters).
Yes, if the instance sbtOffsets are the same, having different pipelines and SBTs should be the most efficient case. Note that optixLaunch calls are asynchrounous and this would require no synchronization between launches.