MLIR  19.0.0git
Macros | Typedefs | Functions
SparseTensorIterator.cpp File Reference
#include "SparseTensorIterator.h"
#include "CodegenUtils.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"

Go to the source code of this file.

Macros

#define CMPI(p, lhs, rhs)
 
#define C_FALSE   (constantI1(b, l, false))
 
#define C_TRUE   (constantI1(b, l, true))
 
#define C_IDX(v)   (constantIndex(b, l, (v)))
 
#define YIELD(vs)   (b.create<scf::YieldOp>(l, (vs)))
 
#define ADDI(lhs, rhs)   (b.create<arith::AddIOp>(l, (lhs), (rhs)).getResult())
 
#define ORI(lhs, rhs)   (b.create<arith::OrIOp>(l, (lhs), (rhs)).getResult())
 
#define ANDI(lhs, rhs)   (b.create<arith::AndIOp>(l, (lhs), (rhs)).getResult())
 
#define SUBI(lhs, rhs)   (b.create<arith::SubIOp>(l, (lhs), (rhs)).getResult())
 
#define MULI(lhs, rhs)   (b.create<arith::MulIOp>(l, (lhs), (rhs)).getResult())
 
#define MINUI(lhs, rhs)   (b.create<arith::MinUIOp>(l, (lhs), (rhs)).getResult())
 
#define REMUI(lhs, rhs)   (b.create<arith::RemUIOp>(l, (lhs), (rhs)).getResult())
 
#define DIVUI(lhs, rhs)   (b.create<arith::DivUIOp>(l, (lhs), (rhs)).getResult())
 
#define SELECT(c, lhs, rhs)    (b.create<arith::SelectOp>(l, (c), (lhs), (rhs)).getResult())
 

Typedefs

using ValuePair = std::pair< Value, Value >
 
using ValueTuple = std::tuple< Value, Value, Value >
 

Functions

static scf::ValueVector genWhenInBound (OpBuilder &b, Location l, SparseIterator &it, ValueRange elseRet, llvm::function_ref< scf::ValueVector(OpBuilder &, Location, Value)> builder)
 
static Value offsetFromMinCrd (OpBuilder &b, Location l, Value minCrd, Value size)
 Generates code to compute the absolute offset of the slice based on the provide minimum coordinates in the slice. More...
 
static const SparseIteratortryUnwrapFilter (const SparseIterator *it)
 

Macro Definition Documentation

◆ ADDI

#define ADDI (   lhs,
  rhs 
)    (b.create<arith::AddIOp>(l, (lhs), (rhs)).getResult())

Definition at line 32 of file SparseTensorIterator.cpp.

◆ ANDI

#define ANDI (   lhs,
  rhs 
)    (b.create<arith::AndIOp>(l, (lhs), (rhs)).getResult())

Definition at line 34 of file SparseTensorIterator.cpp.

◆ C_FALSE

#define C_FALSE   (constantI1(b, l, false))

Definition at line 28 of file SparseTensorIterator.cpp.

◆ C_IDX

#define C_IDX (   v)    (constantIndex(b, l, (v)))

Definition at line 30 of file SparseTensorIterator.cpp.

◆ C_TRUE

#define C_TRUE   (constantI1(b, l, true))

Definition at line 29 of file SparseTensorIterator.cpp.

◆ CMPI

#define CMPI (   p,
  lhs,
  rhs 
)
Value:
(b.create<arith::CmpIOp>(l, arith::CmpIPredicate::p, (lhs), (rhs)) \
.getResult())

Definition at line 24 of file SparseTensorIterator.cpp.

◆ DIVUI

#define DIVUI (   lhs,
  rhs 
)    (b.create<arith::DivUIOp>(l, (lhs), (rhs)).getResult())

Definition at line 39 of file SparseTensorIterator.cpp.

◆ MINUI

#define MINUI (   lhs,
  rhs 
)    (b.create<arith::MinUIOp>(l, (lhs), (rhs)).getResult())

Definition at line 37 of file SparseTensorIterator.cpp.

◆ MULI

#define MULI (   lhs,
  rhs 
)    (b.create<arith::MulIOp>(l, (lhs), (rhs)).getResult())

Definition at line 36 of file SparseTensorIterator.cpp.

◆ ORI

#define ORI (   lhs,
  rhs 
)    (b.create<arith::OrIOp>(l, (lhs), (rhs)).getResult())

Definition at line 33 of file SparseTensorIterator.cpp.

◆ REMUI

#define REMUI (   lhs,
  rhs 
)    (b.create<arith::RemUIOp>(l, (lhs), (rhs)).getResult())

Definition at line 38 of file SparseTensorIterator.cpp.

◆ SELECT

#define SELECT (   c,
  lhs,
  rhs 
)     (b.create<arith::SelectOp>(l, (c), (lhs), (rhs)).getResult())

Definition at line 40 of file SparseTensorIterator.cpp.

◆ SUBI

#define SUBI (   lhs,
  rhs 
)    (b.create<arith::SubIOp>(l, (lhs), (rhs)).getResult())

Definition at line 35 of file SparseTensorIterator.cpp.

◆ YIELD

#define YIELD (   vs)    (b.create<scf::YieldOp>(l, (vs)))

Definition at line 31 of file SparseTensorIterator.cpp.

Typedef Documentation

◆ ValuePair

using ValuePair = std::pair<Value, Value>

Definition at line 18 of file SparseTensorIterator.cpp.

◆ ValueTuple

using ValueTuple = std::tuple<Value, Value, Value>

Definition at line 19 of file SparseTensorIterator.cpp.

Function Documentation

◆ genWhenInBound()

static scf::ValueVector genWhenInBound ( OpBuilder b,
Location  l,
SparseIterator it,
ValueRange  elseRet,
llvm::function_ref< scf::ValueVector(OpBuilder &, Location, Value)>  builder 
)
static

◆ offsetFromMinCrd()

static Value offsetFromMinCrd ( OpBuilder b,
Location  l,
Value  minCrd,
Value  size 
)
static

Generates code to compute the absolute offset of the slice based on the provide minimum coordinates in the slice.

E.g., when reducing d0 + d1 + d2, we need two slices to fully reduced the expression, i,e, s1 = slice(T, d0), s2 = slice(s1, d1). The absolute offset is the offset computed relative to the initial tensors T.

When isNonEmpty == true, the computed offset is meaningless and should not be used during runtime, the method generates code to return 0 currently in that case.

offset = minCrd >= size ? minCrd - size + 1 : 0;

Definition at line 269 of file SparseTensorIterator.cpp.

References ADDI, C_IDX, CMPI, SELECT, and SUBI.

◆ tryUnwrapFilter()

static const SparseIterator* tryUnwrapFilter ( const SparseIterator it)
static