tenstorrent / tt-mlir

Tenstorrent MLIR compiler
https://tenstorrent.github.io/tt-mlir/
Apache License 2.0
72 stars 9 forks source link

Implement conversion of stablehlo.reduce OP to TTIR dialect #585

Closed mrakitaTT closed 2 months ago

mrakitaTT commented 2 months ago

Added MaxOp to TTIR and TTNN dialects and implemented conversion from stablehlo.reduce OP to ttir.sum and ttir.max OPs.

Added necessary tests.

Fixes #510 Fixes #580

mrakitaTT commented 2 months ago

Do we have an issue for the runtime changes? It's probably pretty straightforward to add it as part of this change.

@nsmithtt Couldn't reply to signoff comment directly. Good catch, I forgot to add changes in runtime/lib/ttnn/program.cpp, will do it now, thanks!

mrakitaTT commented 2 months ago

I've added TTIR pipelines similar like we have TTNN pipelines, in order to be able to test combination of passes for conversion of input dialects to TTIR. Let me know if someone sees any issues with that.

Concretely right now I had to test combination of convert-stablehlo-to-ttir + remove-dead-values passes.

mrakitaTT commented 2 months ago

FYI @jnie-TT I've made similar changes in runtime/lib/ttnn/program.cpp for the Reduction OPs like I did in GH-527 for Eltwise OPs.

nobradovictt commented 2 months ago

I've added TTIR pipelines similar like we have TTNN pipelines, in order to be able to test combination of passes for conversion of input dialects to TTIR. Let me know if someone sees any issues with that.

Concretely right now I had to test combination of convert-stablehlo-to-ttir + remove-dead-values passes.

There is no single test using it? It would be good to have a test targeting it + version with non default version of optional parameter.

mrakitaTT commented 2 months ago

I've added TTIR pipelines similar like we have TTNN pipelines, in order to be able to test combination of passes for conversion of input dialects to TTIR. Let me know if someone sees any issues with that. Concretely right now I had to test combination of convert-stablehlo-to-ttir + remove-dead-values passes.

There is no single test using it? It would be good to have a test targeting it + version with non default version of optional parameter.

@nobradovictt Changed all stablehlo tests to use pipeline and added a test for non default version of optional parameter. We don't yet have a concrete case for this optimization until we add support for stablehlo.constant OP (check the first comment on this page for more details), so I've added an artificial test for now.