AsmJit needs funding - development suspended

I want to share the news, I just found out that AsmJit has suspended development because of lack of funding - github issue… Since the Erlang compiler leverages AsmJit for the JIT implementation, I wonder how this will affect the future of the BEAM codebase.

I hope it works out, and ideally there will be a company that funds the original author to continue their open source work!

9 Likes

Oh no, just when I was curious to learn more about Erlang’s JIT….

I wonder if it would be work it for the Erlang org to fork it and maintain it themselves? (Or switch to something else like Cranelift: wasmtime/cranelift at main · bytecodealliance/wasmtime · GitHub

)

You would think that it would be to everyones benefit if Ericsson hired the guy to make the BEAM go even faster. :slight_smile: well one can hope.

1 Like

Author here - I’m sad about this too, but unfortunately it seems that there is no company on this planet that would be willing to fund this project even if it’s directly or indirectly using it. After almost 2 years of trying and failing to get funding I decided to stop trying and have a life instead.

21 Likes

Yeah, it’s unfortunate. I see a lot of value in asmjit as it is what has made the BEAM fast, and I’m sure there is a ton of performance left on the table for the BEAM, the potential is huge. I wonder what the OTP team thinks as they have already talked about a BEAM v2.

Bogdan dream is still alive, and we’re closer then ever.

One can only hope; Ericsson has announced laying off (max.) ~1600 people…

Alternative thought:

  • What if instead of relying on a single company (Ericsson), all companies that benefit from Erlang decide to contribute and help? If your company cannot do it, well, the Erlang Foundation could potentially hire @petrk if other companies decide to chip in and become members of the Foundation.

I am tired of the argument of Ericsson or WhatsApp needing to hire more people, when it is actually the community that can bring all the value. Open Source is free to use and read, but maintenance has a hidden cost. But this means that we need to look ourselves (employers) in the mirror and we have to do something. It is always easier to blame it on someone else.

One can only hope that companies that rely on Erlang realise that Ericsson and WhatsApp can do just as much, and it is everyone else who needs to chip in and contribute, in-kind or with funding.

Proposal

If your (everyone) employer is willing to contribute to a maintenance and development fund towards asmjit, let me know here and I talk with @petrk and the Erlang Foundation and we start moving things. But, one can only hope…

4 Likes

Although I agree with your general sentiment, I dislike how you put me in that category. I think it would be beneficial for the community and potential companies to understand where and what the OTP see they could help with either that be in having their staff tackle issues or monetarily.

For example, lately I’ve been thinking about if there ever will appetite for adding new datatypes like decimal floats.

Hi! This is not just about you :slight_smile: ; I said the same thing on the EEF Slack (Slack).

Not all companies agree with this view, and that’s what it is. Some companies do not see value or agree with EEF, but EEF only has one employee (Jonatan), everyone else (board and working groups) are volunteers and do this for free. In fact, this forum and the Elixir ones are sponsored by EEF, if I recall correctly.

If the community swims in the same direction (with in-kind or funds), we can all make everything way better. There are more than 500 companies using Erlang, and really few contribute back. I consider a “miracle” (it is really hard work) everything that EEF is doing with the funds they have, especially regarding security and Cyber Resilience Act.

For additions to OTP, the OTP team is always open to discussion, as we are on research topics (bad luck that none of the ones we participated got funding, such as, set-theoretic types)

Sorry if the tone seems aggressive or similar, I am just an old man tired of some arguments (even more after FOSDEM and all the reality check that it comes with)

2 Likes

The topic of sustainable OSS always makes for a good discussion, and all ideas and points of view are interesting, valid, and helpful - both of yours are excellent for instance (wouldn’t it be great if we had both).

I have given the topic quite a bit of thought myself and it (funding OSS) does factor into some of our plans/future projects. Sadly, the use of AI has changed things a lot and I think it presents a big problem for OSS, as discussed in various AI related threads here and on EF (eg: In an age of AI, what can programming languages do to survive/compete? - Dev Env / Tools / AI - Elixir Programming Language Forum)

Pre AI, I’ve always felt that funding is often best paired with offering something of tangible value to companies. On projects like these forums for example we offer exposure (we are probably some of the highest traffic sites in the space), and in more code-based OSS projects, maybe that could sometimes be features or a promise to maintain certain parts of a project that are important to a company, or perhaps being prominently feature on all project pages, including the repo and official website?

I am a firm believer in the saying “where there’s a will there’s a way” sometimes, we just need to find that way.

And discussions like these are a good start down that path :icon_biggrin:

Are the entire OTP team volunteers?

As maybe the solution here is not as much the continuation of asmjit but more the parts that are important to Erlang. Obviously this is not my decision, but just an observation of the value.

The OTP team is part of Ericsson.

Everyone who performs work for EEF is a volunteer, because EEF has only one employee, Jonatan (CISO at EEF).

My personal opinion is simply that if your company benefits from open source, I believe your company should contribute back in some way, cost maintenance is not free and has never been.

As an example, OTP team has contributed to all the projects that we started to use: scorecard, oss-review-toolkit, and reuse. These contributions were not life changing, but they enable the BEAM community to use these tools (so now, scorecard, oss-review-toolkit, and reuse should work on Erlang, Elixir, and Gleam)

BTW, I talked yesterday to EEF, as I said I would

2 Likes

I agree and some kickstarter-like incentive is one way to encourage them to do so. Similar to rebar4, I don’t think rebar3 development would get that much contribution if there weren’t a clear plan of what exactly will be developed.

Maybe we (BEAM community) could pinpoint specific stuff/features from AsmJit that would make benefit to the community. I haven’t done a thing on JIT, but there are probably some thinks worth improving that would make BEAM JIT faster and some aren’t. If we focus on the former we may yield some result.

It’s not long-term solution, but I believe that community could collect amount of money to keep this project alive at least for some time.

In the case of AsmJit, EEF is exploring options and checking with the author.

In the case of rebar4, we would all love to have a build model and build system, so that we can rely on certain assumptions. It is great the kick starter that Peer did, and I hope to see rebar4 integrated with OTP :slight_smile: Performance of the builds will be a big issue, but I am confident that it can be great

1 Like

Some notes about the maintenance:

AsmJit library is relatively small, but it has more than 15 years of development history and during that time I have rewritten it 3 times to end up with the current architecture. AsmJit’s ISA completeness was the initial goal of the library - to create something that can be used by many other projects without facing restrictions like “this instruction was not implemented and thus cannot be used”. For me it’s very hard to see alternatives in low-latency JIT compilation field. For example LLVM is not a competitor of AsmJit - it’s a library for a completely different use-case.

The problem is that just to keep AsmJit up-to-date I have to dig into instruction manuals of all supported architectures and add these instructions to AsmJit’s database, and write encoders for them, tests, etc… Just keeping the ISA-level up-to-date is a lot of work - just look at AVX-512, for example, how massive it is (but I got it!). And now there is Intel’s APX, AVX10.2, new AMX additions, etc… And In ARM world there is SVE, SVE2, SME, SME2, and many new extensions.

But that’s not all - if you emit your code there is another problem - to run it! There has been a lot of restrictions employed by OS vendors lately regarding the possibility to run JIT code. For example using MAP_JIT on Apple Silicon, W^X pages on hardened platforms, etc… And this is a minefield - Linux, Windows, Apple, each BSD variation, etc… you literally write separate code for each of these and I still remember this NetBSD or OpenBSD bug (sorry don’t remember which one was it) that we found was actually an OS bug that caused invalidation of private mappings after fork() - and to find this it took me literally days of my time - to find a bug in OS that I was not even using.

And lately, I started the UJIT sub-project within AsmJit which tries to make code-generation platform independent with an escape hatch to use architecture-dependent pieces where it makes a difference. That’s a fresh thing that I have ported from Blend2D project to make it more accessible to other projects.

In other words - the development costs a lot of time and development activity is necessary.

What are the options?

  1. Core team becoming maintainers of AsmJit: I think this would be possible and probably the best solution if the current state of matters is not resolved. But the question is why the core team should be distracted by this kind of work? Would the development of the core project then be slower due to maintenance costs? They would still have to do the maintenance, and possibly write new ports if RISC-V or Loongarch becomes a thing.
  2. Using a different library instead. There is xbyak (x86), which has something comparable to AsmJit’s x86/x64 Assembler - it could theoretically be used if higher portability is not a big concern. AsmJit’s virtual memory management would have to be ported to this library though as I’m not aware of it being able to do dual mapping, for example.
  3. Avoid JIT entirely or design something simpler like copy&patch. I have no idea whether this would be worth it.

I still think that AsmJit getting the deserved funding would be the best outcome, because I would finally be able to make things better on AsmJit front (like having SIMD-accelerated encoders, more ports, etc…). But that doesn’t depend on me. Companies like Meta are not gonna help, they are busy counting billions, has to be somebody else.

12 Likes

Hi @petrk I fully agree with you! I would try to avoid making Erlang/OTP maintainers of AsmJit. It will have for sure an impact on the current speed development, plus the time to learn AsmJit and keep it up to date. As you stated the options, I agree with you, AsmJit is great for Erlang/OTP and if we (Erlang/OTP) could collaborate with you on how to integrate even better, I am sure we can get even faster code for the BEAM, so the whole community can benefit.

I believe Jonatan from EEF has reached out to you, but if you have missed the email, feel free to let me know kiko@erlang.org (or kiko.a.fernandez-reyes@ericsson.com) and we can discuss possible ways to get this moving forward via the Erlang Foundation (via private conversations).

6 Likes

Indeed! I’m already in contact with Jonatan, so let’s see.