CIRCT 22.0.0git
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
circt::synth::CutSet Class Reference

Manages a collection of cuts for a single logic node using priority cuts algorithm. More...

#include <CutRewriter.h>

Collaboration diagram for circt::synth::CutSet:
Collaboration graph
[legend]

Public Member Functions

bool isMatched () const
 Check if this cut set has a valid matched pattern.
 
CutgetBestMatchedCut () const
 Get the cut associated with the best matched pattern.
 
void finalize (const CutRewriterOptions &options, llvm::function_ref< std::optional< MatchedPattern >(const Cut &)> matchCut)
 Finalize the cut set by removing duplicates and selecting the best pattern.
 
unsigned size () const
 Get the number of cuts in this set.
 
void addCut (Cut cut)
 Add a new cut to this set.
 
ArrayRef< CutgetCuts () const
 Get read-only access to all cuts in this set.
 

Private Attributes

llvm::SmallVector< Cut, 4 > cuts
 Collection of cuts for this node.
 
CutbestCut = nullptr
 
bool isFrozen = false
 Whether cut set is finalized.
 

Detailed Description

Manages a collection of cuts for a single logic node using priority cuts algorithm.

Each node in the combinational logic network can have multiple cuts representing different ways to group it with surrounding logic. The CutSet manages these cuts and selects the best one based on the optimization strategy (area or timing).

The priority cuts algorithm maintains a bounded set of the most promising cuts to avoid exponential explosion while ensuring good optimization results.

Definition at line 188 of file CutRewriter.h.

Member Function Documentation

◆ addCut()

void CutSet::addCut ( Cut  cut)

Add a new cut to this set.

NOTE: The cut set must not be frozen

Definition at line 442 of file CutRewriter.cpp.

References assert(), cuts, and isFrozen.

◆ finalize()

void CutSet::finalize ( const CutRewriterOptions options,
llvm::function_ref< std::optional< MatchedPattern >(const Cut &)>  matchCut 
)

Finalize the cut set by removing duplicates and selecting the best pattern.

This method:

  1. Removes duplicate cuts based on inputs and root operation
  2. Limits the number of cuts to prevent exponential growth
  3. Matches each cut against available patterns
  4. Selects the best pattern based on the optimization strategy

Definition at line 509 of file CutRewriter.cpp.

References assert(), bestCut, cuts, circt::synth::Cut::getMatchedPattern(), isFrozen, circt::synth::CutRewriterOptions::maxCutInputSize, circt::synth::CutRewriterOptions::maxCutSizePerRoot, and removeDuplicateAndNonMinimalCuts().

◆ getBestMatchedCut()

Cut * CutSet::getBestMatchedCut ( ) const

Get the cut associated with the best matched pattern.

Definition at line 438 of file CutRewriter.cpp.

References bestCut.

◆ getCuts()

ArrayRef< Cut > CutSet::getCuts ( ) const

Get read-only access to all cuts in this set.

Definition at line 447 of file CutRewriter.cpp.

References cuts.

◆ isMatched()

bool circt::synth::CutSet::isMatched ( ) const
inline

Check if this cut set has a valid matched pattern.

Definition at line 196 of file CutRewriter.h.

References bestCut.

◆ size()

unsigned CutSet::size ( ) const

Get the number of cuts in this set.

Definition at line 440 of file CutRewriter.cpp.

References cuts.

Referenced by esiaccel.types.ArrayType::bit_width(), esiaccel.types.ArrayType::deserialize(), and esiaccel.types.ArrayType::is_valid().

Member Data Documentation

◆ bestCut

Cut* circt::synth::CutSet::bestCut = nullptr
private

Definition at line 191 of file CutRewriter.h.

Referenced by finalize(), getBestMatchedCut(), and isMatched().

◆ cuts

llvm::SmallVector<Cut, 4> circt::synth::CutSet::cuts
private

Collection of cuts for this node.

Definition at line 190 of file CutRewriter.h.

Referenced by addCut(), finalize(), getCuts(), and size().

◆ isFrozen

bool circt::synth::CutSet::isFrozen = false
private

Whether cut set is finalized.

Definition at line 192 of file CutRewriter.h.

Referenced by addCut(), and finalize().


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