[Libre-soc-dev] bigint-presentation reg alloc and cranelift's reg alloc

Jacob Lifshay programmerjake at gmail.com
Tue Jan 31 23:02:26 GMT 2023

On Tue, Jan 31, 2023, 13:00 Jacob Lifshay <programmerjake at gmail.com> wrote:

> On Tue, Jan 31, 2023, 12:03 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
> wrote:
>> so i saw you mention that you have abandoned one codebase
>> and begun another?
> not quite, i'm still using most of the python code (everything but the
> register allocator, which is just one file). explanation here:

a more summarized explanation: the current register allocator (one file of
bigint-presentation-code) has 2 major problems:
1. it produces poor output (referring to which registers get assigned and
too many reg->reg copies, duplicate setvl's are expected and will be taken
care of in a separate pass)

2. it's too slow, i expect it to take on the order of 1 *hour* for the full
2048-bit modular exponentiation function (this is even after spending a
week doing speed optimizations), even though that's just the equivalent of
a few thousand lines of assembly code.

currently the code is too complex for me to fix #1 by changing the existing
code since i can't keep it all in my head, rewriting it allows me to choose
better abstractions as well as hopefully fixing #1, making the code easier
for me to think about.

since I need to rewrite it anyway to fix #1, i might as well also try to
fix #2 by rewriting it in rust. rust shouldn't be an issue since i'm not
using pyo3/maturin which is what caused us issues before (I'm instead using
json over stdio calling the reg allocator via a subprocess), and because
general libre-soc devs aren't expected to understand how the register
allocator works, since you'd be deep in compiler theory.



More information about the Libre-soc-dev mailing list