MLIR  19.0.0git
Public Attributes | List of all members
mlir::linalg::SplitReductionResult Struct Reference

Apply transformation to split the single linalg op reduction into a parallel and reduction dimension. More...

#include "mlir/Dialect/Linalg/Transforms/Transforms.h"

Public Attributes

OperationinitOrAlloc
 
FillOp fillOp
 
LinalgOp splitLinalgOp
 
LinalgOp resultCombiningLinalgOp
 

Detailed Description

Apply transformation to split the single linalg op reduction into a parallel and reduction dimension.

Then create a new linalg.generic op doing the rest of the reduction. Return the new linalg op with an extra parallel dimension or failure if the transformation didn't happen.

Example:

%r = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>,
affine_map<(d0) -> ()>],
iterator_types = ["reduction"]}
ins(%in : tensor<32xf32>)
outs(%out : tensor<f32>) {
^bb0(%arg1: f32, %arg2: f32):
%y = arith.addf %arg1, %arg2 : f32
linalg.yield %y : f32
} -> tensor<f32>

To:

%cst = arith.constant 0.000000e+00 : f32
%0 = tensor.expand_shape %in [[0, 1]] : tensor<32xf32> into
tensor<4x8xf32> %1 = tensor.empty [4] : tensor<4xf32> %2 = linalg.fill
ins(%cst : f32) outs(%1 : tensor<4xf32>) -> tensor<4xf32> %3 =
linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>,
affine_map<(d0, d1) -> (d0)>],
iterator_types = ["parallel", "reduction"]}
ins(%0 : tensor<4x8xf32>) outs(%2 : tensor<4xf32>) {
^bb0(%arg3: f32, %arg5: f32):
%5 = arith.addf %arg3, %arg4 : f32
linalg.yield %5 : f32
} -> tensor<4xf32>
%r = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>,
affine_map<(d0) -> ()>],
iterator_types = ["reduction"]}
ins(%3 : tensor<4xf32>) outs(%out : tensor<f32>) {
^bb0(%arg3: f32, %arg4: f32):
%5 = arith.addf %arg3, %arg4 : f32
linalg.yield %5 : f32
} -> tensor<f32>

Definition at line 1011 of file Transforms.h.

Member Data Documentation

◆ fillOp

FillOp mlir::linalg::SplitReductionResult::fillOp

Definition at line 1013 of file Transforms.h.

◆ initOrAlloc

Operation* mlir::linalg::SplitReductionResult::initOrAlloc

Definition at line 1012 of file Transforms.h.

◆ resultCombiningLinalgOp

LinalgOp mlir::linalg::SplitReductionResult::resultCombiningLinalgOp

Definition at line 1015 of file Transforms.h.

◆ splitLinalgOp

LinalgOp mlir::linalg::SplitReductionResult::splitLinalgOp

Definition at line 1014 of file Transforms.h.


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