Add a transform to make tensor.pad and tensor.empty ops independent of SCF loop IVs. Such ops can then be hoisted.
E.g.:
scf.for %iv = %lb to %ub step %step { %high = affine.apply affine_map<(d0)[s0] -> (s0 - d0)> (%i)[%ub] %p = tensor.pad %t low[5] high[%high] ... ... }
Is transformed to:
%high_new = affine.apply affine_map<()[s0, s1] -> (-s0 + s1)> ()[%lb, %ub] %p_hoistable = tensor.pad %t low[5] high[%high_new] %dim = tensor.dim %t, %c0 %size = affine.apply affine_map<(d0)[s0, s1] -> (-d0 + s0 + s1 + 5)>(%iv)[%ub, %dim] %slice = tensor.extract_slice %p_hoistable [0] [%size] [1]
Depends On: D146524
I can't follow from the description... This is converting an Affine-based value bound into an Arith-based value bound?