Multiple Defined Symbols Issue with MDL in Optix Raytracer

Hello!

I recently encountered an issue with MDL integration in my Optix Raytracer. I am unsure if this issue is expected behavior, but I wanted to report it regardless. Maybe including some information or warning about it in the mdl examples/documentation could be useful.

The issue occurs when creating the pipeline while setting the “opt_level” option to 0 on the mdl backend, causing multiple defined symbols when loading more than one material. I also reproduced this error using the MDL example in the Optix Advanced Samples, just by adding the opt_level to 0.

Here is the Optix Pipeline context log, showing the multiply defined symbols:

Error: Symbol '__nv_asinf' was defined multiple times. First seen in: '__direct_callable__init38_and_3_more_ID39'
Error: Symbol '__nv_atan2f' was defined multiple times. First seen in: '__direct_callable__init38_and_3_more_ID39'
Error: Symbol '__nv_fast_expf' was defined multiple times. First seen in: '__direct_callable__init8_and_4_more_ID9'
Error: Symbol '__nv_fast_logf' was defined multiple times. First seen in: '__direct_callable__init38_and_3_more_ID39'
Error: Symbol '__nv_fast_sincosf' was defined multiple times. First seen in: '__direct_callable__init38_and_3_more_ID39'
Error: Symbol '__nv_fast_tanf' was defined multiple times. First seen in: '__direct_callable__init38_and_3_more_ID39'
Error: Symbol '__nv_min' was defined multiple times. First seen in: '__direct_callable__init38_and_3_more_ID39'
Error: Symbol '__nv_rsqrtf' was defined multiple times. First seen in: '__direct_callable__init38_and_3_more_ID39'
Error: Symbol '__nv_sinhf' was defined multiple times. First seen in: '__direct_callable__init38_and_3_more_ID39'
Error: Symbol '_optix_constant_memory_0x013f9c614d7fe8994035dd1c3fc34764' was defined multiple times. First seen in: '__direct_callable__init38_and_3_more_ID39'
Error: Symbol '_optix_constant_memory_0x06e7eac20c5e48582e2452d605a8c016' was defined multiple times. First seen in: '__direct_callable__init38_and_3_more_ID39'
Error: Symbol '_optix_constant_memory_0xf0cde35cf0f1125d05ca54a2d36a49b9' was defined multiple times. First seen in: '__direct_callable__init38_and_3_more_ID39'

Hi Lorenzo!

Thanks a lot for reporting this problem! We are able to reproduce it and will see what we can do about it.

There is an option to disable linking libdevice to the generated code, but this didn’t work so far, if we do this for all but the first material…

Do you have a special use case for setting the opt level to 0 for the code generated by the MDL SDK?

Best regards
Moritz

Hi Lorenzo,

with “opt_level” 0, some libdevice functions were exported by the generated PTX code.
We fixed that, which also seems to fix the problems with the memory symbols.

The fix will be available in one of the next releases.
Thanks again for reporting this!

Best regards
Moritz