halide / Halide

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

RunGenMain.cpp compiles slowly and generates huge object file #3578

Open steven-johnson opened 5 years ago

steven-johnson commented 5 years ago

It appears the likely culprit is rampant template specialization explosion in halide_image_io.h; RunGenMain.o can be >3MB and take > 10s of seconds to compile on some systems.

shoaibkamil commented 5 years ago

For --benchmarks=all, it might also be useful to have RunGen be compilable without halide_image_io.h.

steven-johnson commented 5 years ago

From a cursory examination, it appears the problem is compounded by some of the template usage in HalideBuffer.h itself; in particular, for_each_value() instantiates a bunch of templated helper functions which differ if you pass in extra buffers as optional arguments; halide_image_io::convert_image() instantiates the full crossproduct of possible buffer types for doing conversions.

steven-johnson commented 5 years ago

...ugh, and also: RunGenMain.o in the standard Makefile builds with debug info enabled and without optimization enabled.