halide / Halide

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

Export bounds from pipelines symbolically #8036

Open dsharlet opened 7 months ago

dsharlet commented 7 months ago

Currently, Halide pipelines support bounds queries, but this is a weaker form of understanding bounds than having symbolic expressions that exist internally in Halide.

One way of exporting these for use in Halide runtime code would be to define a function along side the pipeline that only computes bounds, much like a bounds query if defined for integer parameters. But if this function existed as a template, where the type of an index/bound could be customized, that would allow generating symbolic expressions for the bounds, assuming the type supports all the standard Halide expressions (arithmetic, min/max, etc.).

abadams commented 7 months ago

To consider: you want to inspect these symbolic bounds from python, which may make a C++ template approach questionable.

abadams commented 7 months ago

@derek-gerstmann

steven-johnson commented 7 months ago

To consider: you want to inspect these symbolic bounds from python, which may make a C++ template approach questionable.

It might be helpful to offer a strawman representation that might be useful for the target usage case.

abadams commented 7 months ago

Probably massive overkill, but: a function that returns the .stmt, expressed in some easy-to-interpret bytecode.