CIRCT  19.0.0git
Namespaces | Macros | Functions
LowerVectorizations.cpp File Reference
#include "circt/Dialect/Arc/ArcOps.h"
#include "circt/Dialect/Arc/ArcPasses.h"
#include "circt/Dialect/Comb/CombOps.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/Pass/Pass.h"
#include "circt/Dialect/Arc/ArcPassesEnums.cpp.inc"
#include "circt/Dialect/Arc/ArcPasses.h.inc"
Include dependency graph for LowerVectorizations.cpp:

Go to the source code of this file.

Namespaces

 circt
 This file defines an intermediate representation for circuits acting as an abstraction for constraints defined over an SMT's solver context.
 
 circt::arc
 

Macros

#define GEN_PASS_DEF_LOWERVECTORIZATIONS
 

Functions

static VectorizeOp lowerBoundaryScalar (VectorizeOp op)
 Vectorizes the arc.vectorize boundary by packing the vector elements into an integer value. More...
 
static VectorizeOp lowerBoundaryVector (VectorizeOp op)
 Vectorizes the arc.vectorize boundary by using the vector type and dialect for SIMD-based vectorization. More...
 
static VectorizeOp lowerBoundary (VectorizeOp op)
 Vectorizes the boundary of the given arc.vectorize operation if it is not already vectorized. More...
 
static FailureOr< VectorizeOp > lowerBody (VectorizeOp op)
 Vectorizes the body of the given arc.vectorize operation if it is not already vectorized. More...
 
static LogicalResult inlineBody (VectorizeOp op)
 Inlines the arc.vectorize operations body once both the boundary and body are vectorized. More...
 

Macro Definition Documentation

◆ GEN_PASS_DEF_LOWERVECTORIZATIONS

#define GEN_PASS_DEF_LOWERVECTORIZATIONS

Definition at line 21 of file LowerVectorizations.cpp.

Function Documentation

◆ inlineBody()

static LogicalResult inlineBody ( VectorizeOp  op)
static

Inlines the arc.vectorize operations body once both the boundary and body are vectorized.

Example:

%0 = comb.concat %in0, %in1 : i1, i1
%1 = comb.concat %in2, %in2 : i1, i1
%2 = arc.vectorize (%0), (%1) : (i2, i2) -> i2 {
^bb0(%arg0: i2, %arg1: i2):
%12 = arith.andi %arg0, %arg1 : i2
arc.vectorize.return %12 : i2
}
%3 = comb.extract %2 from 0 : (i2) -> i1
%4 = comb.extract %2 from 1 : (i2) -> i1

becomes

%0 = comb.concat %in0, %in1 : i1, i1
%1 = comb.concat %in2, %in2 : i1, i1
%2 = arith.andi %0, %1 : i2
%3 = comb.extract %2 from 0 : (i2) -> i1
%4 = comb.extract %2 from 1 : (i2) -> i1

Definition at line 230 of file LowerVectorizations.cpp.

◆ lowerBody()

static FailureOr<VectorizeOp> lowerBody ( VectorizeOp  op)
static

Vectorizes the body of the given arc.vectorize operation if it is not already vectorized.

If the boundary of the arc.vectorize operation is already vectorized the same vectorization technique (SIMD or scalar) is chosen. Otherwise,

  • packs the vector in a scalar if it fits in a 64-bit integer or
  • uses the vector type and dialect for SIMD vectorization Returns the vectorized version of the op or failure. May invalidate the passed operation.

Definition at line 200 of file LowerVectorizations.cpp.

◆ lowerBoundary()

static VectorizeOp lowerBoundary ( VectorizeOp  op)
static

Vectorizes the boundary of the given arc.vectorize operation if it is not already vectorized.

If the body of the arc.vectorize operation is already vectorized the same vectorization technique (SIMD or scalar) is chosen. Otherwise,

  • packs the vector in a scalar if it fits in a 64-bit integer or
  • uses the vector type and dialect for SIMD vectorization Returns the vectorized version of the op. May invalidate the passed operation.

Definition at line 163 of file LowerVectorizations.cpp.

References lowerBoundaryScalar(), and lowerBoundaryVector().

◆ lowerBoundaryScalar()

static VectorizeOp lowerBoundaryScalar ( VectorizeOp  op)
static

Vectorizes the arc.vectorize boundary by packing the vector elements into an integer value.

Returns the vectorized version of the op. May invalidate the passed operation.

Example:

%0:2 = arc.vectorize (%in0, %in1), (%in2, %in3) : (i1, i1, i1, i1) -> (i1,
i1) { ^bb0(%arg0: i1, %arg1: i1):
%1 = comb.and %arg0, %arg1 : i1
arc.vectorize.return %1 : i1
}

becomes

%0 = comb.concat %in0, %in1 : i1, i1
%1 = comb.concat %in2, %in3 : i1, i1
%2 = arc.vectorize (%0), (%1) : (i2, i2) -> i2 {
^bb0(%arg0: i1, %arg1: i1):
%11 = comb.and %arg0, %arg1 : i1
arc.vectorize.return %11 : i1
}
%3 = comb.extract %2 from 0 : (i2) -> i1
%4 = comb.extract %2 from 1 : (i2) -> i1

Definition at line 54 of file LowerVectorizations.cpp.

References builder, and width.

Referenced by lowerBoundary().

◆ lowerBoundaryVector()

static VectorizeOp lowerBoundaryVector ( VectorizeOp  op)
static

Vectorizes the arc.vectorize boundary by using the vector type and dialect for SIMD-based vectorization.

Returns the vectorized version of the op. May invalidate the passed operation.

Example:

%0:2 = arc.vectorize (%in0, %in1), (%in2, %in2) : (i64, i64, i32, i32) ->
(i64, i64) { ^bb0(%arg0: i64, %arg1: i32):
%c0_i32 = hw.constant 0 : i32
%1 = comb.concat %c0_i32, %arg1 : i32, i32
%2 = comb.and %arg0, %1 : i64
arc.vectorize.return %2 : i64
}

becomes

%cst = arith.constant dense<0> : vector<2xi64>
%0 = vector.insert %in0, %cst [0] : i64 into vector<2xi64>
%1 = vector.insert %in1, %0 [1] : i64 into vector<2xi64>
%2 = vector.broadcast %in2 : i32 to vector<2xi32>
%3 = arc.vectorize (%1), (%2) : (vector<2xi64>, vector<2xi32>) ->
vector<2xi64> { ^bb0(%arg0: i64, %arg1: i32):
%c0_i32 = hw.constant 0 : i32
%4 = comb.concat %c0_i32, %arg1 : i32, i32
%5 = comb.and %arg0, %4 : i64
arc.vectorize.return %5 : i64
}
%4 = vector.extract %3[0] : vector<2xi64>
%5 = vector.extract %3[1] : vector<2xi64>

Definition at line 111 of file LowerVectorizations.cpp.

References builder, and circt::calyx::direction::get().

Referenced by lowerBoundary().