1

I want to test how the different auto schedulers work. I know there are 3 different auto schedulers: "Mullapudi2016" (the default auto scheduler), "Adams2019", and "Li2018". "Adams2019" is located in apps/autoscheduler (https://github.com/halide/Halide) and "Li2018" is located in gradient_autoscheduler. But how can I use one on a concrete pipeline (e.g. harris)? I tried to add a new map in Pipeline.cpp, like the following:

std::map<std::string, AutoSchedulerFn> &Pipeline::get_autoscheduler_map() {
    static std::map<std::string, AutoSchedulerFn> autoschedulers = {
        { "Mullapudi2016", auto_schedule_Mullapudi2016 },
        { "Admas2019", auto_schedule_Adams2019 }
    };
    return autoschedulers;
}

The definition of "auto_schedule_Adams2019" is similar to the "auto_schedule_Mullapudi2016", but just changes "generate_schedules" to "generate_schedule", which is already defined in "apps/autoscheduler/AutoSchedule.cpp"

void Pipeline::auto_schedule_Mullapudi2016(Pipeline pipeline, const Target &target,
                                           const MachineParams &arch_params, AutoSchedulerResults *outputs) {
    AutoSchedulerResults results;
    results.target = target;
    results.machine_params_string = arch_params.to_string();

    user_assert(target.arch == Target::X86 || target.arch == Target::ARM ||
                target.arch == Target::POWERPC || target.arch == Target::MIPS)
        << "The Mullapudi2016 autoscheduler is currently supported only on these architectures." << (int)target.arch;
    results.scheduler_name = "Mullapudi2016";
    results.schedule_source = generate_schedules(pipeline.contents->outputs, target, arch_params);
    // this autoscheduler has no featurization

    *outputs = results;
}

void Pipeline::auto_schedule_Adams2019(Pipeline pipeline, const Target &target,
                                       const MachineParams &arch_params, AutoSchedulerResults *outputs) {
    AutoSchedulerResults results;
    results.target = target;
    results.machine_params_string = arch_params.to_string();

    user_assert(target.arch == Target::X86 || target.arch == Target::ARM ||
                target.arch == Target::POWERPC || target.arch == Target::MIPS)
        << "The Mullapudi2016 autoscheduler is currently supported only on these architectures." << (int)target.arch;
    results.scheduler_name = "Adams2019";
    results.schedule_source = generate_schedule(pipeline.contents->outputs, target, arch_params);
    // this autoscheduler has no featurization

    *outputs = results;
}

Ideally, when I call auto_schedule in harris, I just need to give a scheduler name. But how can I connect the project "harris" with the auto scheduler "Adams2019" in "apps/autoscheduler"? I think that I need "auto_schedule.dll", which is compiled by the auto_schedule.

enter image description here

But unfortunately I don't know how to connect it to my project. Does someone have the same problem, or does someone know how to use the different auto schedulers?

Alex Reinking
  • 16,724
  • 5
  • 52
  • 86
WJ SHI
  • 13
  • 2

1 Answers1

1

Passing the -p flag to a generator binary gets it to load a plugin. The Li and Adams autoschedulers are built as plugins. The -s flag to the generator binary selects which autoscheduler to use from the ones that have been loaded. The Mullapudi autoscheduler is not a plugin, rather it's built-in, as you say.

All of this work was done on linux and mac, so I'm not sure if all the build system pieces are there for this to work well on windows. If you're comfortable with makefiles, take a look at 'make demo' in apps/autoscheduler to see how things work.

Andrew Adams
  • 1,396
  • 7
  • 3