CIRCT  20.0.0git
Classes | Public Member Functions | Private Attributes | List of all members
circt::pipelinetocalyx::LoopScheduleToCalyxPass Class Reference
Inheritance diagram for circt::pipelinetocalyx::LoopScheduleToCalyxPass:
Inheritance graph
[legend]
Collaboration diagram for circt::pipelinetocalyx::LoopScheduleToCalyxPass:
Collaboration graph
[legend]

Classes

struct  LoweringPattern
 

Public Member Functions

 LoopScheduleToCalyxPass ()
 
void runOnOperation () override
 
LogicalResult setTopLevelFunction (mlir::ModuleOp moduleOp, std::string &topLevelFunction)
 
LogicalResult labelEntryPoint (StringRef topLevelFunction)
 Labels the entry point of a Calyx program. More...
 
template<typename TPattern , typename... PatternArgs>
void addOncePattern (SmallVectorImpl< LoweringPattern > &patterns, PatternArgs &&...args)
 'Once' patterns are expected to take an additional LogicalResult& argument, to forward their result state (greedyPatternRewriteDriver results are skipped for Once patterns). More...
 
template<typename TPattern , typename... PatternArgs>
void addGreedyPattern (SmallVectorImpl< LoweringPattern > &patterns, PatternArgs &&...args)
 
LogicalResult runPartialPattern (RewritePatternSet &pattern, bool runOnce)
 

Private Attributes

LogicalResult partialPatternRes
 
std::shared_ptr< calyx::CalyxLoweringStateloweringState = nullptr
 

Detailed Description

Definition at line 1394 of file LoopScheduleToCalyx.cpp.

Constructor & Destructor Documentation

◆ LoopScheduleToCalyxPass()

circt::pipelinetocalyx::LoopScheduleToCalyxPass::LoopScheduleToCalyxPass ( )
inline

Definition at line 1397 of file LoopScheduleToCalyx.cpp.

Member Function Documentation

◆ addGreedyPattern()

template<typename TPattern , typename... PatternArgs>
void circt::pipelinetocalyx::LoopScheduleToCalyxPass::addGreedyPattern ( SmallVectorImpl< LoweringPattern > &  patterns,
PatternArgs &&...  args 
)
inline

Definition at line 1491 of file LoopScheduleToCalyx.cpp.

◆ addOncePattern()

template<typename TPattern , typename... PatternArgs>
void circt::pipelinetocalyx::LoopScheduleToCalyxPass::addOncePattern ( SmallVectorImpl< LoweringPattern > &  patterns,
PatternArgs &&...  args 
)
inline

'Once' patterns are expected to take an additional LogicalResult& argument, to forward their result state (greedyPatternRewriteDriver results are skipped for Once patterns).

Definition at line 1482 of file LoopScheduleToCalyx.cpp.

References partialPatternRes.

◆ labelEntryPoint()

LogicalResult circt::pipelinetocalyx::LoopScheduleToCalyxPass::labelEntryPoint ( StringRef  topLevelFunction)
inline

Labels the entry point of a Calyx program.

Furthermore, this function performs validation on the input function, to ensure that we've implemented the capabilities necessary to convert it.

Definition at line 1438 of file LoopScheduleToCalyx.cpp.

References circt::calyx::applyModuleOpConversion().

◆ runOnOperation()

void circt::pipelinetocalyx::LoopScheduleToCalyxPass::runOnOperation ( )
override

Start conversion


If you are a developer, it may be helpful to add a 'getOperation()->dump()' call after the execution of each stage to

view the transformations that's going on.

A mapping is maintained between a function operation and its corresponding Calyx component.

Creates a new Calyx component for each FuncOp in the inpurt module.

This pattern converts all index typed values to an i32 integer.

This pattern creates registers for all basic-block arguments.

This pattern creates registers for the function return values.

This pattern creates registers for iteration arguments of scf.while operations. Additionally, creates a group for assigning the initial value of the iteration argument registers.

This pattern creates registers for all pipeline stages.

This pattern converts operations within basic blocks to Calyx library operators. Combinational operations are assigned inside a calyx::CombGroupOp, and sequential inside calyx::GroupOps. Sequential groups are registered with the Block* of which the operation originated from. This is used during control schedule generation. By having a distinct group for each operation, groups are analogous to SSA values in the source program.

This pattern creates groups for all pipeline stages.

This pattern traverses the CFG of the program and generates a control schedule based on the calyx::GroupOp's which were registered for each basic block in the source function.

This pass recursively inlines use-def chains of combinational logic (from non-stateful groups) into groups referenced in the control schedule.

This pattern performs various SSA replacements that must be done after control generation.

Eliminate any unused combinational groups. This is done before calyx::RewriteMemoryAccesses to avoid inferring slice components for groups that will be removed.

This pattern rewrites accesses to memories which are too wide due to index types being converted to a fixed-width integer type.

This pattern removes the source FuncOp which has now been converted into a Calyx component.

Sequentially apply each lowering pattern.

Definition at line 1526 of file LoopScheduleToCalyx.cpp.

References circt::calyx::direction::get(), circt::calyx::getCiderSourceLocationMetadata(), loweringState, and partialPatternRes.

◆ runPartialPattern()

LogicalResult circt::pipelinetocalyx::LoopScheduleToCalyxPass::runPartialPattern ( RewritePatternSet &  pattern,
bool  runOnce 
)
inline

Can't return applyPatternsAndFoldGreedily. Root isn't necessarily erased so it will always return failed(). Instead, forward the 'succeeded' value from PartialLoweringPatternBase.

Definition at line 1499 of file LoopScheduleToCalyx.cpp.

References assert(), partialPatternRes, and pattern.

◆ setTopLevelFunction()

LogicalResult circt::pipelinetocalyx::LoopScheduleToCalyxPass::setTopLevelFunction ( mlir::ModuleOp  moduleOp,
std::string &  topLevelFunction 
)
inline

No top level function set; infer top level if the module only contains a single function, else, throw error.

Definition at line 1402 of file LoopScheduleToCalyx.cpp.

Member Data Documentation

◆ loweringState

std::shared_ptr<calyx::CalyxLoweringState> circt::pipelinetocalyx::LoopScheduleToCalyxPass::loweringState = nullptr
private

Definition at line 1523 of file LoopScheduleToCalyx.cpp.

◆ partialPatternRes

LogicalResult circt::pipelinetocalyx::LoopScheduleToCalyxPass::partialPatternRes
private

Definition at line 1522 of file LoopScheduleToCalyx.cpp.


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