Page MenuHomePhabricator

[mlir][linalg] Vectorize PadTensorOp with conditional reads
Needs ReviewPublic

Authored by antiagainst on Jan 11 2022, 5:51 AM.

Details

Summary

This commits adds a pattern to vectorize linalg.pad_tensor
ops with static result shapes. It generates scf.if ops to
guard against vector.transfer_read ops to make sure they are
in bounds.

This is needed for correctness when the PadTensorOp has
dynamic low padding value. For such cases, we cannot simply
transfer the out-of-bound semantics to vector.transfer_read
ops by marking the corresponding dimensions' inbounds attribute
value to false, because vector.transfer_read ops assumes at
least the first value read along each dimension to be in bounds.

This pattern can also be helpful for eventually lowering to
hardware targets that does not have native support for
vector.transfer_write ops with out-of-bound semantics.

Depends On D117020

Diff Detail