ocaml-multicore / ocaml-multicore

Multicore OCaml
Other
762 stars 68 forks source link

Native arm64 port #86

Open kayceesrk opened 7 years ago

kayceesrk commented 7 years ago

Implement arm64 backend for Multicore OCaml. This roughly involves translating the work done for amd64 backend to arm64. The major pieces of work are:

To preserve the memory model, non-initialising stores need to be fenced. This is done in platform-neutral code for caml_modify and promotions (either caml_promote or minor GC), but needs ARM-specific code in aarch64/emit.mlp for assignment instructions (not initialisations) and initialisations of globals.

kayceesrk commented 7 years ago

Done #120.

stedolan commented 6 years ago

Multicore used to support arm64, but due to the lack of CI it's bitrotted slightly, and current master doesn't build on arm64.

There's at most a couple of days hacking in bringing this back to life, and we've once again got access to an arm64 build machine, so we should set up some CI scripts.

github-actions[bot] commented 3 years ago

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

anuragsoni commented 3 years ago

Bumping this. I recently got a m1 mac and encountered build errors when trying to build the multicore compiler there. I'm not very familiar with the inner workings of the compiler, or the assembly so don't have a solution to propose just yet 😓

I'd be happy to run any tests/diagnostics to provide more information if given some instructions on what needs to be done :)

make[2]: `ocaml' is up to date.
/Applications/Xcode.app/Contents/Developer/usr/bin/make opt-core
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C runtime  allopt
gcc -c -O2 -fno-strict-aliasing -fwrapv -Wall -Wdeclaration-after-statement -Werror -fno-common -g  -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE   -DCAMLDLLIMPORT= -DNATIVE_CODE -DTARGET_arm64 -DMODEL_default -DSYS_macosx   -o fiber.n.o fiber.c
fiber.c:233:53: error: use of undeclared identifier 'Wosize_gc_regs'
    value* bucket = caml_stat_alloc(sizeof(value) * Wosize_gc_regs);
                                                    ^
1 error generated.
make[3]: *** [fiber.n.o] Error 1
mseri commented 3 years ago

Seems to be defined only for amd64: https://github.com/ocaml-multicore/ocaml-multicore/blob/6246534275a91e250e418f7f33f3fbce8bd00e1f/runtime/caml/stack.h#L65

kayceesrk commented 3 years ago

We've massively refactored the stack layout in order to make it more efficient. Getting Arm64 back online would require rewriting runtime/arm64.S by replicating the changes from runtime/amd64.S. This requires 2-3 weeks of focussed hacking and testing.

We don't plan to do this right now. Multicore OCaml team is currently focused on getting the OCaml 5.0 MVP with domain-only support with amd64 only. We will take up arm64 after we hit OCaml 5.0 MVP.