3 ms·
The compiler will sometimes do this transpose for you, but as with all compiler optimizations it might sometimes break.
by dralley 5y ago
The compiler will sometimes do this transpose for you, but as with all compiler optimizations it might sometimes break.
- melissalobos 5y agoThat sounds very interesting, is the anywhere I can read more about this optimization? I didn't know any compiler could do optimizations like that.
- kanaffa12345 5y agothere is no way a general purpose compiler will figure this out. op is probably talking about something like halide or tvm or torchscript jit.
- deleted 5y ago[deleted]
- astrange 5y agohttps://polly.llvm.org https://polly.llvm.org is a research project that could possibly maybe do this.
- kanaffa12345 5y agoa polyhedral compiler wouldn't find this either - polyhedral compilation is for finding optimal schedules for loop nests i.e., the order in which independent (wrt dataflow) iterations run. as far as i know you, a transpose can't be expressed in the polyhedral model.
- astrange 5y agoHmm I thought GCC's polyhedral optimizations had a loop transposition, but it turned out I was remembering an old "-floop-transpose" flag that seems to be only in old Apple GCC to get a SPEC win…
- phkahler 5y agoThe transpose is irrelevant after moving on to z-order access patterns and the 3d equivalent. Not quite as possible to reach peak sustained performance but well worth the trade in simplicity IMO.