Skip to content

Specializing the auto-schedule #3104

Open
@SanderVocke

Description

@SanderVocke

The current meaning of specialization in Halide seems to be: split generated implementations into two versions, in one of which a predicate can be deemed to hold during lowering. This may then lead to more efficient generated code where the predicate holds.

It could be very useful if specialization also allowed different schedules for the specialized calls.

An example of a typical use-case:
Suppose I wrote a simple convolutional filter. It may be applied in one direction on a 2D buffer, or on both. This obviously affects what the best schedule is going to be.
Currently, if I want to have a fast result, both for manual and automatic scheduling, I'm going to have to call my Generator once for each possibility (filter in X direction, filter in Y direction, filter in both directions), include the three implementations into my application and then make a switch case in the call-site to choose the correct one.

In the 3D case, this expands to many more implementations: filter X, filter Y, filter Z, filter XY, filter XZ, filter YZ, filter XYZ.

Ideally, I would just write my Halide code generically, and specify schedules for these specific cases. Or just put a specialize() there, and let the autoscheduler generate schedules for these specific cases.

Another possibility that may be a bit less cumbersome to implement would be: add some Generator magic that allows us to easily generate multiple implementations, and hide the run-time implementation selection in the generated code, much like how we can currently specify multiple targets and it selects the right one automatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    autoschedulerRelated to one or more of the Autoschedulers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions