SyslabCC: Suzhou-Tongyuan's proprietary Julia AOT compiler is now available for free use (personal & educational license only)

UPDATE: see examples and ask questions at the official GH repo github.com/Suzhou-Tongyuan/JuliaCon2024-JuliaAOT.


This is an unofficial announcement of the Julia AOT compiler (SyslabCC) created by Suzhou-Tongyuan, and I am the one who lead the compiler team and designed the architecture.

This compiler is now integrated into MWORKS.Syslab, and you can find the documentations for the compiler at SyslabCC. Unfortunately, it is written in Chinese due to our bandwidth, and I hope our circumstance not bother you much.

As an overview, I’d give as follow the features that the community would probably care about:

  1. SyslabCC converts Julia programs into small binaries (executable or shared libs), these binaries are small (1~2MB for small projects) and do not depend on libjulia.

  2. SyslabCC supports full multiple-dispatch, but limited to a type-stable subset.

  3. SyslabCC supports full Julia syntax (this is obvious as we started at the IR level).

  4. SyslabCC supports full try-catch usage. Rasing errors using throw, error and other functions are fine, but printing stacktrace programmatically is still WIP.

  5. SyslabCC supports const global variables (actually, we now support converting any complex structures into C/C++ static variables, no matter for stack/heap memory).

  6. SyslabCC supports a wide range of Julia libraries with good type-stability, i.e., Base, LinearAlgebra, FFTW, SpecialFunctions, DataStructures, Unitful, etc. Support for these libraries might not perfect, as even Julia Stdlib use a lot of type-unstable code.

  7. SyslabCC supports heap allocation and mutable struct.

  8. SyslabCC supports type-stable ccall. @cfunction is not released for the current version but partially supported at our dev branch. For bits only types/recursively stack-allocated types, the behavior should match the vanilla Julia.

  9. SyslabCC supports calling into blas, so a * b is supported and optimized by open-blas, MKL or other blas impl compatible to libblastrampoline.

  10. SyslabCC supports cross compilation from Windows to Linux, currently when cross-compilation you cannot reference any shared libraries at the local machine. --no-blas option is required to disable linking blas.

  11. Compile-time computations and macros are fully supported (you could use MLStyle for type-stable cases :slight_smile:

However, there are also many restrictions to the compiler (and also the small runtime bundled). The major obstacles might be the mandatory requirement for type safety. Task-based async is missing, and multi-threading is missing. Besides, several special language constructs are not supported, including but not limited to self-recursive structs and llvmcall.

Several meaningful (EDIT: fix link) examples are given in the documentations. For instance, you could write use Julia to write heat equations, create a minimal shared library, and use it in Python: Heat Equation 2D: Calling Julia AOT Libraries from Python.

Due to my extremeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee workload, I can’t attend JuliaCon in person. Hence, I will make some video and exemplar GH repositories to show the design, roadmap and usage of this Julia AOT compiler.

Besides, I hope you might not get blocked when accessing SyslabCC. Applying for a personal/educational license is required but it seems things need to be done in Chinese pages…

(Easter eggs: you might find some .NET things in the compiler :slight_smile:


UPDATE: The leadership team at Tongyuan has confirmed that we can provide an offline license checker and a standalone installation of the AOT compiler, independent of the full Syslab package, if there is potential for future commercial cooperation.

If you are interested in our AOT compiler, please DM me.

We look forward to hearing from you regarding:

  1. The specific scenarios and needs for using Julia’s AOT compiler, so we can assess how well our technology meets your requirements.
  2. Basic information about your company, such as the email address or a brief description of your company.

Thank you, and we look forward to your response.

113 Likes

I want to give a huge thanks to my teammates, even for those who have quitted. It is hard to explain the difficulties and get recognization. @JohnnyChen94 has also provided a lot of help, both technical and non-technical.

21 Likes

This is wild, extremely well done.

6 Likes

I can´t open any of the examples, the page appears blank.

Just fixed the link. We don’t have a root page for all examples. I link to the first example.

2 Likes

The download site says Windows and CentOS are supported. Does it work on Ubuntu?

3 Likes

For Windows user: This installer need VCRuntime 140, you need to download and install the latest VC redist x64 before starting the installer.

Of course, in most cases other software (e.g. Steam) have already installed the required VCRuntime for you.

(I did my testing in a clean windows sandbox and found this issue)

2 Likes

Some thoughts:

Personally I’m really interested in using this compiler, I want to play around with AOT Julia, especially if this can cross compile to Raspberry Pi target. I’ve been trying to run Julia on RPi and TTFX is horrible

Your manual page have that Matlab feel to it, if I was given the option to pay Matlab or pay you I prefer to pay you instead. Julia need all the resources it can get

There are some issues though:

  1. Website loads really slowly for me, I’m on a 1 Gbit/s university network and sometimes your documentation took like 3-4 minutes for me to load. Maybe use a global CDN, something like Cloudflare for your docs website? Or whatever available for Chinese website
  2. I want to introduce this to my researchers, but the docs are written in Chinese. I understand that currently you don’t have the bandwidth to write English docs, it might be useful if you have a official machine translation (google translate?) that I can share
  3. Where can we report bugs? As this is a proprietary compiler I can’t fix it myself
  4. (I’m really sorry for this) Unfortunately we might have some FUD on using a proprietary Chinese compiler, how do we convince them that you’re not going to do a Ken Thompson compiler attack on us?
5 Likes
  1. The good news is that if you download Syslab, it comes with a copy of the local HTML documentation, so maybe you can deploy it internally.
    I tried it and Edge can translate documents from the local computer (file:/// protocol)

  2. If TongYuan can clarify the license for the documentation, perhaps the community can maintain an unofficial translation of the documentation.
    For now, it’s all rights reserved.

  3. There is an official BBS forum that requires registration to post.
    https://bbs.tongyuan.cc/
    Because Tongyuan already has a github organization. (TongYuan · GitHub)
    I suggest to create a new project in github to collect feedback and suggestions from international users.

  4. I understand that, but I have no idea.
    Maybe SyslabCC can provide a direction and motivation to the community for open source implementations.

Disclaimer of interest: I am a Chinese user of Syslab and have no affiliation with Tongyuan. I know and have interacted with some Syslab developers.

10 Likes

As a foreigner in Japan, I can recommend to use Edge (also available on Linux) which is good at translating full webpages.

5 Likes

Hi @minetest2048,

I want to play around with AOT Julia, especially if this can cross compile to Raspberry Pi target

I’m not sure if Raspberry Pi targets work well because it is not specifically tested. Cross compilation to Arm64 does work, if you do not call into shared libraries (or you prepare the same .so files that matches ccall parameters).

Your manual page have that Matlab feel to it, if I was given the option to pay Matlab or pay you I prefer to pay you instead. Julia need all the resources it can get.

Thanks for your kind words. Actually, I’m the one who do not favor much about our documentation style, but that’s the decision. I’m not the one who could decide the documentation style, and you might know that the world of industrial software (EDIT: ) is has been “trained” by MATLAB. Traditional people in this area (both developer and customers) are quite used to MATLAB style, and things different from MATLAB is considered “disturbing” and “unconvincing”. I have come to deeply understand the resistance to adopt Julia in this real-world context, so I can afford that the progress comes with things that do not quite fit.

For your issues:

  1. Website loads really slowly for me…

I cannot reproduce this and the suggestions from @woclass do work…
I also feel willing to translate part of the documentations (barely, the part for SyslabCC and a few useful toolbox for common use) if I get some leisure time.

  1. I want to introduce this to my researchers … you don’t have the bandwidth to write English docs …

Bandwith is needed to take things place, and bandwidth comes from a plan decided made by the top.
The website to make requests might have some accessibility issues, so I’m willing to forward requests here to the appropriate people, even if it’s a low priority due to the free/commercial license. I believe the company’s decision makers would more or less think about this.

@woclass I will contact @JohnnyChen94 and other decision makers to work together about the potential solutions.

  1. Where can we report bugs…

I will make a GH repo for presenting slides and examples of this AOT compiler for JuliaCon. Before this, you could post here or DM me.

  1. (I’m really … how do we convince them that you’re not going to do a Ken Thompson compiler attack on us?

Firstly, no need to say sorry as we fully understand the concern. Fortunately, Suzhou-Tongyuan is a company that has already established solid international careers, which might give some credits:

  1. Suzhou-Tongyuan provides one of the main commercial Modelica compilers and developed a long frendship between Open Source Modelica Consortium (openmodelica.org). You can search “Tongyuan” in these pages. Besides, Suzhou-Tongyuan adopts Julia due the trending of using Julia in the modelica community.
  2. Suzhou-Tongyuan has already been used by several industrial companies in Europe. A relatively well-known instance can be found at Ricardo partners with Tongyuan to add new Modelica solver to Ricardo Software toolset | Insights | Realis Simulation (realis-simulation.com).
  3. (EDIT) SyslabCC has recently (but not the current release) supported pure C++ output with a few shared library dependencies copied from your Julia installation. Hence, the generated code will be TOTALLY TRANSPARENT & SAFE in the future. For the compiler, you could use security tools to check if the compiler executable accesses any harmful API, or use virtual machines to invoke the compiler. That should be all that we could do as a commercial company.
22 Likes

Sorry for missing you question!
The good news is that even MWORKS.Syslab is not tested on Ubuntu, using the julia AOT compiler (i.e., SyslabCC) is quite smooth.

I’d use WSL 2 to show the process.

Steps:

  1. go to the Download (tongyuan.co) page and download MWORKS.Syslab-2024a_SP1-x86_64-0.11.2.run.

  2. Navigate to the download directory and execute bash MWORKS.Syslab-2024a_SP1-x86_64-0.11.2.run.

    Show commands and logs
     > bash MWORKS.Syslab-2024a_SP1-x86_64-0.11.2.run
    

    Installation path is /home/taine/MWORKS.Syslab-2024
    Do you want to install it here? ([y]/n):y
    Installing MWORKS.Syslab, please wait a moment…

    Installing the libraries…
    Whether to precompile the libraries, it is estimated to take a few minutes. It is recommended to select [y] ([y]/n):n
    Install MWORKS.Syslab complete.

    I choose to install Syslab to the default location.

  3. Install some Chinese fonts or you get everything as small squares later…

    According to Ubuntu-Chinese-Font.md · GitHub, you could install them with:

     sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei fonts-arphic-ukai fonts-arphic-uming
    
  4. cd ~/MWORKS.Syslab-2024 && ./syslab.sh

    Remember to use your own install location.

    As I’m using WSL Ubuntu (I’m really an Arch user years ago, but campus and jobs changed me…), I got the following errors:

    Show error logs

    To use Syslab with the Windows Subsystem for Linux, please install Syslab in Windows and uninstall the Linux version in WSL. You can then use the syslab-oss command in a WSL terminal just as you would in a normal command prompt.
    Do you want to continue anyway? [y/N] y
    /xxx/MWORKS.Syslab-2024/Bin/bin/…/syslab-oss: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

    If you get the same error as mine, install libnss3 with sudo apt-get install libnss3-dev.

    It seems that everything works well in Ubuntu (except the commercial Julia libraries developed by Suzhou-Tonyuan) after the above setup.

Now we have arrived the login page…

Then you need to go to https://login.tongyuan.cc/signup to apply for an educational or personal license, and activate the use of Syslab.

Finally, you click the button circled as follow:

Things get done.

Now you could toggle English language with the following button:

Now you could try the our Julia AOT compiler with the heat equation example, which calls a shared library created from Julia in Python.

I cannot access matplotlib easily in WSL 2, so I just print the output.

6 Likes

The file size:

> ls -l --block-size=M
total 20M
-rw-r--r-- 1 taine taine  1M May 24 20:53 build.jl
-rwxr-xr-x 1 taine taine  5M May 24 20:19 libcrosstrace.so
-rwxr-xr-x 1 taine taine  3M May 24 20:58 libheat.so
-rwxr-xr-x 1 taine taine 12M May 24 20:58 libheat.so.dwo
-rw-r--r-- 1 taine taine  1M May 24 20:59 run.py
-rwxr-xr-x 1 taine taine  1M May 24 20:19 syslabcrt.so
  • libheat.so.dwo is just for debugging and not needed for running the programs.
  • libcrosstrace.so is for reporting relatively readable stacktrace if error occurs, and you could specify --notraceback to avoid it.
  • syslabcrt.so is a small runtime for the AOT-ed Julia program. It is written in C to provide some thin and essential runtime support, and the source will be visible once we release the C++ compilation target.
  • run.py is the Python program from the example, it invokes the shared library created from Julia.
5 Likes

As for the runtime dependencies:

> ldd libheat.so
        linux-vdso.so.1 (0x00007ffe53fcb000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe028d8f000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe028ca8000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe028a7f000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fe0290ff000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe028a7a000)
5 Likes

Same here. I thought maybe the link was still broken even after OP fixed it, but then I realized that it just takes a ridiculously long time to load.

2 Likes

I’m feel sorry that I can’t help with the slow loading of the site…

2 Likes

Off topic: how blocked is MATLAB in China right now? I smell a strong sense of replacing MATLAB with Julia vibe from the suit of software you guys offer (which is great!)

5 Likes

Not much, only blocked at a few institutes

1 Like

This is excellent news! :grin:

  1. How is the the C/C++ interop?
  2. Is it built on recent .NET? Some older versions don’t support ARM.
  3. Does it run on MacOS? Can it target MacOS? Can it run on Windows-for-ARM inside Parallels? Can it run inside a Linux ARM VM? You mentioned MATLAB, which supports MacOS.
  4. What is the bus factor of the project? Can someone bet their company on this continuing to exist, or is it the work of a single developer that may one day decide to e.g. be a farmer?
  5. Can you mark a function nothrow?
1 Like

Hi George, thanks for your informative questions, I’d answer a few.

ccall is supported for bits only types. @cfunction support will be released in the next version.

I don’t want to overly promote .NET stuffs here, but ARM 64 should be supported and support for ARM32 variants is on the way.

We’ll probably continue to use .NET’s excellent libraries in the form of small dynamic link libraries to underpin some platform-related operations. However, we’re moving towards C++, and C++ target has completed in the dev branch.

Once we release the C++ target, macOS will be supported (again, you have to prepare required shared libraries yourself, just like cross compilation in C++).

I think you need to wait for the C++ target…

You could have a try for ARM64, but remember to avoid referencing shared libraries from your local machine. Cross compilation is hard as Julia calls C too much. You may need to manually prepare many runtime dependencies.

Things will be relatively stable. Our company does need Julia AOT compiler for products. Additionally, we have multiple core developers on our team, so the project would not grind to a halt without my involvement.

No, we respect the semantics of vanilla Julia. And the generated code did require exceptions. It is possible to implement the exception handling in the codegen level, but it would need some extra works.

19 Likes