halide / Halide

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

print() and print_when() could be more ergonomic to use #8176

Open steven-johnson opened 6 months ago

steven-johnson commented 6 months ago

These are great and essential tools for debugging, but they could be a lot better:

Thought: what if we added a scheduling directive for print_when() that would inject the print when the func is evaluated? (No need for print() since that's just print_when(true))? And added some optional controls via env var (eg print_when_env("ENV_VAR_NAME")?)

abadams commented 6 months ago

So an unconditional print is just Func::trace_stores. We could add an optional boolean Expr arg to it?

steven-johnson commented 6 months ago

So an unconditional print is just Func::trace_stores. We could add an optional boolean Expr arg to it?

Yes and know; when I use these for debugging I usually also want to print other data too