4 ms·
I agree with jcranmer and astrange! It is not possible, in June 2021, to build a compiler that can schedule general workloads as well as an out-of-order schedu
by GregarianChild 5y ago
I agree with jcranmer and astrange!
It is not possible, in June
2021, to build a compiler that can schedule general workloads as
well as an out-of-order scheduler can at run-time in a modern CPU.
Note that the scheduling we are talking about is mostly to do with
data location in order to hide the latencies of data-movement: In order to hide data movement latencies, you need to know if needed data is in L1, L2, L3, or main memory. In general workloads this is very much data
dependent. How is a static, or even JIT, compiler supposed to know
with enough precision where data is located at run-time?
An additional problem is that compiler scheduling needs bits for
encoding scheduling information, which does not come for free:
those bits cannot be used for other purposes (e.g. larger immediate arguments).
For more specific workloads where data movement is more predictable,
i.e. not itself data-dependent, the situation is different, whence the
rise of GPUs, TPUs, signal processing cores etc.
Spectre and Meltdown are orthogonal. They come from speculation,
e.g. branch prediction. Compile-time branch prediction is similarly
infeasible for general workloads.