Test showcasing how to extract a series of OPs into a new module?

I would like to extract a series of operations into a new module. Is there any test in mlir that showcases this, so I can follow the passes/logic implemented.

I am looking at the GPU dialect tests and I see that it encapsulate part of what I expect as an end result. But the tests that I have found do not showcase the example:

mySplittingPass(single_host_module)
   returns host_module, kernel_module

Is there any such pass/test example?

Thank you in advance!

I believe here is a test: https://github.com/llvm/llvm-project/blob/master/mlir/test/Dialect/GPU/outlining.mlir

And the code for the pass: https://github.com/llvm/llvm-project/blob/master/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp#L225-L234

1 Like

Thank you, this exactly what I was looking for. Really appreciate it.