Discovered this bug while working on ActiveShade PR. To reproduce do the following:
- Create an object
- Apply appleseed modifier and check "Optimize for Instancing"
- Make one or more instances of the object
- Assign different materials to the instances
- Render. Objects are rendered with one material due to
assembly_map cache. First object assembly contains object and it's material and subsequent instances use the same assembly.