- Fold an unpack(pack(x)) to x.
- Rewrite a tensor.pack to an tensor.expand_shape if only one dimension is packed.
| Paths 
 |  Differential  D141123  
[MLIR][Tensor] Add canonicalization patterns for `tensor.pack` ClosedPublic Authored by chelini on Jan 6 2023, 4:49 AM. 
Details Summary 
 
 
Diff Detail 
 Event Timeline
 mravishankar added inline comments. This revision now requires changes to proceed.Jan 6 2023, 12:08 PM 
 Comment Actions 
 
 
 
 
 
 
 chelini marked an inline comment as done. hanchung added inline comments. 
 mravishankar added inline comments. 
 This revision is now accepted and ready to land.Jan 11 2023, 6:06 PM Closed by commit rG9a5092b358ce: [MLIR][Tensor] Add canonicalization patterns for `tensor.pack` (authored by chelini).  ·  Explain WhyJan 11 2023, 11:46 PM This revision was automatically updated to reflect the committed changes. 
Revision Contents 
 
 
Diff 487730 mlir/include/mlir/Dialect/Tensor/IR/Tensor.h
 mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
 mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
 mlir/test/Dialect/Tensor/canonicalize.mlir
 mlir/test/Dialect/Tensor/simplify-tensor-pack.mlir
 
 mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[optional] The operandType is only used once; it does not improve readability. The method itself describes it. I think we can save one line here.