Added additional information about the SSA like properties
that has to be fulfilled in the bufferization steps.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/docs/BufferDeallocationInternals.md | ||
---|---|---|
33 | I found this wording confusing (such as the term "full buffer write"). I would suggest to just say that all writes to a memref introduced by bufferization must dominate all reads (you say this below in a parenthetical but it should be the primary definition of the constraint). |
mlir/docs/BufferDeallocationInternals.md | ||
---|---|---|
33 | And strictly speaking, I would say that all writes must dominate all tensor_load ops. I think it is okay to read and write arbitrarily before the tensor_load. E.g. this is fine, despite having intermixed reads and writes: %0 = alloc() store %0[0] = 42 %1 = load %0[0] %2 = add %1, 7 store %0[0] = %2 |
mlir/docs/BufferDeallocationInternals.md | ||
---|---|---|
33 | For example, the bufferization of linalg.matmul effectively results in load/add/store similar to the above. |
mlir/docs/BufferDeallocationInternals.md | ||
---|---|---|
33 |
As you mention yourself, this is not true for bufferization patterns that iteratively produce their value. So this is not good enough either. The goal of this restriction in essence is to ensure that if we need to insert a copy for an allocation as it escapes, we need to be sure that we do not hide mutations. If the allocation dominates all writes, then a copy should never be needed. I have not thought this through, though. And for bufferization patterns, we would have the requirement that they may only write to buffers they allocated themselves. |
I think we should land this as it is strictly an improvement over the current documentation. We can improve further but having it documented avoids more confusion than it creates.
I found this wording confusing (such as the term "full buffer write"). I would suggest to just say that all writes to a memref introduced by bufferization must dominate all reads (you say this below in a parenthetical but it should be the primary definition of the constraint).