Repository navigation
feat(rtx): support OptiX 9.1, sharing identical MDL modules - #381
Conversation
Offer 9.1 in the OPTIX_FETCH_VERSION cache STRINGS too, so cmake-gui and ccache-style pickers list it rather than only accepting it when typed. Make the Neural Graphics Primitives gate version-ordered. It compared STREQUAL "9.0", so VISRTX_ENABLE_NEURAL hard-failed configure on 9.1 despite its own message saying "OptiX 9.0+"; VERSION_LESS keeps 7.7/8.0/8.1 rejected while accepting 9.0 and every later release.
jeffamstutz
left a comment
There was a problem hiding this comment.
If there was an accidental inclusion of OptiX headers that caused us to have to validate them, I'd rather make it so that's not possible instead of making that a supported path.
| # Read it from the headers actually being compiled against rather than from | ||
| # OPTIX_FETCH_VERSION, which says nothing about an out-of-tree OptiX supplied | ||
| # via CMAKE_PREFIX_PATH. | ||
| if (OptiX_ROOT_DIR AND NOT DEFINED OptiX_VERSION_NUMERIC) |
There was a problem hiding this comment.
Is there a case where out-of-tree OptiX was actually needed? The right fix is to add OptiX 9.1 to the options. I'd rather not add this complexity (and also have to make sure it works) unless we have a concrete user.
To be clear, I think we should avoid external OptiX headers being injected and always assume using the ones supplied through optix-dev.
There was a problem hiding this comment.
That's actually a workflow I use locally and that's how I came to encounter this OptiX 9.1 issue.
But this specific change is actually not used by this branch anymore, so I'll drop it.
Avoid duplicate-symbol pipeline link failures with OptiX 9.1 while preserving material metadata and callable offsets. Gate the sharing on OPTIX_VERSION >= 90100. OptiX 9.0 links byte-identical PTX from separate modules without complaint -- verified by running the new test against both 9.0 and 9.1 headers with the sharing pass disabled: only 9.1 reports "Symbol 'mdl..._0x<uuid>' was defined multiple times". Below 9.1 each material keeps its own module, so per-material compile isolation is unchanged where the linker does not require sharing. The representatives table is built inside the if constexpr and left empty otherwise, so the disabled path allocates nothing. Have FindOptiX parse OPTIX_VERSION from optix.h, exposing OptiX_VERSION (now reported by find_package) and OptiX_VERSION_NUMERIC, so the test asserts sharing only on the versions where the device performs it. Read from the headers rather than OPTIX_FETCH_VERSION, which says nothing about an out-of-tree OptiX supplied via CMAKE_PREFIX_PATH. Cover byte-identical PTX from distinct UUIDs, independent tints, both release orders, slot reuse, pipeline rebuilds, and shared-module teardown.
Two materials that VisRTX registers under distinct UUIDs can compile to byte-identical PTX whose callable symbols embed the MDL-side compiled-material hash rather than our UUID (e.g.
mdlBsdf_sample_0x99986513d54491bd). From there, building them into separate OptiX modules puts the same symbol in the pipeline twice. This is tolerated by OptiX ≤ 9.0, rejected by 9.1 as defined multiple times.
Always deduplicate.