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

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

#include "mlir/IR/OpDefinition.h"

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

Static Public Member Functions

static LogicalResult verifyTrait (Operation *op)
 

Additional Inherited Members

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

Detailed Description

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

This trait tags Elementwise operatons that can be systematically scalarized.

All vector/tensor operands and results are then replaced by scalars of the respective element type. Semantically, this is the operation on a single element of the vector/tensor.

Rationale: Allow to define the vector/tensor semantics of elementwise operations based on the same op's behavior on scalars. This provides a constructive procedure for IR transformations to, e.g., create scalar loop bodies from tensor ops.

Example:

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

can be scalarized to

%scalar_select = "arith.select"(%pred, %true_val_scalar, %false_val_scalar)
: (i1, f32, f32) -> f32

Definition at line 1429 of file OpDefinition.h.

Member Function Documentation

◆ verifyTrait()

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

Definition at line 1430 of file OpDefinition.h.


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