tensorflow / mlir

"Multi-Level Intermediate Representation" Compiler Infrastructure
1.74k stars 260 forks source link

Add getRemappedValue to ConversionPatternRewriter #237

Closed dcaballe closed 5 years ago

dcaballe commented 5 years ago

ConversionPatternRewritter::getRemappedValue returns the remapped value of an original value that has been previously replaced using ConversionPatternRewritter. This mechanism allows the implementation of M->N conversions where we need to retrieve remapped values of M which aren't necessarily present/accessible in the replacement of N.

River707 commented 5 years ago

I would expand the description a bit because it doesn't quite capture the real use case, I believe. It should mention that this is for M->N->1 conversions where you want the remapped values of M which aren't necessarily present/accessible in the replacement of N.

Also, can you add a simple test in the TestDialect if possible?

dcaballe commented 5 years ago

I addressed the feedback and implemented a simple test that exercises getRemappedValue by using an existing instruction in TestDialect and adding a dummy test pass. I also reworded the PR description but I’m not sure I understand the M->M->1 in your comment so I used M->N instead. Please, let me know if something else is needed.