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

Enable RISC-V build & test #3713

Closed
wants to merge 1 commit into from

Conversation

alexsifivetw
Copy link

Enable RISC-V build & test.

@facebook-github-bot
Copy link

Hi @alexsifivetw!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@alexsifivetw
Copy link
Author

Seems like the docker image doesn’t run risc-v toolchain & qemu installation. Can any one help me?

# TODO: Use apt to install prebuilt risc-v toolchain & qemu in the future
RUN sudo wget https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2023.07.05/riscv64-glibc-ubuntu-20.04-llvm-nightly-2023.07.05-nightly.tar.gz
RUN sudo tar -C /opt -zxvf riscv64-glibc-ubuntu-20.04-llvm-nightly-2023.07.05-nightly.tar.gz
RUN sudo rm riscv64-glibc-ubuntu-20.04-llvm-nightly-2023.07.05-nightly.tar.gz
RUN sudo ln -s -f /opt/riscv/bin/clang-16 /usr/bin/riscv64-unknown-linux-gnu-clang
RUN sudo ln -s -f /opt/riscv/bin/llvm-ar /usr/bin/llvm-ar
RUN sudo ln -s -f /opt/riscv/bin/qemu-riscv64 /usr/bin/qemu-riscv64

@Cyan4973
Copy link
Contributor

Cyan4973 commented Aug 2, 2023

Dependencies in general, and on docker images specifically, are to be avoided when practical.
I would rather prefer to rely on standard apt packages for CI.
I could get it to run risc-v tests properly in another project.

@alexsifivetw
Copy link
Author

alexsifivetw commented Aug 3, 2023

I would rather prefer to rely on standard apt packages for CI.

I agree. We can now use apt to install riscv-gcc-11, but only gcc 13 and later versions support RISC-V RVV.
We use wget to get latest RISC-V toolchain & QEMU because of our plane for RVV-optimization for zstd.

We could use apt to install toolchain, and use __riscv_v macro to protect RVV-optimized codes.
This means that the RVV-optimized code would only be enabled when the compiler supports RVV.

However, get RVV-supported toolchain & qemu via apt could take long time.

@alexsifivetw
Copy link
Author

Do you accept installing the toolchain via PPA?

@Cyan4973
Copy link
Contributor

Cyan4973 commented Aug 8, 2023

Do you accept installing the toolchain via PPA?

It depends on the PPA,
but in this particular case,
I'm not sure if there is such a need.

RISC-V qemu tests are working fine on Github CI using only regular apt in another project :
https://github.com/Cyan4973/xxHash/blob/dev/.github/workflows/ci.yml#L386

@alexsifivetw
Copy link
Author

alexsifivetw commented Aug 21, 2023

Hi, I apologize for the late reply.
RISC-V is a young and modern platform. The RISC-V spec, intrinsics, toolchain ... etc, change frequently. Therefore, we need to use the nightly prebuilt toolchain and install it using wget.
Would you accept this wget method and update the recipe for Docker image?

@Cyan4973
Copy link
Contributor

Let's keep it around.
I'll look at it when I get the time.

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

Successfully merging this pull request may close these issues.

4 participants