Re:DLVM: A modern compiler framework for neural network DSLs
by deepnotderp on Thursday February 22, 2018 @12:23AM
(#16435320)
Why are all the neural network DSLs JIT obsessed?
[ Parent
| on HN ]
Re:DLVM: A modern compiler framework for neural network DSLs
by grandmczeb on Thursday February 22, 2018 @02:51AM
(#16435973)
Lots of modern models have very late binding variables
which are hard to precompile for (sentence length in MNT, for example). That means you're going to need to do some form of specialization at runtime, so a JIT makes sense.
Re:DLVM: A modern compiler framework for neural network DSLs
by deepnotderp on Thursday February 22, 2018 @10:18AM
(#16438096)
Just treat it as an infinite loop , there's no need to JIT in an optimized version that late.
Re:DLVM: A modern compiler framework for neural network DSLs
by grandmczeb on Thursday February 22, 2018 @03:11PM
(#16440950)
One of the core operations of the transformer network[1] is a (LxL) x (LxE) matrix multiply (where L is the sentence length and E is the network width). Can you be more specific about how you would get good performance without specializing on L?
Re:DLVM: A modern compiler framework for neural network DSLs
by deepnotderp on Thursday February 22, 2018 @03:59PM
(#16441337)
You use the loop based GEMM kernel and inject the loop counters as the input size.
Re:DLVM: A modern compiler framework for neural network DSLs
by grandmczeb on Thursday February 22, 2018 @05:02PM
(#16441876)
L can be as small as 1 and bigger than 512. For small L it makes sense to do different optimizations than large L. A loop based GEMM doesn’t help with that.
Re:DLVM: A modern compiler framework for neural network DSLs
by joe_the_user on Thursday February 22, 2018 @12:45AM
(#16435392)
Well, the success of neural nets over the past few years has come through harnessing massive processing power.
The problem is a lot of the programming can be low level and ad-hoc. I think the idea of the various DSLs is to allow the model to be compactly specified while having the programs go as fast as possible. A JIT may be one way to accomplish this.
Re:DLVM: A modern compiler framework for neural network DSLs
by deepnotderp on Thursday February 22, 2018 @01:29AM
(#16435611)
Relying upon a JIT often means the ability to create things which preclude the use of static compilers, which means that accelerated hardware, like ours, cannot be used efficiently.
Re:DLVM: A modern compiler framework for neural network DSLs
by yorwba on Thursday February 22, 2018 @03:42AM
(#16436169)
The kind of optimizations a static compiler might apply can be done by a JIT as well, with the added benefit of actually knowing what kind of workload is going to run. Most of deep learning is applying comparatively small computation graphs to very large arrays of numbers in parallel, so the overhead of compilation is only a small portion of the overall computation time. A smart JIT that decides on the optimal tiling pattern for the array dimensions observed at runtime and rewrites loops accordingly can easily pay for itself.
Re:DLVM: A modern compiler framework for neural network DSLs
by Firadeoclus on Thursday February 22, 2018 @05:46AM
(#16436680)
As a counterpoint (and not necessarily the one the GP is referring to), if you were compiling for, say, an FPGA the overhead of compilation would be very significant.
Re:DLVM: A modern compiler framework for neural network DSLs
by deepnotderp on Thursday February 22, 2018 @10:15AM
(#16438061)
Our processor is analogous to a CGRA, so compilation to it would indeed be hindered by a JIT based compiler.