Skip to content
This repository was archived by the owner on Apr 23, 2021. It is now read-only.
This repository was archived by the owner on Apr 23, 2021. It is now read-only.

Bugs in examples/Linalg2 TensorOps.h ? #26

Closed

Description

@yehenrytian

In the Linalg dialect example: examples/Linalg/Linalg2/include/linalg2/TensorOps.h why the 3 op classes are all defined with mlir::OpTrait::ZeroResult?

/// Implements c = A * B where c is a scalar and A and B are 1-D vectors.
class DotOp : public TensorContractionBase<DotOp>,
              public mlir::Op<DotOp, mlir::OpTrait::VariadicOperands,
                              mlir::OpTrait::ZeroResult> {


/// Implements C = A * B where A is a 2-D matrix and X and Y are 1-D vectors.
class MatvecOp : public TensorContractionBase<MatvecOp>,
                 public mlir::Op<MatvecOp, mlir::OpTrait::VariadicOperands,
                                 mlir::OpTrait::ZeroResult> {


/// Implements C = A * B on 2-D matrices.
class MatmulOp : public TensorContractionBase<MatmulOp>,
                 public mlir::Op<MatmulOp, mlir::OpTrait::VariadicOperands,
                                 mlir::OpTrait::ZeroResult> {

Why not mlir::OpTrait::OneResult? Thanks!

Activity

  1. joker-eph commented on Apr 22, 2019

    @joker-eph
    Contributor

    If you look for example here: https://github.com/tensorflow/mlir/blob/master/examples/Linalg/Linalg2/Example.cpp#L56 ; you'll see that these operations work by taking 3 views as operands: the two inputs and the result. A C++ equivalent would be:

    void matmul(View Result, View LHS, View RHS);
    

    Instead of:

    View matmul(View LHS, View RHS);
    

    So there are not values produced by this operations, it works by side-effects.

    Also the MLIR mailing-list is likely a good place for this kind of questions: https://groups.google.com/a/tensorflow.org/forum/#!forum/mlir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions