4 ms·
Thanks for bringing up specialized optimization tools such as Halide. Recently there's been a proliferation of domain-specific languages targeting this automati
by throwaway_26758 10y ago
Thanks for bringing up specialized optimization tools such as Halide. Recently there's been a proliferation of domain-specific languages targeting this automatic optimization-from-intentions paradigm. While it's great for testing new ideas isolated from the complexity of modern day compiling suites (academic excursions), actually devoting your codebase to these tools is a huge burden for future maintainability, and eliminates the possibility of future improvements provided outside the small development effort of a single academic group.
Many of the techniques given here (and elsewhere in the glut of DSLs) are quietly folded into mainstream C compilers within a short timeframe -- first as requiring explicit hints just like the DSLs, then secondly simplified to allow the compiler to automatically infer hints from well-structured code relying on transformation guarantees of standard C idioms.
So if you stick with strict C and come to understand the implicit assumptions/guarantees the standard dictates while conveying structure in your code, in time the compiler suites will march forward in improvements that come with each update 'for free.'
And most importantly, update your testing infrastructure to be formally verified each refactoring (such as with CBMC) so that there's no regression problems caused by compiler updates with free reign!
- paulsutter 10y agoMemory access dominates performance issues, and memory access patterns are mostly pre-determined when a C developer chooses data structures. This limits the optimizations a C optimizer can perform. Halide gives the optimizer control over a broader set of design decisions. While the image-processing focus limits Halide (I wish it were designed for neural nets and embedded in Tensorflow), the lessons here are powerful and have potential that go beyond C compiler improvements.
- dharma1 10y agoYou could use Halide some neural net uses I guess - like writing convolution kernels? Though (I'm not an expert on the subject) but it seems like high perf convnet kernels requires assembly for specific architectures - like Scott Gray's fast Winograd kernels optimised for NVidia. Woukd be awesome if someone wrote fast conv kernels for AMD GPUs but it seems like a lot of effort