halide / Halide

a language for fast, portable data-parallel computation
https://halide-lang.org
Other
5.86k stars 1.07k forks source link

Wrong error message when trying to hoist_storage() out a parallel for. #8239

Open mcourteaux opened 4 months ago

mcourteaux commented 4 months ago
Var x, y;
Func f;
f(x, y) = ...;

Func g;
g(x, y) = f(x, y) * 2;

g.compute_root().parallel(y);

f.compute_at(g, y).hoist_storage_root();

This sort of code starts rambling about something like:

Error: Func "f" is computed at the following invalid location:
  f.compute_at(g, y)
Legal locations for this function are:
  f.compute_root();
  f.compute_at(g, y);

Confusing, because it's telling you what to do, and you already did that. Right above this error, it also prints the correct error about hoisting outside of a parallel for, but that's a one-liner error, which is very subtle compared to this big and incorrect multi-line error.

@vksnk