Repository navigation
Refactor and normalization of mhlo convolutions - #4113
Conversation
ScottTodd
left a comment
There was a problem hiding this comment.
Code seems ok, I'm wondering if this is the right place for it and why it needs to exist though.
Can you elaborate on how this simplifies IREE's compiler passes? How does this affect other projects? Would they be indifferent, or would they similarly benefit from this normalization/canonicalization?
| // Guarantee that the input dimensions are ordered batch, spatial_dims, feature | ||
| // dim. | ||
| class ReorderConvOpInputDimensions : public OpRewritePattern<mhlo::ConvOp> { |
There was a problem hiding this comment.
Would this make more sense as a canonicalization on mhlo::ConvOp upstream? Or a structural change to mhlo to just order them consistently wherever they are created?
There was a problem hiding this comment.
Would this make more sense as a canonicalization on mhlo::ConvOp upstream?
Personally I would think it does however technically that goes against how the main
XLA backend works. Because they generate using the convolution attributes these kind of
decompositions are usually discouraged.
Or a structural change to mhlo to just order them consistently wherever they are created?
If this were only a matter of a couple locations, this would be fine, however we can get
XLA from a couple different sources (mlir xla-builder, xla proto, TF legalization) and
guaranteeing only a single form would be difficult to guarantee.
If the XLA legalization path agrees on a similar canonical representation I would be
inclined to upstream, however thats extremely unlikely.
* 1b71cac Adding hal.interface.workgroup.* ops. (#4149) * 04b7c37 Add ctests for the tensorflow/e2e directory. * c3fc9a1 Remove all !r from python f-strings (#4157) * fdb88b9 improve tracy docs (#4117) * 204f652 Write the doc page on profiling cpu events (#4126) * 613efa8 Add build instructions to python getting started (#4153) * d889ac1 Revert "Fix missing f-string (#4150)" * aaa08b1 Enable dylib-llvm-aot tests and switch from testing JIT to AOT. (#3928) * cb1e46e Refactor and normalization of mhlo convolutions (#4113) * 0590b3c Fix missing f-string (#4150) * 2f7cab5 Check in BuildKite pipeline for android tests (#4137) * c195ae9 Fix types for std::min on MSVC. (#4148) * 5fefe30 Integrate MLIR-EmitC at iml130/mlir-emitc@a438d3b (#4145) * f03307d Fix ImGui function in iree-run-module-vulkan-gui-main. (#4147) COPYBARA_INTEGRATE_REVIEW=#4168 from hanhanW:main-to-google 7c443d3 PiperOrigin-RevId: 346812805
* 1b71cac Adding hal.interface.workgroup.* ops. (#4149) * 04b7c37 Add ctests for the tensorflow/e2e directory. * c3fc9a1 Remove all !r from python f-strings (#4157) * fdb88b9 improve tracy docs (#4117) * 204f652 Write the doc page on profiling cpu events (#4126) * 613efa8 Add build instructions to python getting started (#4153) * d889ac1 Revert "Fix missing f-string (#4150)" * aaa08b1 Enable dylib-llvm-aot tests and switch from testing JIT to AOT. (#3928) * cb1e46e Refactor and normalization of mhlo convolutions (#4113) * 0590b3c Fix missing f-string (#4150) * 2f7cab5 Check in BuildKite pipeline for android tests (#4137) * c195ae9 Fix types for std::min on MSVC. (#4148) * 5fefe30 Integrate MLIR-EmitC at iml130/mlir-emitc@a438d3b (#4145) * f03307d Fix ImGui function in iree-run-module-vulkan-gui-main. (#4147) COPYBARA_INTEGRATE_REVIEW=#4168 from hanhanW:main-to-google 7c443d3 PiperOrigin-RevId: 346812805
Added a refactor to normalize convolution values. This is designed to decompose and simplify
convolutions for use with IREE's compiler passes. The different dimension orders are not
usually constructed via the TF compilation pass but are technically legal.