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)
 Converts 't' into a valid HW type. More...
 
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 ()
 
std::unique_ptr< mlir::Pass > createHandshakeSplitMergesPass ()
 
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)
 Checks all block arguments and values within op to ensure that all values have exactly one use. More...
 
esi::ChannelType esiWrapper (Type t)
 Wraps a type into an ESI ChannelType type. More...
 
hw::ModulePortInfo getPortInfoForOpTypes (mlir::Operation *op, TypeRange inputs, TypeRange outputs)
 Returns the hw::ModulePortInfo that corresponds to the given handshake operation and its in- and output types. More...
 
void insertFork (Value result, bool isLazy, OpBuilder &rewriter)
 Adds fork operations to any value with multiple uses in r. More...
 
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)
 

Variables

static constexpr const char * kPredeclarationAttr = "handshake.module_name"
 Attribute name for the name of a predeclaration of the to-be-lowered hw.module from a handshake function. More...
 

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 25 of file HandshakeUtils.h.

◆ RegionLoweringFunc

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

Definition at line 42 of file CFToHandshake.h.

Function Documentation

◆ createHandshakeAddIDsPass()

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

Definition at line 631 of file Analysis.cpp.

◆ createHandshakeDematerializeForksSinksPass()

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

Definition at line 143 of file Materialization.cpp.

◆ createHandshakeDotPrintPass()

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

Definition at line 622 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 225 of file Buffers.cpp.

References strategy.

◆ createHandshakeLegalizeMemrefsPass()

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

Definition at line 101 of file LegalizeMemrefs.cpp.

◆ createHandshakeLockFunctionsPass()

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

Definition at line 94 of file LockFunctions.cpp.

◆ createHandshakeLowerExtmemToHWPass()

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

Definition at line 489 of file LowerExtmemToHW.cpp.

◆ createHandshakeMaterializeForksSinksPass()

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

Definition at line 138 of file Materialization.cpp.

◆ createHandshakeOpCountPass()

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

Definition at line 627 of file Analysis.cpp.

◆ createHandshakeRemoveBuffersPass()

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

Definition at line 220 of file Buffers.cpp.

◆ createHandshakeSplitMergesPass()

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

Definition at line 142 of file SplitMerges.cpp.

◆ esiWrapper()

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

Wraps a type into an ESI ChannelType type.

The inner type is converted to ensure comprehensability by the RTL dialects.

Definition at line 271 of file HandshakeUtils.cpp.

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

◆ 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()

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

Returns the hw::ModulePortInfo that corresponds to the given handshake operation and its in- and output types.

Referenced by getPortInfoForOp().

◆ insertFork()

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

Adds fork operations to any value with multiple uses in r.

Definition at line 247 of file HandshakeUtils.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.

◆ 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 196 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 225 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 35 of file HandshakeUtils.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 171 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)

Converts 't' into a valid HW type.

This is strictly used for converting 'index' types into a fixed-width type.

Definition at line 154 of file HandshakeUtils.cpp.

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

Referenced by esiWrapper().

◆ verifyAllValuesHasOneUse()

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

Checks all block arguments and values within op to ensure that all values have exactly one use.

Definition at line 107 of file HandshakeUtils.cpp.

Variable Documentation

◆ kPredeclarationAttr

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

Attribute name for the name of a predeclaration of the to-be-lowered hw.module from a handshake function.

Definition at line 37 of file HandshakeUtils.h.