Closed hanhanW closed 1 year ago
Here is a doc about MLIR folders: https://mlir.llvm.org/docs/Canonicalization/#canonicalizing-with-the-fold-method
I think what can be done in the folder is that we can use getPaddingValueMutable()
method and clear the range, which allows us in-place update. So it can be canonicalized with a fold
method. If it is not feasible, we can add canonicalization patterns.
would help readability for sure! we also have stream.alignment
on dynamic dimensions we could use to support folding it away via dataflow analysis (but probably separate logic unless the integer range analysis upstream lets us seed it with known alignments)
@Shukla-Gaurav can you take a look at this when you are available? Thank you!
Found the case in IR dump and bug reports. We want the folder, which folds padding_value away if possible. It can be applied when we have enough static information. E.g, 500000 is divisible by 16 and 1200 is divisible by 1. In this context, we don't need padding_value.