Is it possible to use Linalg::GenericOp (Linalg::IndexedGenericOp) to express a computation having multiple shape-inconsistent outputs?

Thanks for all your answers.

Yes. This idea is originated from the work supporting kLoop fusion template of XLA in the tensor world. Buffer-based fusion can be more powerful while is also more verbose especially for the simple kLoop fusion case (e.g. we need explicit shape inference and buffer allocation before we reach the buffer world). Thus we may prefer tensor-based fusion in the simple case.

Extension like above indeed introduces some complexity for transformations. After reading the answer about “what and how” here, I think loop.parallel maybe more suitable for this case.

Btw, linalg dialect now supports both tensor-based fusion and buffer-based fusion. Is there any suggestion about how to combine tensor-world and buffer-world smoothly?

According to my understanding, what tensor-based fusion does is just to combine multiple generic ops into one. Due to the expressiveness of linalg.generic, it seems that in most cases we could not get the whole fusion pattern in the tensor world, and end up with doing partial fusion in tensor world and then lowering to buffer world to the other part of fusion?