rust-lang / rust-lang/stdarch

CI for MIPS/MIPS64

Open
#364 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-mips A-testing
Dominant language
Rust
Stars
694
Forks
336
Avg merge
5d 14h
Merged PRs (30d)
9

Description

To test the MIPS SIMD Architecture (MSA) intrinsics we need to setup CI for MIPS/MIP64 targets. This is a summary of the problems I've encountered so far.

  • using MSA requires enabling floating-point features (fp64/fpxx). The current 32-bit MIPS targets ({mips,mipsel}-unknown-linux-gnu) do not have these enabled. Passing -C target-feature=+msa,+fp64 does not help:

    LLVM ERROR: MSA requires a 64-bit FPU register file (FR=1 mode). See -mattr=+fp64.
    
  • enabling floating point probably will require a std library compiled with it enabled, this should help: https://github.com/rust-lang/rust/pull/48874

  • qemu only supports two CPUs with MSA: p5600 (32-bit) and i6400 (64-bit).

  • qemu has a bug in which the auxiliary vector bit for MSA is not set: https://bugs.launchpad.net/qemu/+bug/1754372 ; until that is fixed we can't really test run-time feature detection under qemu and must override it to test the intrinsics

  • cross-compiling for i6400 is challenging. We need to set -C target-cpu=mips64r6 when compiling Rust. This is going to require the std lib to be compiled for this. Also, we need to set -march=mips64r6 when compiling C (e.g. for backtrace, auxv, etc.). The cross-compilation toolchains for this are not available in Ubuntu, only on Debian testing/unstable: libc6-dev-mips64r-cross. I haven't managed to get them to work (they seem buggy: missing headers, linking failurs, etc. they do not work out-of-the-box). One also must be careful of not cross-compiling against code that was compiled for mips64r2 since that will fail to link. All in all we might need to just use a different toolchain here, like the Codescape SDK. This explains how to set it up: https://github.com/v8mips/v8mips/wiki/Building-v8-for-MIPS

  • cross-compiling for p5600 requires targeting -C target-cpu=mips64r5/-march=mips64r5. The toolchains for it look mature, they might even work out-of-the-box. We will probably still need to recompile the std library for these targets though.

I would be surprised if these were the only issues.

In my opinion, the most promising route towards CI for MS would be to focus on mips/mipsel and the p5600.


cc @jcowgill @malbarbo @japaric

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by evaluating the proposed mips/mipsel and p5600 route, including Rust std compilation, target CPU flags, QEMU's p5600/i6400 support, and available cross-toolchains. Done means a reproducible CI job builds and runs MSA intrinsic tests on a supported target, with runtime feature detection handled around QEMU's auxiliary-vector bug.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, ci-cd, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
22/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.