@@ -894,10 +894,16 @@ static bool isContiguousLoadIdx(LinalgOp &linalgOp, Value &val,
894
894
return result;
895
895
}
896
896
897
- // / Check whether \p extractOp would be a gather or a contiguous load Op after
898
- // / vectorising \p linalgOp. Note that it is always safe to use gather load
899
- // / operations for contiguous loads (albeit slow), but not vice-versa. When in
900
- // / doubt, bail out and assume that \p extractOp is a gather load.
897
+ // / Infer the memory access pattern for the input ExtractOp
898
+ // /
899
+ // / Based on the operation shapes and indices (usually based on the iteration
900
+ // / space of the parent `linalgOp` operation), decides whether the input
901
+ // / ExtractOp is a contiguous load (including a broadcast of a scalar) or a
902
+ // / gather load.
903
+ // /
904
+ // / Note that it is always safe to use gather load operations for contiguous
905
+ // / loads (albeit slow), but not vice-versa. When in doubt, bail out and assume
906
+ // / that `extractOp` is a gather load.
901
907
static VectorMemoryAccessKind
902
908
getTensorExtractMemoryAccessPattern (tensor::ExtractOp extractOp,
903
909
LinalgOp &linalgOp) {
@@ -916,8 +922,8 @@ getTensorExtractMemoryAccessPattern(tensor::ExtractOp extractOp,
916
922
return VectorMemoryAccessKind::Gather;
917
923
918
924
// 1. Assume that it's a gather load when reading _into_:
919
- // * an n-D vector, like`tensor<1x2x4xi32` or`tensor<2x1x4xi32>`, or
920
- // * a 1-D vector with the trailing dim equal 1, e.g. `tensor<1x4x1xi32`.
925
+ // * an n-D " vector" , like `tensor<1x2x4xi32` or `tensor<2x1x4xi32>`, or
926
+ // * a 1-D " vector" with the trailing dim equal 1, e.g. `tensor<1x4x1xi32`.
921
927
// TODO: Relax these conditions.
922
928
// FIXME: This condition assumes non-dynamic sizes.
923
929
if ((llvm::count_if (targetShape,
0 commit comments