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

This trait tags Elementwise operatons that can be systematically tensorized. More...

#include "mlir/IR/OpDefinition.h"

+ Inheritance diagram for mlir::OpTrait::Tensorizable< ConcreteType >:

Static Public Member Functions

static LogicalResult verifyTrait (Operation *op)
 

Additional Inherited Members

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

Detailed Description

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

This trait tags Elementwise operatons that can be systematically tensorized.

All scalar operands and results are then replaced by tensors with the respective element type. Semantically, this is the operation on multiple elements simultaneously. See also Vectorizable.

Rationale: Provide the reverse to Scalarizable which, when chained together, allows reasoning about the relationship between the tensor and vector case. Additionally, it permits reasoning about promoting scalars to tensors via broadcasting in cases like select_scalar_pred below.

Examples:

%scalar = "arith.addf"(%a, %b) : (f32, f32) -> f32

can be tensorized to

%tensor = "arith.addf"(%a, %b) : (tensor<?xf32>, tensor<?xf32>)
-> tensor<?xf32>
%scalar_pred = "arith.select"(%pred, %true_val, %false_val)
: (i1, tensor<?xf32>, tensor<?xf32>) -> tensor<?xf32>

can be tensorized to

%tensor_pred = "arith.select"(%pred, %true_val, %false_val)
: (tensor<?xi1>, tensor<?xf32>, tensor<?xf32>)
-> tensor<?xf32>

Definition at line 1490 of file OpDefinition.h.

Member Function Documentation

◆ verifyTrait()

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

Definition at line 1491 of file OpDefinition.h.


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