Ignore:
Timestamp:
Dec 23, 2015, 4:28:42 PM (3 years ago)
Author:
nmedfort
Message:

Work on lowering + minor bug fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/schedulingprepass.cpp

    r4896 r4899  
    44#include <boost/container/flat_set.hpp>
    55#include <pablo/analysis/pabloverifier.hpp>
     6
     7#include <pablo/printer_pablos.h>
     8#include <iostream>
    69
    710using namespace boost;
     
    3841}
    3942
     43///** ------------------------------------------------------------------------------------------------------------- *
     44// * @brief printGraph
     45// ** ------------------------------------------------------------------------------------------------------------- */
     46//template <typename Graph>
     47//static void printGraph(const Graph & G, const std::vector<unsigned> & ordering, const std::string name, raw_ostream & out) {
     48//    out << "*******************************************\n";
     49//    out << "digraph " << name << " {\n";
     50//    for (auto u : make_iterator_range(vertices(G))) {
     51//        out << "v" << u << " [label=\"" << ordering[u] << " : ";
     52//        PabloPrinter::print(G[u], out);
     53//        out << "\"];\n";
     54//    }
     55//    for (auto e : make_iterator_range(edges(G))) {
     56//        out << "v" << source(e, G) << " -> v" << target(e, G);
     57//        out << ";\n";
     58//    }
     59
     60//    out << "}\n\n";
     61//    out.flush();
     62//}
     63
    4064/** ------------------------------------------------------------------------------------------------------------- *
    4165 * @brief schedule
     
    6286                    auto v = M.find(op);
    6387                    assert (v != M.end());
     88                    assert (v->second != u);
    6489                    add_edge(v->second, u, G);
    6590                } else if (isa<Assign>(op) || isa<Next>(op)) {
     
    7499                            auto v = M.find(s->second);
    75100                            assert (v != M.end());
    76                             add_edge(v->second, u, G);
     101                            if (v->second != u) {
     102                                add_edge(v->second, u, G);
     103                            }
    77104                            break;
    78105                        }
     
    101128    circular_buffer<Vertex> Q(num_vertices(G));
    102129    for (const Vertex u : make_iterator_range(vertices(G))) {
    103         if (out_degree(u, G) == 0 && in_degree(u, G) != 0) {
     130        if (out_degree(u, G) == 0) {
    104131            ordering[u] = 1;
    105132            Q.push_back(u);
     
    139166    for (const Vertex u : make_iterator_range(vertices(G))) {
    140167        if (in_degree(u, G) == 0) {
    141             assert (out_degree(u, G) > 0);
    142168            readySet.emplace_back(ordering[u], u);
    143169        }
     
    153179
    154180    block->setInsertPoint(nullptr);
     181
    155182
    156183    // Rewrite the AST using the bottom-up ordering
     
    195222        readySet.erase(chosen);
    196223
    197         assert (weight > 0);
     224        assert ("Error: SchedulingPrePass is attempting to reschedule a statement!" && (weight > 0));
    198225
    199226        // insert the statement then mark it as written ...
Note: See TracChangeset for help on using the changeset viewer.