Ignore:
Timestamp:
Sep 14, 2016, 2:56:54 PM (3 years ago)
Author:
nmedfort
Message:

Work on multiplexing and distribution passes + a few AST modification bug fixes.

File:
1 edited

Legend:

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

    r5119 r5156  
    88#include <boost/graph/adjacency_matrix.hpp>
    99#include <boost/container/flat_set.hpp>
    10 #include <boost/container/flat_map.hpp>
    11 #include <boost/numeric/ublas/matrix.hpp>
    12 #include <random>
    1310#include <stdint.h>
    1411#include <llvm/ADT/DenseMap.h>
    15 #include <llvm/ADT/DenseSet.h>
    16 #include <llvm/ADT/SmallVector.h>
    1712#include <z3.h>
    18 #include <stack>
    1913
    2014namespace pablo {
     
    2519class MultiplexingPass {
    2620
    27     using CharacterizationRef = std::pair<Z3_ast, unsigned>;
     21    using CharacterizationRef = std::pair<Z3_ast, size_t>;
    2822    using CharacterizationMap = llvm::DenseMap<const PabloAST *, CharacterizationRef>;
    2923
    30     using ConstraintGraph = boost::adjacency_matrix<boost::undirectedS, Advance *>;
     24    enum class ConstraintType : uint8_t {
     25        Dependency,
     26        Inclusive
     27    };
     28
     29    using ConstraintGraph = boost::adjacency_matrix<boost::undirectedS, Advance *, ConstraintType>;
    3130    using ConstraintVertex = ConstraintGraph::vertex_descriptor;
    3231    using Constraints = std::vector<ConstraintVertex>;
    33     using ConstraintMap = boost::container::flat_map<Advance *, ConstraintVertex>;
    34 
    35     using RNG = std::mt19937;
    36     using IntDistribution = std::uniform_int_distribution<RNG::result_type>;
    3732
    3833    using CandidateGraph = boost::adjacency_list<boost::setS, boost::vecS, boost::undirectedS>;
     
    4136    using SubsetGraph = boost::adjacency_list<boost::hash_setS, boost::vecS, boost::bidirectionalS>;
    4237
    43     using CliqueGraph = boost::adjacency_list<boost::hash_setS, boost::vecS, boost::undirectedS>;
    44     using CliqueSet = boost::container::flat_set<CliqueGraph::vertex_descriptor>;
    45     using CliqueSets = boost::container::flat_set<std::vector<CliqueGraph::vertex_descriptor>>;
    46 
    47     using AdvanceVector = std::vector<Advance *>;
    48     using AdvanceRank = std::vector<int>;
    4938    using AdvanceVariable = std::vector<Z3_ast>;
    5039
     
    6251    void optimize();
    6352    void optimize(PabloBlock * const block);
    64     Z3_ast characterize(Statement * const stmt);
    65     Z3_ast characterize(Advance * const adv, Z3_ast Ik);
     53    Z3_ast characterize(const Statement * const stmt, const bool deref = true);
     54    Z3_ast characterize(const Advance * const adv, Z3_ast Ik);
    6655    void multiplex(PabloBlock * const block, Statement * const begin, Statement * const end);
    6756
     
    7766
    7867
    79     Z3_ast make(const PabloAST * const expr);
    80     Z3_ast add(const PabloAST * const expr, Z3_ast node);
     68    Z3_ast makeVar();
     69    Z3_ast add(const PabloAST * const expr, Z3_ast node, const size_t refs);
    8170    Z3_ast & get(const PabloAST * const expr, const bool deref = false);
    8271    bool equals(Z3_ast a, Z3_ast b);
    8372
    84     MultiplexingPass(PabloFunction & f, const RNG::result_type seed, Z3_context context, Z3_solver solver);
     73    MultiplexingPass(PabloFunction & f, Z3_context context, Z3_solver solver);
    8574
    8675private:
     
    8978    Z3_solver                   mSolver;
    9079    PabloFunction &             mFunction;
    91     RNG                         mRNG;
    9280
    9381    CharacterizationMap         mCharacterization;
Note: See TracChangeset for help on using the changeset viewer.