CIRCT  19.0.0git
Classes | Typedefs | Functions | Variables
circt::handshake Namespace Reference

Classes

class  HandshakeLowering
 
struct  MemLoadInterface
 
struct  MemStoreInterface
 
class  HandshakeVisitor
 HandshakeVisitor is a visitor for handshake nodes. More...
 

Typedefs

using RegionLoweringFunc = llvm::function_ref< LogicalResult(Region &, ConversionPatternRewriter &)>
 
using InstanceGraph = std::map< std::string, std::set< std::string > >
 Iterates over the handshake::FuncOp's in the program to build an instance graph. More...
 

Functions

LogicalResult partiallyLowerRegion (const RegionLoweringFunc &loweringFunc, MLIRContext *ctx, Region &r)
 
template<typename T , typename... TArgs, typename... TArgs2>
LogicalResult runPartialLowering (T &instance, LogicalResult(T::*memberFunc)(ConversionPatternRewriter &, TArgs2...), TArgs &...args)
 
void removeBasicBlocks (Region &r)
 Remove basic blocks inside the given region. More...
 
template<typename TSrcTerm , typename TDstTerm >
LogicalResult lowerRegion (HandshakeLowering &hl, bool sourceConstants, bool disableTaskPipelining, Value entryCtrl)
 
LogicalResult postDataflowConvert (Operation *op)
 Lowers the mlir operations into handshake that are not part of the dataflow conversion. More...
 
Type toValidType (Type t)
 
esi::ChannelType esiWrapper (mlir::Type t)
 
hw::ModulePortInfo getPortInfoForOpTypes (mlir::Operation *op, TypeRange inputs, TypeRange outputs)
 
bool isControlOpImpl (Operation *op)
 Default implementation for checking whether an operation is a control operation. More...
 
std::unique_ptr< mlir::OperationPass< mlir::ModuleOp > > createHandshakeDotPrintPass ()
 
std::unique_ptr< mlir::OperationPass< mlir::ModuleOp > > createHandshakeOpCountPass ()
 
std::unique_ptr< mlir::Pass > createHandshakeMaterializeForksSinksPass ()
 
std::unique_ptr< mlir::Pass > createHandshakeDematerializeForksSinksPass ()
 
std::unique_ptr< mlir::Pass > createHandshakeRemoveBuffersPass ()
 
std::unique_ptr< mlir::Pass > createHandshakeAddIDsPass ()
 
std::unique_ptr< mlir::Pass > createHandshakeLowerExtmemToHWPass (std::optional< bool > createESIWrapper={})
 
std::unique_ptr< mlir::Pass > createHandshakeLegalizeMemrefsPass ()
 
std::unique_ptr< mlir::OperationPass< handshake::FuncOp > > createHandshakeInsertBuffersPass (const std::string &strategy="all", unsigned bufferSize=2)
 
std::unique_ptr< mlir::Pass > createHandshakeLockFunctionsPass ()
 
LogicalResult resolveInstanceGraph (ModuleOp moduleOp, InstanceGraph &instanceGraph, std::string &topLevel, SmallVectorImpl< std::string > &sortedFuncs)
 Iterates over the handshake::FuncOp's in the program to build an instance graph. More...
 
LogicalResult verifyAllValuesHasOneUse (handshake::FuncOp op)
 
LogicalResult addSinkOps (Region &r, OpBuilder &rewriter)
 
LogicalResult addForkOps (Region &r, OpBuilder &rewriter)
 
void insertFork (Value result, bool isLazy, OpBuilder &rewriter)
 
LogicalResult lockRegion (Region &r, OpBuilder &rewriter)
 
LogicalResult bufferRegion (Region &r, OpBuilder &rewriter, StringRef strategy, unsigned bufferSize)
 
bool simulate (llvm::StringRef toplevelFunction, llvm::ArrayRef< std::string > inputArgs, mlir::OwningOpRef< mlir::ModuleOp > &module, mlir::MLIRContext &context)
 
template<typename TMemOp >
static bool executeMemoryOperation (TMemOp op, unsigned buffer, int opIndex, llvm::DenseMap< mlir::Value, llvm::Any > &valueMap, llvm::DenseMap< unsigned, unsigned > &memoryMap, llvm::DenseMap< mlir::Value, double > &timeMap, std::vector< std::vector< llvm::Any >> &store, std::vector< mlir::Value > &scheduleList)
 
static Type tupleToStruct (TupleType tuple)
 
esi::ChannelType esiWrapper (Type t)
 
hw::ModulePortInfo getPortInfoForOpTypes (Operation *op, TypeRange inputs, TypeRange outputs)
 

Variables

static constexpr const char * kPredeclarationAttr = "handshake.module_name"
 

Typedef Documentation

◆ InstanceGraph

using circt::handshake::InstanceGraph = typedef std::map<std::string, std::set<std::string> >

Iterates over the handshake::FuncOp's in the program to build an instance graph.

In doing so, we detect whether there are any cycles in this graph, as well as infer a top function for the design by performing a topological sort of the instance graph. The result of this sort is placed in sortedFuncs.

Definition at line 50 of file HandshakePasses.h.

◆ RegionLoweringFunc

using circt::handshake::RegionLoweringFunc = typedef llvm::function_ref<LogicalResult(Region &, ConversionPatternRewriter &)>

Definition at line 38 of file CFToHandshake.h.

Function Documentation

◆ addForkOps()

LogicalResult circt::handshake::addForkOps ( Region &  r,
OpBuilder &  rewriter 
)

Definition at line 76 of file Materialization.cpp.

References insertFork().

◆ addSinkOps()

LogicalResult circt::handshake::addSinkOps ( Region &  r,
OpBuilder &  rewriter 
)

Definition at line 96 of file Materialization.cpp.

References insertSink().

◆ bufferRegion()

LogicalResult circt::handshake::bufferRegion ( Region &  r,
OpBuilder &  rewriter,
StringRef  strategy,
unsigned  bufferSize 
)

◆ createHandshakeAddIDsPass()

std::unique_ptr< mlir::Pass > circt::handshake::createHandshakeAddIDsPass ( )

Definition at line 618 of file Analysis.cpp.

◆ createHandshakeDematerializeForksSinksPass()

std::unique_ptr< mlir::Pass > circt::handshake::createHandshakeDematerializeForksSinksPass ( )

Definition at line 171 of file Materialization.cpp.

◆ createHandshakeDotPrintPass()

std::unique_ptr< mlir::OperationPass< mlir::ModuleOp > > circt::handshake::createHandshakeDotPrintPass ( )

Definition at line 609 of file Analysis.cpp.

◆ createHandshakeInsertBuffersPass()

std::unique_ptr< mlir::OperationPass< handshake::FuncOp > > circt::handshake::createHandshakeInsertBuffersPass ( const std::string &  strategy = "all",
unsigned  bufferSize = 2 
)

Definition at line 215 of file Buffers.cpp.

◆ createHandshakeLegalizeMemrefsPass()

std::unique_ptr< mlir::Pass > circt::handshake::createHandshakeLegalizeMemrefsPass ( )

Definition at line 93 of file LegalizeMemrefs.cpp.

◆ createHandshakeLockFunctionsPass()

std::unique_ptr< mlir::Pass > circt::handshake::createHandshakeLockFunctionsPass ( )

Definition at line 85 of file LockFunctions.cpp.

◆ createHandshakeLowerExtmemToHWPass()

std::unique_ptr< mlir::Pass > circt::handshake::createHandshakeLowerExtmemToHWPass ( std::optional< bool >  createESIWrapper = {})

Definition at line 479 of file LowerExtmemToHW.cpp.

◆ createHandshakeMaterializeForksSinksPass()

std::unique_ptr< mlir::Pass > circt::handshake::createHandshakeMaterializeForksSinksPass ( )

Definition at line 166 of file Materialization.cpp.

◆ createHandshakeOpCountPass()

std::unique_ptr< mlir::OperationPass< mlir::ModuleOp > > circt::handshake::createHandshakeOpCountPass ( )

Definition at line 614 of file Analysis.cpp.

◆ createHandshakeRemoveBuffersPass()

std::unique_ptr< mlir::Pass > circt::handshake::createHandshakeRemoveBuffersPass ( )

Definition at line 210 of file Buffers.cpp.

◆ esiWrapper() [1/2]

esi::ChannelType circt::handshake::esiWrapper ( mlir::Type  t)

◆ esiWrapper() [2/2]

esi::ChannelType circt::handshake::esiWrapper ( Type  t)

◆ executeMemoryOperation()

template<typename TMemOp >
static bool circt::handshake::executeMemoryOperation ( TMemOp  op,
unsigned  buffer,
int  opIndex,
llvm::DenseMap< mlir::Value, llvm::Any > &  valueMap,
llvm::DenseMap< unsigned, unsigned > &  memoryMap,
llvm::DenseMap< mlir::Value, double > &  timeMap,
std::vector< std::vector< llvm::Any >> &  store,
std::vector< mlir::Value > &  scheduleList 
)
static

Definition at line 274 of file HandshakeExecutableOps.cpp.

References assert().

◆ getPortInfoForOpTypes() [1/2]

hw::ModulePortInfo circt::handshake::getPortInfoForOpTypes ( mlir::Operation *  op,
TypeRange  inputs,
TypeRange  outputs 
)

Referenced by getPortInfoForOp().

◆ getPortInfoForOpTypes() [2/2]

hw::ModulePortInfo circt::handshake::getPortInfoForOpTypes ( Operation *  op,
TypeRange  inputs,
TypeRange  outputs 
)

Definition at line 258 of file PassHelpers.cpp.

References esiWrapper(), circt::calyx::direction::get(), Input, inputs, Output, and outputs.

◆ insertFork()

void circt::handshake::insertFork ( Value  result,
bool  isLazy,
OpBuilder &  rewriter 
)

Definition at line 52 of file Materialization.cpp.

References replaceFirstUse().

Referenced by addForkOps().

◆ isControlOpImpl()

bool circt::handshake::isControlOpImpl ( Operation *  op)

Default implementation for checking whether an operation is a control operation.

This function cannot be defined within ControlInterface because its implementation attempts to cast the operation to an SOSTInterface, which may not be declared at the point where the default trait's method is defined. Therefore, the default implementation of ControlInterface's isControl method simply calls this function.

Definition at line 42 of file HandshakeOps.cpp.

◆ lockRegion()

LogicalResult circt::handshake::lockRegion ( Region &  r,
OpBuilder &  rewriter 
)

Definition at line 25 of file LockFunctions.cpp.

References circt::BackedgeBuilder::get().

◆ lowerRegion()

template<typename TSrcTerm , typename TDstTerm >
LogicalResult circt::handshake::lowerRegion ( HandshakeLowering hl,
bool  sourceConstants,
bool  disableTaskPipelining,
Value  entryCtrl 
)

◆ partiallyLowerRegion()

LogicalResult circt::handshake::partiallyLowerRegion ( const RegionLoweringFunc loweringFunc,
MLIRContext *  ctx,
Region &  r 
)

Definition at line 189 of file CFToHandshake.cpp.

Referenced by lowerFuncOp(), and runPartialLowering().

◆ postDataflowConvert()

LogicalResult circt::handshake::postDataflowConvert ( Operation *  op)

Lowers the mlir operations into handshake that are not part of the dataflow conversion.

◆ removeBasicBlocks()

void circt::handshake::removeBasicBlocks ( Region &  r)

Remove basic blocks inside the given region.

This allows the result to be a valid graph region, since multi-basic block regions are not allowed to be graph regions currently.

Definition at line 218 of file CFToHandshake.cpp.

Referenced by lowerRegion().

◆ resolveInstanceGraph()

LogicalResult circt::handshake::resolveInstanceGraph ( ModuleOp  moduleOp,
InstanceGraph instanceGraph,
std::string &  topLevel,
SmallVectorImpl< std::string > &  sortedFuncs 
)

Iterates over the handshake::FuncOp's in the program to build an instance graph.

In doing so, we detect whether there are any cycles in this graph, as well as infer a top module for the design by performing a topological sort of the instance graph. The result of this sort is placed in sortedFuncs.

Definition at line 38 of file PassHelpers.cpp.

References assert().

◆ runPartialLowering()

template<typename T , typename... TArgs, typename... TArgs2>
LogicalResult circt::handshake::runPartialLowering ( T &  instance,
LogicalResult(T::*)(ConversionPatternRewriter &, TArgs2...)  memberFunc,
TArgs &...  args 
)

Definition at line 161 of file CFToHandshake.h.

References partiallyLowerRegion().

Referenced by lowerRegion().

◆ simulate()

bool circt::handshake::simulate ( llvm::StringRef  toplevelFunction,
llvm::ArrayRef< std::string >  inputArgs,
mlir::OwningOpRef< mlir::ModuleOp > &  module,
mlir::MLIRContext &  context 
)

◆ toValidType()

Type circt::handshake::toValidType ( Type  t)

Definition at line 157 of file PassHelpers.cpp.

References circt::calyx::direction::get(), circt::esi::innerType(), and tupleToStruct().

Referenced by esiWrapper().

◆ tupleToStruct()

static Type circt::handshake::tupleToStruct ( TupleType  tuple)
static

Definition at line 141 of file PassHelpers.cpp.

References circt::calyx::direction::get(), and circt::esi::innerType().

Referenced by esiWrapper(), and toValidType().

◆ verifyAllValuesHasOneUse()

LogicalResult circt::handshake::verifyAllValuesHasOneUse ( handshake::FuncOp  op)

Definition at line 110 of file PassHelpers.cpp.

Variable Documentation

◆ kPredeclarationAttr

constexpr const char* circt::handshake::kPredeclarationAttr = "handshake.module_name"
staticconstexpr

Definition at line 37 of file HandshakeToHW.h.