Why is the Auto-Scheduler not generating vectorized loops in print_loop_nest()? #9158
-
|
I am experimenting with Halide's Auto-Scheduler. When I use func.print_loop_nest() to inspect the generated schedule, I notice that it only prints standard loop nests but completely lacks any vectorization (vectorized ...) or parallelization (parallel ...) annotations, even though the target hardware supports SIMD. I want to know if this is expected behavior, an issue with print_loop_nest()'s reporting under auto-scheduling, or if my auto-scheduler configuration is missing something. Here is my full Generator implementation: #include <Halide.h>
class ExampleGenerator : public Halide::Generator<ExampleGenerator>{
constexpr static int kSize = 1024;
Halide::Var x{"x"}, y{"y"};
public:
Input<Halide::Buffer<float, 2>> input{"input"};
Output<Halide::Buffer<float, 2>> output{"output"};
void generate() {
const Func clamped = Halide::BoundaryConditions::repeat_edge(input);
const RDom r(-1, 3, -1, 3);
const Func blur {"blur"};
blur(x, y) = 0.f;
blur(x, y) += clamped(x + r.x, y + r.y);
output(x, y) = blur(x, y) / 9.f;
}
void schedule() {
if (!using_autoscheduler()) {
output.compute_root()
.vectorize(x, 8)
.parallel(y, 8);
}
else {
input.dim(0).set_estimate(0, kSize);
input.dim(1).set_estimate(0, kSize);
output.set_estimate(x, 0, kSize);
output.set_estimate(y, 0, kSize);
}
output.print_loop_nest();
}
};
HALIDE_REGISTER_GENERATOR(ExampleGenerator, example_generator)
Case 1: Manual Scheduling Case 2: Auto-Scheduling (using Adams2019) Environment:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
|
That's odd. Does the .stmt output show vectorization and parallelization? |
Beta Was this translation helpful? Give feedback.
That's still too early when using a generator. You need to ask for stmt/stmt_html as extra outputs. At the command line for the generator executable, thats the -e flag.