work in progress!
@Sergey Sharybin (sergey) could you review the cycles part? I'm not sure how to actually use the Transform in kernel_bake.h (see the TODOs there), but apart from that I think it's correct.
In the Blender side I still need to populate the bake data with the dupli objects and pass the matrix.
I think the matrix I need to pass is one that can be used directly by the kernel_bake.h, and it will be an identity matrix for all but the dupli objects.
For those I probably need the dupli matrix in relation to the object original matrix.