Skip to content

Commit

Permalink
Add an env var to enable the scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
pfultz2 committed Mar 26, 2019
1 parent 8b6a5cd commit 458ec14
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/include/migraphx/schedule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct program;
struct schedule
{
schedule_model model{};
bool enable = true;
std::string name() const { return "schedule"; }
void apply(program& p) const;
};
Expand Down
2 changes: 2 additions & 0 deletions src/schedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ struct stream_info

void schedule::apply(program& p) const
{
if (not enable)
return;
stream_info si;
auto last = std::prev(p.end());
si.accumulate_weights(last, model);
Expand Down
4 changes: 3 additions & 1 deletion src/targets/gpu/target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {

MIGRAPHX_DECLARE_ENV_VAR(MIGRAPHX_ENABLE_SCHEDULE_PASS)

std::vector<pass> target::get_passes(migraphx::context& gctx) const
{
auto& ctx = any_cast<context>(gctx);
Expand Down Expand Up @@ -53,7 +55,7 @@ std::vector<pass> target::get_passes(migraphx::context& gctx) const
fuse_ops{&ctx},
dead_code_elimination{},
write_literals{&ctx},
schedule{gpu::schedule_model{ctx.get_current_device().nstreams()}},
schedule{gpu::schedule_model{ctx.get_current_device().nstreams()}, enabled(MIGRAPHX_ENABLE_SCHEDULE_PASS{})},
memory_coloring{"hip::allocate"},
dead_code_elimination{},
eliminate_workspace{},
Expand Down

0 comments on commit 458ec14

Please sign in to comment.