-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 Hexagon support #41524
Add Hexagon support #41524
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @arielb1 (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
I also have a wip for support for HVX v60 intrinsics in librustc_platform_intrinsics, but I haven't tested it on the emulator yet. |
This requires an updated LLVM with D31999 and D32000 to build libcore. A basic hello world builds and runs successfully on the hexagon simulator.
745f752
to
c558a2a
Compare
Oh. Looks like the builder is using an older system llvm which has a hexagon backend without an assembly parser. Should I avoid old llvms somehow? Or do we need a newer docker image? |
We want to support older LLVM versions (currently 3.7 upwards) for the sake of distros and other people building rustc with their own LLVM, and hence we have a few (one?) builder that tests that. However, there's no need to support each and every feature with older LLVM, so as long as it builds and tests pass, everything's fine. So in the worst case, you could disable the Hexagon target when building with an older LLVM. (Of course, if everything except the asm parser can be made to work with reasonable effort, that's good as well.) Edit: You could repurpose the version query in the build script to not include the |
Just noticed your edit after pushing a commit to do exactly that. I put in a version check requiring LLVM 4 or newer. Looks like LLVM 3.8 added the asm parser, but that's not likely to build libcore successfully. Probably actually need LLVM 5, but there's a chance LLVM 4 can work if we backport the necessary fixes. |
ea82f10
to
32aeb22
Compare
Turns out LLVM 4.0 plus some hexagon fixes does work, so I'll put up a PR for that soon. |
Looks good to me, thanks for the PR! @michaelwu lemme know when you're good on testing (e.g. when .travis.yml changes are back to normal) and I'll r+ |
5dc063e
to
22eb3c6
Compare
@alexcrichton I think I've tested enough. I just added a commit to build hexagon in LLVM by default since the rest of the hexagon support in rust is going to be built anyway, so why not.. |
Just to confirm, but could you measure the before/after size of LLVM compiling in hexagon? Just want to make sure we're not surprisingly adding like 100MB of extra libs. |
On a release build of LLVM on x86-64 Linux, I'm measuring an increase of 30MB in the bin, include, and lib directories. llc is increased by about 2MB. |
That doesn't matter, what's interesting for Rust is the size increase of the Rust toolchain (e.g., |
Agreed - I'm doing full rust builds to see what happens. LLVM only size comparisons were faster to do. I expect the size increase to be close to the increase in llc's size though. |
stage1 directory increases by about 5mb. |
Ok, that seems pretty reasonable, thanks for taking a look! @bors: r+ |
Hm, did bors miss that r+? |
@bors: r+ |
📌 Commit 22eb3c6 has been approved by |
there we go! |
…hton Add Hexagon support This requires an updated LLVM with https://reviews.llvm.org/D31999 and https://reviews.llvm.org/D32000 to build libcore. A basic hello world builds and runs successfully on the hexagon simulator. libcore is fine with LLVM fixes, but libstd requires a lot more work since there's a custom rtos running on most hexagon cores. Running Linux sounds possible though, so maybe getting linux + musl going would be easier. Here's the target file I've been using for testing ``` { "arch": "hexagon", "llvm-target": "hexagon-unknown-elf", "os": "none", "target-endian": "little", "target-pointer-width": "32", "data-layout": "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048", "linker": "hexagon-clang", "linker-flavor": "gcc", "executables": true, "cpu": "hexagonv60" } ```
…hton Add Hexagon support This requires an updated LLVM with https://reviews.llvm.org/D31999 and https://reviews.llvm.org/D32000 to build libcore. A basic hello world builds and runs successfully on the hexagon simulator. libcore is fine with LLVM fixes, but libstd requires a lot more work since there's a custom rtos running on most hexagon cores. Running Linux sounds possible though, so maybe getting linux + musl going would be easier. Here's the target file I've been using for testing ``` { "arch": "hexagon", "llvm-target": "hexagon-unknown-elf", "os": "none", "target-endian": "little", "target-pointer-width": "32", "data-layout": "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048", "linker": "hexagon-clang", "linker-flavor": "gcc", "executables": true, "cpu": "hexagonv60" } ```
For anyone who wants an example of how to use this, I just put up https://github.com/michaelwu/hexagon-hello-world |
This requires an updated LLVM with https://reviews.llvm.org/D31999 and https://reviews.llvm.org/D32000 to build libcore.
A basic hello world builds and runs successfully on the hexagon simulator. libcore is fine with LLVM fixes, but libstd requires a lot more work since there's a custom rtos running on most hexagon cores. Running Linux sounds possible though, so maybe getting linux + musl going would be easier.
Here's the target file I've been using for testing