diff options
| author | Nicolas Vasilache <ntv@google.com> | 2019-09-27 09:55:38 -0700 |
|---|---|---|
| committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-09-27 09:57:36 -0700 |
| commit | ddf737c5da728f25c5e0413bc737d04b2d92df96 (patch) | |
| tree | 07af0e3ba0f3755d11d329ccde15e8479ca04cd7 /mlir/lib/Transforms | |
| parent | 6543e99fe51b9077d8185ba9741770adc5f7cde5 (diff) | |
| download | bcm5719-llvm-ddf737c5da728f25c5e0413bc737d04b2d92df96.tar.gz bcm5719-llvm-ddf737c5da728f25c5e0413bc737d04b2d92df96.zip | |
Promote MemRefDescriptor to a pointer to struct when passing function boundaries in LLVMLowering.
The strided MemRef RFC discusses a normalized descriptor and interaction with library calls (https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/MaL8m2nXuio).
Lowering of nested LLVM structs as value types does not play nicely with externally compiled C/C++ functions due to ABI issues.
Solving the ABI problem generally is a very complex problem and most likely involves taking
a dependence on clang that we do not want atm.
A simple workaround is to pass pointers to memref descriptors at function boundaries, which this CL implement.
PiperOrigin-RevId: 271591708
Diffstat (limited to 'mlir/lib/Transforms')
| -rw-r--r-- | mlir/lib/Transforms/DialectConversion.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mlir/lib/Transforms/DialectConversion.cpp b/mlir/lib/Transforms/DialectConversion.cpp index 3fababb3d34..cdd5be84568 100644 --- a/mlir/lib/Transforms/DialectConversion.cpp +++ b/mlir/lib/Transforms/DialectConversion.cpp @@ -618,6 +618,16 @@ void ConversionPatternRewriter::applySignatureConversion( impl->applySignatureConversion(region, conversion); } +void ConversionPatternRewriter::replaceUsesOfBlockArgument(BlockArgument *from, + Value *to) { + for (auto &u : from->getUses()) { + if (u.getOwner() == to->getDefiningOp()) + continue; + u.getOwner()->replaceUsesOfWith(from, to); + } + impl->mapping.map(impl->mapping.lookupOrDefault(from), to); +} + /// Clone the given operation without cloning its regions. Operation *ConversionPatternRewriter::cloneWithoutRegions(Operation *op) { Operation *newOp = OpBuilder::cloneWithoutRegions(*op); |

