-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ARM64 assembly? #197
Comments
It's currently in
I'm assuming it's just a new machine type, so you should be able to add a new instance group. This doesn't mean the runner can utilize them easily. I won't say it's impossible because I haven't looked yet, but we don't have enough reason to support ARM64 natively considering the amount of work required and demand. In addition to figuring out how to run/test safely, we need to at least:
See my answer to non-native assembly request for some points I consider when adding support. #149 (comment) |
To emulate ARM, it should be possible to run ARM images with Docker+QEMU emulation. I can't find the docs, but https://docs.docker.com/build/buildx/#build-multi-platform-images mentions it. |
I have a bit of experience with cross-compiling and emulating arm32 assembly on x86 linux. The instructions for compiling and running a single
It shouldn't be hard to modify this to multi-file cases (including C files) and to aarch64. One problem I can imagine is how large the image containing |
I don't think the image need to include With $ cat /proc/sys/fs/binfmt_misc/aarch64
enabled
interpreter /usr/bin/qemu-aarch64-static
flags: OCF
offset 0
magic 7f454c460201010000000000000000000200b7
mask ffffffffffffff00fffffffffffffffffeffff I was able to run ARM64 images with
So, I think we can build an image with W=/workspace
I=codewars/arm64
C=$(docker container create --rm --platform linux/arm64 -w $W $I sh -c "as main.s -o main.o && ld main.o -o main && ./main")
docker container cp main.s $C:$W
docker container start --attach $C |
Using example from https://peterdn.com/post/2020/08/22/hello-world-in-arm64-assembly main.s
Dockerfile: FROM ubuntu:22.04
RUN apt-get update && apt-get install -y binutils
WORKDIR /workspace Build with: docker buildx build --platform linux/arm64 -t arm64-test . Run with: W=/workspace
I=arm64-test
C=$(docker container create --rm --platform linux/arm64 -w $W $I sh -c "as main.s -o main.o && ld -s main.o -o main && ./main")
docker container cp main.s $C:$W
docker container start --attach $C Outputs:
|
I just read up on QEMU user-mode emulation. Fascinating stuff! It seems we could support assembly language for a wide range of architectures this way, ARM and MIPS included, though RISC-V seems to be missing. I also did a quick search on the differences between @Bubbler-4 's approach of installing the emulator within the container, and @kazk 's approach of installing
|
I don't think MIPS is supported by Docker. I have |
RISCV64 is supported (#199) |
We also need a base image in the architecture. See https://github.com/docker-library/official-images#architectures-other-than-amd64 for supported architectures. |
Except I was thinking about ARM32, as that is most widely known, still has the very interesting conditional opcode execution, as well as program counter as a directly modifiable register, and possibly the use of Thumb instructions, and ARM64 is only a VERY recent and VERY breaking change to the ARM ISA. |
I'm not sure if it would be possible or makes sense to support both ARM32 and ARM64. If it would, I can make an additional request, if not, I would like to discuss which one to use. |
https://github.com/docker-library/official-images#architectures-other-than-amd64 mentions ARM32 as a supported architecture. I guess we could open a separate issue for ARM32 support and track the progress there. In fact, since #199 demonstrates the feasibility of supporting RISC-V with unit testing, I suppose adding support for additional architectures afterwards will only become much easier as long as both Docker and QEMU support it, and the only remaining factor of consideration becomes the operational cost of maintaining one more container image versus popular demand. |
For the icon, I guess we could use a cropped variant of this? For CodeMirror mode, there's a GAS mode upstream supporting ARM assembly syntax highlighting that should be directly applicable should we decide to use the GNU toolchain: https://github.com/codemirror/codemirror5/blob/master/mode/gas/gas.js I'll probably look into adapting the work in RISC-V to aarch64 tonight - it should be as simple as replacing the assembly files and tweaking the |
A minor nitpick: I doubt you can say "ARM64 is more relevant than ARM32" - yes, ARM64 is pretty common these days for high-end consumer devices (smartphones and Raspberry Pi series), but there is also a whole separate market of non-consumer microprocessor devices which mainly use ARM32. See STMicroelectronics and one of its main product lines STM32 for example. |
@kazk Created https://github.com/DonaldKellett/codewars-arm64v8 and initiated transfer, please review and accept if there are no outstanding issues |
Let's focus on finishing #199 first. There's no need to rush this. |
Please complete the following information about the language:
The following are optional, but will help us add the language:
@nomennescio wrote under channel
#asm
on Discord:While discussing with @nomennescio about native vs. non-native assembly and the pain points of running an emulator for the latter, it struck me that maybe, just maybe, it could be possible for Codewars to support ARM64 assembly natively, alongside x86_64. In recent years, ARM instances have been gaining popularity among cloud providers; for example, GCP now offers pre-GA Arm VMs on Compute. An initial idea could be then to run ARM64 assembly workloads on ARM nodes and everything else on x86_64 nodes.
So here are some questions to consider, which official Codewars staff and the team at Qualified would probably in the best position to answer, as they know best the details of the cloud service(s) being used:
👍 reaction might help to get this request prioritized.
The text was updated successfully, but these errors were encountered: