MDL class compilation error

Hi, when testing interoperability with MDL in OptiX 6.0, I tried to change compilation flag:

MIHandle<ICompiled_material> compiled_material(
            material_instance->create_compiled_material(
                IMaterial_instance::DEFAULT_OPTIONS,
                m_execution_context.get()));

to

MIHandle<ICompiled_material> compiled_material(
            material_instance->create_compiled_material(
                IMaterial_instance::CLASS_COMPILATION,
                m_execution_context.get()));

With all other *.cpp and *.cu files unchanged. Then I ran example OptiXMDLSphere. Programs were created, context validation went smoothly and in the first frame I had an error:

OptiX Error: 'Unknown error (Details: Function "RTresult _rtContextLaunch2D(RTcontext, unsigned int, RTsize, RTsize)" caught exception: Encountered a CUDA error: cudaDriver().CuEventSynchronize( m_event ) returned (700): Illegal address)'
terminate called after throwing an instance of 'optix::Exception'
  what():  Unknown error

Everything works fine, when I compile program with instance compiler. Could you give me some advice what should I change in order to get class compilation working?

Current setup information:

Ubuntu 18.04.2 LTS
Driver Version: 430.26
CUDA Version: 10.2
GeForce RTX 2080
Optix 6.0.0
mdl-sdk-317500.2554 (prebuild)
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0

I posted the same question in OptiX forum. I hope we can figure out what is going on.

Hi,

enabling class-compilation for a material means, that you want to be able to change the material arguments dynamically at runtime without recompiling.
The generated functions (in your case “mdl_bsdf_init”, “mdl_bsdf_evaluate”, “mdl_bsdf_sample” and “mdl_bsdf_pdf”) then expect the last parameter to point to the argument block containing the data of those arguments.
The OptiXMDLSphere example only provides a NULL-pointer for it, thus the generated code crashes with “Illegal address” when trying to access the arguments.

Please refer to https://raytracing-docs.nvidia.com/mdl/api/html/mi_neuray_example_execution_ptx.html and https://raytracing-docs.nvidia.com/mdl/api/html/mi_neuray_compiler.html#mi_neuray_compilation_modes for an explanation of the class-compilation mode and some details on how to use it.

For OptiX, you will have to fill a buffer with the argument block and provide a pointer to the data to the generated functions.

Best regards
Moritz