Skip to content

Commit

Permalink
Redefine schedule_map to apply a schedule per-update
Browse files Browse the repository at this point in the history
  • Loading branch information
jrk committed Feb 25, 2014
1 parent cc194c9 commit cde83f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion ApplySchedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ void apply_schedule(const schedule_map &schedules, Func root) {
{
fprintf(stderr, "Apply schedule to %s\n", it->first.c_str());
assert(functions.count(it->first));
functions[it->first].schedule() = it->second;
functions[it->first].schedule() = it->second[0];
for (size_t r = 0; r < functions[it->first].reductions().size(); r++) {
functions[it->first].reduction_schedule(r) = it->second[r+1];
}
}
}
2 changes: 1 addition & 1 deletion ApplySchedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <Halide.h>

typedef std::map<std::string, Halide::Internal::Schedule> schedule_map;
typedef std::map<std::string, std::vector<Halide::Internal::Schedule> > schedule_map;

void apply_schedule(const schedule_map &schedules, Halide::Func root);

Expand Down
8 changes: 6 additions & 2 deletions test/halide_blur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ int main(int argc, char **argv) {
dim.for_type = Internal::For::Serial;
s.dims.push_back(dim);

scheds["blur_x"] = s;
scheds["blur_x"] = vec(s);
}

/* things to load:
- compute level, store level
- split
*/
{
// Fastest way to build split, storage, dims lists:
Func f; Var x("x"), y("y"), xi("xi"), yi("yi");
Expand All @@ -43,7 +47,7 @@ int main(int argc, char **argv) {
// Func f("blur_y");
// g.compute_at(f, x); // x can be shadowed, blur_y can't

scheds["blur_y"] = f.function().schedule();
scheds["blur_y"] = vec(f.function().schedule());
}

ImageParam input(UInt(16), 2, "input");
Expand Down

0 comments on commit cde83f7

Please sign in to comment.