Commit afc25a43 authored by Nicolas Vasilache's avatar Nicolas Vasilache
Browse files

[mlir][Linalg] NFC - Rename LinalgGeneric -> GenericLinalg

Summary: This is part of an ongoing cleanup and uniformization work.

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D72078
parent 13a7a4cc
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -37,12 +37,12 @@ inline StringRef toString(IterType t) {
}

/// A StructuredIndexed represents a captured value that can be indexed and
/// passed to the `makeLinalgGenericOp`. It allows writing intuitive index
/// passed to the `makeGenericLinalgOp`. It allows writing intuitive index
/// expressions such as:
///
/// ```
///      StructuredIndexed A(vA), B(vB), C(vC);
///      makeLinalgGenericOp({A({m, n}), B({k, n})}, {C({m, n})}, ... );
///      makeGenericLinalgOp({A({m, n}), B({k, n})}, {C({m, n})}, ... );
/// ```
struct StructuredIndexed {
  StructuredIndexed(Value v) : value(v) {}
@@ -67,7 +67,7 @@ private:

inline void defaultRegionBuilder(ArrayRef<BlockArgument> args) {}

Operation *makeLinalgGenericOp(
Operation *makeGenericLinalgOp(
    ArrayRef<IterType> iteratorTypes, ArrayRef<StructuredIndexed> inputs,
    ArrayRef<StructuredIndexed> outputs,
    function_ref<void(ArrayRef<BlockArgument>)> regionBuilder =
+6 −6
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ static void getMaxDimIndex(ArrayRef<StructuredIndexed> structuredIndices,
  }
}

Operation *mlir::edsc::makeLinalgGenericOp(
Operation *mlir::edsc::makeGenericLinalgOp(
    ArrayRef<IterType> iteratorTypes, ArrayRef<StructuredIndexed> inputs,
    ArrayRef<StructuredIndexed> outputs,
    function_ref<void(ArrayRef<BlockArgument>)> regionBuilder,
@@ -118,7 +118,7 @@ Operation *mlir::edsc::ops::linalg_pointwise(UnaryPointwiseOpBuilder unaryOp,
    ValueHandle a(args[0]);
    linalg_yield(unaryOp(a));
  };
  return makeLinalgGenericOp(iterTypes, {I}, {O}, fun);
  return makeGenericLinalgOp(iterTypes, {I}, {O}, fun);
}

Operation *mlir::edsc::ops::linalg_pointwise_tanh(StructuredIndexed I,
@@ -141,7 +141,7 @@ Operation *mlir::edsc::ops::linalg_pointwise(BinaryPointwiseOpBuilder binaryOp,
    ValueHandle a(args[0]), b(args[1]);
    linalg_yield(binaryOp(a, b));
  };
  return makeLinalgGenericOp(iterTypes, {I1, I2}, {O}, fun);
  return makeGenericLinalgOp(iterTypes, {I1, I2}, {O}, fun);
}

Operation *mlir::edsc::ops::linalg_pointwise_add(StructuredIndexed I1,
@@ -170,7 +170,7 @@ Operation *mlir::edsc::ops::linalg_matmul(ValueHandle vA, ValueHandle vB,
  AffineExpr m, n, k;
  bindDims(ScopedContext::getContext(), m, n, k);
  StructuredIndexed A(vA), B(vB), C(vC);
  return makeLinalgGenericOp(
  return makeGenericLinalgOp(
    {IterType::Parallel, IterType::Parallel, IterType::Reduction},
    {A({m, k}), B({k, n})},
    {C({m, n})},
@@ -198,7 +198,7 @@ Operation *mlir::edsc::ops::linalg_conv_nhwc(ValueHandle vI, ValueHandle vW,
  unsigned numDims = c.cast<AffineDimExpr>().getPosition() + 1;
  StructuredIndexed I(vI), W(vW), O(vO);
  // clang-format off
  return makeLinalgGenericOp(
  return makeGenericLinalgOp(
    {par, par, par, par, red, red, red}, {
      I({b,
         // Roundtrip to flattened form to serve as canonicalization and ensure
@@ -231,7 +231,7 @@ Operation *mlir::edsc::ops::linalg_dilated_conv_nhwc(
  bindDims(ctx, b, dm, c, h, w, kh, kw);
  unsigned numDims = kw.cast<AffineDimExpr>().getPosition() + 1;
  StructuredIndexed I(vI), W(vW), O(vO);
  return makeLinalgGenericOp(
  return makeGenericLinalgOp(
    {par, par, par, par, par, red, red}, {
      I({b,
         // Roundtrip to flattened form to serve as canonicalization and ensure