Ignore:
Timestamp:
Feb 21, 2016, 1:05:57 PM (4 years ago)
Author:
nmedfort
Message:

Check in of misc changes prior to symbol table work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/pablo_automultiplexing.hpp

    r4927 r4937  
    2424
    2525    using CharacterizationMap = llvm::DenseMap<const PabloAST *, BDD>;
     26
    2627    using ConstraintGraph = boost::adjacency_matrix<boost::directedS>;
    2728    using ConstraintVertex = ConstraintGraph::vertex_descriptor;
     29    using Constraints = std::vector<ConstraintVertex>;
     30
    2831    using RNG = std::mt19937;
    2932    using IntDistribution = std::uniform_int_distribution<RNG::result_type>;
    30     using MultiplexSetGraph = boost::adjacency_list<boost::hash_setS, boost::vecS, boost::bidirectionalS>;
    31     using MultiplexVector = std::vector<MultiplexSetGraph::vertex_descriptor>;
     33
     34    using CandidateGraph = boost::adjacency_list<boost::hash_setS, boost::vecS, boost::undirectedS>;
     35    using Candidates = std::vector<CandidateGraph::vertex_descriptor>;
     36
    3237    using SubsetGraph = boost::adjacency_list<boost::hash_setS, boost::vecS, boost::bidirectionalS>;
    33     using SubsetEdgeIterator = boost::graph_traits<SubsetGraph>::edge_iterator;
     38
    3439    using CliqueGraph = boost::adjacency_list<boost::hash_setS, boost::vecS, boost::undirectedS>;
    3540    using CliqueSet = boost::container::flat_set<CliqueGraph::vertex_descriptor>;
    3641    using CliqueSets = boost::container::flat_set<std::vector<CliqueGraph::vertex_descriptor>>;
    37     using OrderingGraph = boost::adjacency_list<boost::hash_setS, boost::vecS, boost::bidirectionalS, Statement *>;
    38     using OrderingMap = boost::container::flat_map<const Statement *, OrderingGraph::vertex_descriptor>;
    3942
    4043    using AdvanceVector = std::vector<Advance *>;
    4144    using AdvanceDepth = std::vector<int>;
    4245    using AdvanceVariable = std::vector<BDD>;
    43     using VertexVector = std::vector<ConstraintVertex>;
    4446
    4547public:
    4648
    47     static bool optimize(PabloFunction & function, const unsigned limit = std::numeric_limits<unsigned>::max(), const unsigned maxSelections = 100, const unsigned windowSize = 1, const bool independent = false);
     49    static bool optimize(PabloFunction & function, const bool independent = false);
    4850    #ifdef PRINT_TIMING_INFORMATION
    4951    using seed_t = RNG::result_type;
     
    6971
    7072    bool generateCandidateSets();
    71     void addCandidateSet(const VertexVector & S);
    72     void selectMultiplexSets();
     73    void addCandidateSet(const Constraints & S);
     74    void updateCandidateSet(ConstraintVertex * const begin, ConstraintVertex * const end);
     75    void selectCandidateSet(const unsigned n, const unsigned k, const unsigned m, const Constraints & S, ConstraintVertex * const element);
     76
     77    void selectMultiplexSetsGreedy();
     78    void selectMultiplexSetsWorkingSet();
    7379
    7480    void eliminateSubsetConstraints();
    7581    void doTransitiveReductionOfSubsetGraph();
    7682
    77     MultiplexVector orderMultiplexSet(const MultiplexSetGraph::vertex_descriptor u);
     83    Candidates orderMultiplexSet(const CandidateGraph::vertex_descriptor u);
    7884    void multiplexSelectedSets(PabloFunction & function);
    7985
    80     static void topologicalSort(PabloBlock * const block);
    81     static void topologicalSort(const OrderingGraph::vertex_descriptor u, const PabloBlock * const block, const Statement * const stmt, OrderingGraph & G, OrderingMap & M);
     86    static void rewriteAST(PabloBlock * const block);
    8287
    8388    BDD & get(const PabloAST * const expr);
    8489
    85     inline MultiplexingPass(const RNG::result_type seed, const unsigned limit, const unsigned maxSelections, const unsigned windowSize)
    86     : mMultiplexingSetSizeLimit(limit)
    87     , mMaxMultiplexingSetSelections(maxSelections)
    88     , mWindowSize(windowSize)
    89     , mTestConstrainedAdvances(true)
     90    inline MultiplexingPass(const RNG::result_type seed)
     91    : mTestConstrainedAdvances(true)
    9092    , mSubsetImplicationsAdhereToWindowingSizeConstraint(false)
    9193    , mVariables(0)
     
    9395    , mConstraintGraph(0)
    9496    , mAdvance(0, nullptr)
    95     , mAdvanceDepth(0, 0)
     97    , mAdvanceRank(0, 0)
    9698    , mAdvanceNegatedVariable(0, 0)
    9799    {
     
    100102
    101103private:
    102     const unsigned              mMultiplexingSetSizeLimit;
    103     const unsigned              mMaxMultiplexingSetSelections;
    104     const unsigned              mWindowSize;
    105104    const bool                  mTestConstrainedAdvances;
    106105    const bool                  mSubsetImplicationsAdhereToWindowingSizeConstraint;
     
    110109    ConstraintGraph             mConstraintGraph;   
    111110    AdvanceVector               mAdvance;
    112     AdvanceDepth                mAdvanceDepth;
     111    AdvanceDepth                mAdvanceRank;
    113112    AdvanceVariable             mAdvanceNegatedVariable;
    114113    SubsetGraph                 mSubsetGraph;
    115114    CliqueGraph                 mUsageGraph;
    116     MultiplexSetGraph           mMultiplexSetGraph;
     115    CandidateGraph           mCandidateGraph;
    117116};
    118117
Note: See TracChangeset for help on using the changeset viewer.