Skip to content
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

ARM Architecture support? #53

Closed
aklofas opened this issue Nov 10, 2013 · 13 comments
Closed

ARM Architecture support? #53

aklofas opened this issue Nov 10, 2013 · 13 comments

Comments

@aklofas
Copy link

aklofas commented Nov 10, 2013

Is there ARM support on the roadmap?

I'm fooling around with a beagleboard at the moment. I've successfully gotten llvm/clang compiled and even terra too (with a small modification to tdebug.cpp where it handles mcontext_t), but alas it looks like tcompiler.cpp (and probably others too) are designed with x86 in mind.

@zdevito
Copy link
Collaborator

zdevito commented Nov 11, 2013

It's something we eventually want to do, but have no concrete roadmap for due to some unknowns.
The LLVM JIT is being converted from their old JIT to MCJIT. We use the old JIT because it works well as an incremental compiler, something that hasn't been integrated into MCJIT yet. Unfortunately, the old JIT only really works on x86. Hopefully we will be able to use MCJIT soon, which will remove the blocker.

The second issue is that LLVM doesn't handle C calling convensions, so our code generator (tcompiler.cpp) will need to be updated with ARM calling conventions. This shouldn't be too difficult once JITing on ARM is possible.

@bananu7
Copy link

bananu7 commented Nov 14, 2014

Could we get any update on that?

@zdevito
Copy link
Collaborator

zdevito commented Nov 14, 2014

Yeah, we have some preliminary arm support now. We've tested it on Nvidia's
Tegra K1 board, and at one point we were able to get it running on the
Raspberry Pi, but I don't have one set up right now to test with the latest
release.

However, we haven't implemented the entire ARM calling convention yet. When
calling C functions from Terra, and Terra functions from Lua, this
limitation restricts what types can be passed and returned. In particular,
structs and arrays cannot be passed/returned as values (pointers to them
are fine), and you cannot return multiple values from Terra (they are
packed in structs). When calling Terra functions from Terra there are no
restrictions.

It's often the case that you can work around the calling convention stuff,
since most C APIs don't pass structs by value, and you can avoid creating
code that does it yourself.

this is some code to get it running on the Tegra K1 board running ubuntu:

sudo add-apt-repository universe
sudo apt-get install build-essential llvm-3.4-dev clang-3.4
libclang-3.4-dev git
git clone https://github.com/zdevito/terra
cat > terra/Makefile.inc <<END
TERRA_CXX = g++
TERRA_CC = gcc
LLVM_CONFIG = $(shell which llvm-config-3.4)
END
make -C terra

On Fri, Nov 14, 2014 at 8:10 AM, Bartek Banachewicz <
[email protected]> wrote:

Could we get any update on that?


Reply to this email directly or view it on GitHub
#53 (comment).

@Starcounter-Jack
Copy link

There is an open pull request regarding ARM. Should it be closed?

@zdevito
Copy link
Collaborator

zdevito commented Apr 9, 2015

Yes, I closed that, thanks. This issue will stay open until all of our functionality is supported on ARM.

@ghost
Copy link

ghost commented Nov 10, 2015

Pinging for a query to status. Can a build off of master on an ARM architecture yield a working interpreter? What are the largest known missing features?

I'm very deep on the ARM side at present - - if a build is easy to achieve, I would be happy to contribute ARM builds and test pass/fail reports.

@elliottslaughter
Copy link
Member

Does anyone in this issue still care about this?

I've had success building on PowerPC (which is a platform not supported by LuaJIT) with this PR: #320

@bananu7
Copy link

bananu7 commented Dec 4, 2018

I think that Terra should support the other architectures in general, but it remains a question of effort vs benefits, I suppose.

@aiverson
Copy link
Contributor

I would like to have this capability.

@elliottslaughter
Copy link
Member

If LuaJIT supports your platform, this should pretty much work out of the box (with a sufficiently recent version of LLVM).

For platforms LuaJIT doesn't support, like I mentioned in the last comment, you'll need to use PR #320, which continues to be a work in progress but is feature-complete enough that we've been able to use it for doing runs on the Summit supercomputer (a PPC64le machine).

@elliottslaughter
Copy link
Member

I haven't specifically tested ARM, but we've had success using PR #320 on PPC64le for a long time now, so I'm going to close this as "good enough".

If there are any actual issues with ARM support, please open new issues.

@elliottslaughter
Copy link
Member

Just wanted to update this to add: ARM64 binaries are included in release 1.0.1 and pass roughly 96% of the test suite (as tested on a Raspberry Pi with Ubuntu 22.04).

@elliottslaughter
Copy link
Member

As of 1.0.5 Terra now fully supports AArch64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants