MLIR  16.0.0git
Static Public Member Functions | List of all members
mlir::OpTrait::Elementwise< ConcreteType > Struct Template Reference

This trait tags element-wise ops on vectors or tensors. More...

#include "mlir/IR/OpDefinition.h"

+ Inheritance diagram for mlir::OpTrait::Elementwise< ConcreteType >:
+ Collaboration diagram for mlir::OpTrait::Elementwise< ConcreteType >:

Static Public Member Functions

static LogicalResult verifyTrait (Operation *op)

Additional Inherited Members

- Protected Member Functions inherited from mlir::OpTrait::TraitBase< ConcreteType, Elementwise >
OperationgetOperation ()
 Return the ultimate Operation being worked on. More...

Detailed Description

template<typename ConcreteType>
struct mlir::OpTrait::Elementwise< ConcreteType >

This trait tags element-wise ops on vectors or tensors.

NOTE: Not all ops that are "elementwise" in some abstract sense satisfy this trait. In particular, broadcasting behavior is not allowed.

An Elementwise op must satisfy the following properties:

  1. If any result is a vector/tensor then at least one operand must also be a vector/tensor.
  2. If any operand is a vector/tensor then there must be at least one result and all results must be vectors/tensors.
  3. All operand and result vector/tensor types must be of the same shape. The shape may be dynamic in which case the op's behaviour is undefined for non-matching shapes.
  4. The operation must be elementwise on its vector/tensor operands and results. When applied to single-element vectors/tensors, the result must be the same per elememnt.

TODO: Avoid hardcoding vector/tensor, and generalize this trait to a new interface ElementwiseTypeInterface that describes the container types for which the operation is elementwise.


Definition at line 1354 of file OpDefinition.h.

Member Function Documentation

◆ verifyTrait()

template<typename ConcreteType >
static LogicalResult mlir::OpTrait::Elementwise< ConcreteType >::verifyTrait ( Operation op)

Definition at line 1355 of file OpDefinition.h.

References mlir::OpTrait::impl::verifyElementwise().

The documentation for this struct was generated from the following file: