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

Add Arm LLVM cross-compilation CI pipeline #2736

Merged

Conversation

keeranroth
Copy link
Contributor

Description

For Clang cross-compilation we need to do a few extra things when compared to GNU. First of all, we need to have a sysroot with all the libraries installed that we want. As such, we debootstrap a sysroot, which is to be cached in the Azure CI pipelines. We also install a more recent version of the LLVM compiler. Whilst not necessary for the Arm build, this is necessary to get some more recent support for RISC-V, in particular the vector extensions, which will be coming in a future commit.

Changes proposed:

  • Install clang from llvm.org, rather than default apt
  • Build a sysroot with necessary packages, and cache this in the CI
  • Add a CMake toolchain file for Clang on aarch64
  • Update OpenBLAS build to pass appropriate options for clang cross-compilation
  • Add a variable to the oneDAL makefile to detect Clang cross-compilation, and set appropriate flags for building
  • Update list of failing tests under emulation

For Clang cross-compilation we need to do a few extra things when
compared to GNU. First of all, we need to have a sysroot with all the
libraries installed that we want. As such, we debootstrap a sysroot,
which is to be cached in the Azure CI pipelines. We also install a more
recent version of the LLVM compiler. Whilst not necessary for the Arm
build, this is necessary to get some more recent support for RISC-V, in
particular the vector extensions, which will be coming in a future
commit.

Changes made:
* Install clang from llvm.org, rather than default apt
* Build a sysroot with necessary packages, and cache this in the CI
* Add a CMake toolchain file for Clang on aarch64
* Update OpenBLAS build to pass appropriate options for clang
  cross-compilation
* Add a variable to the oneDAL makefile to detect Clang
  cross-compilation, and set appropriate flags for building
* Update list of failing tests under emulation
@keeranroth
Copy link
Contributor Author

@rakshithgb-fujitsu You might want to have a look at this as well

@napetrov @Alexandr-Solovev I've added an LLVM cross-compiled Arm pipeline. This is because the LLVM toolchain for RISC-V is more mature, and I am going to put up another pull request for the RISC-V build on top of this one. I want to show that the RISC-V cross-build is very similar to the aarch64 one

Copy link
Contributor

@Alexandr-Solovev Alexandr-Solovev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general LGTM, just have one question and request minor fixes. Lets wait private CI

sudo debootstrap --arch="$2" --verbose --include=fakeroot,symlinks,libatomic1 --resolve-deps --variant=minbase --components=main,universe "$3" "$4"
sudo chroot "$4" symlinks -cr .
sudo chown "${USER}" -R "$4"
rm -rf "${4:?}"/{dev,proc,run,sys,var}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please explain how and for what these rm functions will work? Can it affect user?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just to save on a few bytes when caching the sysroot. We only need the sysroot for includes and libraries, and not for running a chroot, so we rm some of the executables. The use of "${4:?}" will ensure that we don't remove /dev /proc, etc. The list might not be exhaustive here, but it is at least a start for what can be trimmed away.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks! I relaunched a private ci job, previous one was pretty green, but it's just for doublechecking. When it will be finished, I'll approve this pr.

.ci/env/apt.sh Show resolved Hide resolved
examples/daal/cpp/target_excludes.cmake Outdated Show resolved Hide resolved
.ci/pipeline/ci.yml Show resolved Hide resolved
@Alexandr-Solovev
Copy link
Contributor

/intelci: run

@Alexandr-Solovev
Copy link
Contributor

/intelci: run

@Alexandr-Solovev Alexandr-Solovev merged commit 3d45709 into uxlfoundation:main Apr 23, 2024
16 checks passed
@keeranroth keeranroth deleted the dev/keeranr/arm-llvm-cross-ci branch April 23, 2024 11:32
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

Successfully merging this pull request may close these issues.

2 participants