mir icon indicating copy to clipboard operation
mir copied to clipboard

lazy gen in foreground and parallel gen in background

Open Itay2805 opened this issue 2 years ago • 1 comments

Let's say I want to have parallel gen in the background at say O3, and while that heavy jitting runs I would love to start running code let's say at O1 with the lazy gen. That way I can have the best of both lazy for faster startups but also parallel in the background for better code gen in the long run.

Is something like this possible with the current code? Or would I need to setup my own jit interface?

Itay2805 avatar Jul 19 '22 12:07 Itay2805

I guess it is possible. The way I look at possible solution is to have two ctx and an additional thread for background compilation and then when background generation is done, move the generated module to main thread where lazy code generation is done.
Although I did not check will it work.

There is no big difference in code generation time when -O1, -O2, and -O3 are used. Although the difference can be bigger if/when new optimizations will be added to MIR-generator.

FYI work of more one generator in one context is currently buggy. There are races in code working with context string (name) table when different generators create temporary registers (they have names) in parallel. I don't know yet how to fix it the best way (w/o losing generation speed).

vnmakarov avatar Jul 29 '22 18:07 vnmakarov