test/correctness/hwbuffer.cpp
// Copy of Lower.cpp from the beginning to hwbuffer extraction
Copy of Lower.cpp from the beginning to hwbuffer extraction
Copy of Lower . cpp from the beginning to hwbuffer extraction
std::vector<HWXcel> lower_to_hwbuffer(const vector<Function> &output_funcs, const string &pipeline_name, const Target &t,
                                      const vector<Argument> &args) {
    std::vector<std::string> namespaces;
    std::string simple_pipeline_name = extract_namespaces(pipeline_name, namespaces);
    Module result_module(simple_pipeline_name, t);
    map<string, Function> env;
    for (Function f : output_funcs) {
        populate_environment(f, env);
    }
    vector<Function> outputs;
    std::tie(outputs, env) = deep_copy(output_funcs, env);
    bool any_strict_float = strictify_float(env, t);
    result_module.set_any_strict_float(any_strict_float);
    for (Function f: outputs) {
        Func(f).compute_root().store_root();
    }
    for (auto &iter : env) {
        iter.second.lock_loop_levels();
    }
    env = wrap_func_calls(env);
    vector<string> order;
    vector<vector<string>> fused_groups;
    std::tie(order, fused_groups) = realization_order(outputs, env);
    simplify_specializations(env);
    debug(1) << "Creating initial loop nests...\n";
    bool any_memoized = false;
    Stmt s = schedule_functions(outputs, fused_groups, env, t, any_memoized);
    if (any_memoized) {
        s = inject_memoization(s, env, pipeline_name, outputs);
    }
    s = inject_tracing(s, pipeline_name, env, outputs, t);
    s = add_parameter_checks(s, t);
    FuncValueBounds func_bounds = compute_function_value_bounds(order, env);
    s = add_image_checks(s, outputs, t, order, env, func_bounds);
    vector<BoundsInference_Stage> inlined_stages;
    s = bounds_inference(s, outputs, order, fused_groups, env, func_bounds, inlined_stages, t);
    for (auto stage : inlined_stages) {
      for (auto map_entry : stage.bounds) {
      }
    }
    s = remove_extern_loops(s);
    s = allocation_bounds_inference(s, env, func_bounds);
    debug(2) << "Lowering after allocation bounds inference:\n" << s << '\n';
    if (!t.has_feature(Target::HLS)) {
      s = sliding_window(s, env);
    }
    vector<HWXcel> xcels;
    if (t.has_feature(Target::CoreIR)) {
      xcels = extract_hw_accelerators(s, env, inlined_stages);
      for (auto hwbuffer : xcels.at(0).hwbuffers) {
      }
    }
    return xcels;
}
std :: vector < HWXcel > lower_to_hwbuffer ( const vector < Function > & output_funcs , const string & pipeline_name , const Target & t , const vector < Argument > & args ) { std :: vector < std :: string > namespaces ; std :: string simple_pipeline_name = extract_namespaces ( pipeline_name , namespaces ) ; Module result_module ( simple_pipeline_name , t ) ; map < string , Function > env ; for ( Function f : output_funcs ) { populate_environment ( f , env ) ; } vector < Function > outputs ; std :: tie ( outputs , env ) = deep_copy ( output_funcs , env ) ; bool any_strict_float = strictify_float ( env , t ) ; result_module . set_any_strict_float ( any_strict_float ) ; for ( Function f : outputs ) { Func ( f ) . compute_root ( ) . store_root ( ) ; } for ( auto & iter : env ) { iter . second . lock_loop_levels ( ) ; } env = wrap_func_calls ( env ) ; vector < string > order ; vector < vector < string > > fused_groups ; std :: tie ( order , fused_groups ) = realization_order ( outputs , env ) ; simplify_specializations ( env ) ; debug ( 1 ) << " \n " ; bool any_memoized = false ; Stmt s = schedule_functions ( outputs , fused_groups , env , t , any_memoized ) ; if ( any_memoized ) { s = inject_memoization ( s , env , pipeline_name , outputs ) ; } s = inject_tracing ( s , pipeline_name , env , outputs , t ) ; s = add_parameter_checks ( s , t ) ; FuncValueBounds func_bounds = compute_function_value_bounds ( order , env ) ; s = add_image_checks ( s , outputs , t , order , env , func_bounds ) ; vector < BoundsInference_Stage > inlined_stages ; s = bounds_inference ( s , outputs , order , fused_groups , env , func_bounds , inlined_stages , t ) ; for ( auto stage : inlined_stages ) { for ( auto map_entry : stage . bounds ) { } } s = remove_extern_loops ( s ) ; s = allocation_bounds_inference ( s , env , func_bounds ) ; debug ( 2 ) << " \n " << s << ' \n ' ; if ( ! t . has_feature ( Target :: HLS ) ) { s = sliding_window ( s , env ) ; } vector < HWXcel > xcels ; if ( t . has_feature ( Target :: CoreIR ) ) { xcels = extract_hw_accelerators ( s , env , inlined_stages ) ; for ( auto hwbuffer : xcels . at ( 0 ) . hwbuffers ) { } } return xcels ; }
Copy of Lower.cpp from the beginning to hwbuffer extraction
Copy of Lower . cpp from the beginning to hwbuffer extraction
// Compute an environment // Finalize all the LoopLevels // Compute the maximum and minimum possible value of each // function. Used in later bounds inference passes. // This pass injects nested definitions of variable names, so we // can't simplify statements from here until we fix them up. (We // can still simplify Exprs). //std::cout << "found stage: " << stage.name << std::endl; //std::cout << "  bounds for " << map_entry.first.first << " " << map_entry.second << std::endl; //std::cout << "Lowering after allocation bounds inference:\n" << s << '\n'; //std::cout << "sliding some windows\n"; //std::cout << "extracting hw buffers\n"; //std::cout << s << std::endl; //std::cout << hwbuffer.first << " is lower w/ inline=" << hwbuffer.second.is_inlined << std::endl;