Lines Matching refs:bufferization
14 MLIR has an older bufferization infrastructure built around
16 bufferization patterns have been migrated to One-Shot Bufferize, but some
17 functionality such as function boundary bufferization still depends on dialect
19 as the dialect conversion-based bufferization will eventually be deprecated.
20 Moreover, One-Shot Bufferize results in better bufferization with fewer memory
23 conversion-based bufferization to One-Shot Bufferize.
27 One-Shot Bufferize is a new tensor bufferization pass designed for IR in
29 and with aggressive in-place bufferization.
34 previous bufferization in MLIR was split across multiple passes residing in
38 * A **whole-function at a time analysis**. In-place bufferization decisions
42 information about an op's bufferization/memory semantics.
48 analyze the entire IR and make bufferization decisions. Then, bufferize
58 analysis. The result of the analysis are queried by the bufferization via
64 bufferization (i.e., copy every buffer before writing to it).
67 …ps://llvm.discourse.group/t/rfc-linalg-on-tensors-update-and-comprehensive-bufferization-rfc/3373),
82 The high-level goal of every bufferization technique is to: 1. Use as little
86 bufferization into an algorithmically complex problem with similarities to
89 Depending on the concrete use case, there may be additional bufferization
98 result, bufferization has to choose a memref buffer in which the result can be
100 bufferization strategy would be unacceptable for high-performance codegen. When
120 bufferization simple. One-Shot Bufferize could be extended to consider such
121 buffers in the future to achieve a better quality of bufferization.
134 The result of `tensor.generate` does not have a "destination", so bufferization
206 `to_memref`/`to_tensor` ops around the bufferization boundary. These ops are
209 bufferization. Therefore, running One-Shot Bufferize multiple times in a
214 dialect conversion-based bufferization to One-Shot Bufferize. One-Shot Bufferize
215 must run first in such a case, because dialect conversion-based bufferization
219 [`bufferization::runOneShotBufferize`](https://github.com/llvm/llvm-project/blob/ae2764e835a26bad97…
221 [`bufferization::bufferizeOp`](https://github.com/llvm/llvm-project/blob/ae2764e835a26bad9774803eca…
223 dialect conversion-based bufferization.
228 contrast to the dialect conversion-based bufferization that delegates this job
232 is returned from a block. Such IR will fail bufferization.
308 bufferization boundary and decide on a memref type. By default, One-Shot
322 %0_m = bufferization.to_memref %0 : memref<?x?xf32, #map>
329 future bufferization. If the op turns out to be bufferized to an op with a
371 is the exact same memref as the aliasing OpOperand after bufferization (in
372 case of in-place bufferization). Otherwise, (e.g., they overlap but are not
377 with `bufferization::replaceOpWithBufferizedValues`.
413 Both dialect conversion-based bufferization and One-Shot Bufferize generate
414 `to_tensor`/`to_memref` ops at the bufferization boundary (when run with
422 One-Shot Bufferize does currently not support function graph bufferization.
424 run the existing `--func-bufferize` bufferization pass after One-Shot Bufferize.
428 which is an extension of One-Shot Bufferize. This bufferization is still under
432 bufferization.
436 Disclaimer: Most dialect conversion-based bufferization has been migrated to
439 conversion-based bufferization.
442 The bulk of the code related to bufferization is a set of ordinary
449 This document is targeted at people looking to utilize MLIR's bufferization
457 That talk gives a high-level overview of the bufferization infrastructure and
471 after bufferization.
479 ### General structure of the bufferization process
481 Bufferization consists of running multiple *partial* bufferization passes,
482 followed by one *finalizing* bufferization pass.
484 There is typically one partial bufferization pass per dialect (though other
490 Partial bufferization passes create programs where only some ops have been
496 Finalizing bufferizations complete the bufferization process, and guarantee that
502 However, it is possible for a finalizing bufferization to do more than just
503 eliminate materializations. By adding patterns (just as a partial bufferization
504 would), it is possible for a finalizing bufferization pass to simultaneously
510 As a concrete example, we will look at the bufferization pipeline from the
516 // Partial bufferization passes.
524 // Finalizing bufferization pass.
528 Looking first at the partial bufferization passes, we see that there are a
534 The bulk of the bufferization work is done by the function passes. Most of these
537 The `tcp-bufferize` pass is an exception -- it is a partial bufferization pass
541 The last pass is the finalizing bufferization pass. The `mlir-npcomp` reference
544 bufferization pass. This gives excellent diagnostics when something goes wrong
545 with the bufferization process, such as due to an op that wasn't handled by any
548 ### How to write a partial bufferization pass
550 The contract of a partial bufferization pass is that a subset of ops (or kinds
553 A partial bufferization pass is just a pass that uses the
621 One convenient utility provided by the MLIR bufferization infrastructure is the
626 `bufferization.to_tensor` and `bufferization.to_memref` ops, which are inserted
632 ### Other partial bufferization examples
658 ### How to write a finalizing bufferization pass
660 The contract of a finalizing bufferization pass is that all tensors are gone
665 `bufferization.to_tensor` / `bufferization.to_memref` materialization ops
666 inserted by partial bufferization passes and emits an error if that is not
669 This pass is sufficient when partial bufferization passes have bufferized all
677 However, before the current bufferization infrastructure was put in place,
678 bufferization could only be done as a single finalizing bufferization mega-pass
685 `bufferization.to_tensor` and `bufferization.to_memref`.
691 bufferization pass.
692 - Most partial bufferization passes have been reimplemented in terms of
694 of dialect conversion-based bufferization.