SlideShare a Scribd company logo
1 of 33
Download to read offline
Alex Bennée
HPC Workshop, 26th July 2018
Setting up for SVE Development
Agenda
● Introductions
● Building SVE programs
● Running & Debugging SVE programs with QEMU
● Setting up a SVE development environment with QEMU
Introduction
● Alex Bennée
● Linaro Virtualization Engineer
● QEMU TCG, KVM
● alex.bennee@linaro.org
● IRC: ajb-linaro/stsquad
ARM’s Scaleable Vector Extensions
●
●
○
●
○
○
○
●
○
○
○
Compilers
● GCC-8
○ Free and Open Source
○ -march=armv8.2-a+sve
● ARM HPC Compiler
○ Commercially licensed compiler
○ LLVM based
○ -march=armv8-a+sve
Building with SVE enabled
● Environment Variables
○ CFLAGS=”-march=armv8.2-a+sve” ./configure
● Configure Parameters
○ ./configure
--extra-cflags="-march=armv8.2-a+sve"
Libraries
● Currently Upstreaming
○ glibc
○ musl
○ bionic
● cortex-strings
○ staging ground for mem/string functions
○ can be LD_PRELOADED
● If important to your workload
○ Build yourself!
Running SVE programs
● Real Hardware
● Fast Models
○ Foundation Model
○ Fixed Virtual Platform
● ARMIE
● QEMU 3.0 linux-user
What is QEMU?
●
○
○
○
○
●
○
○
○
What is QEMU linux-user mode?
●
○
○
○
●
○
○
The Tiny Code Generator (TCG)
Building QEMU
$ ./configure --target-list=aarch64-linux-user --static
$ make [-jN]
Running with QEMU
$ ./tests/Test_simd
Illegal instruction (core dumped)
$ qemu-aarch64 ./tests/Test_simd
...
Current Grid git commit hash=ec9939c1ba8d61dbb2c583bfc2024c8f4baf608c:
(HEAD -> develop, origin/develop, origin/HEAD)
Grid : Message : 809944 usec : Requesting 1073741824 byte stencil comms
buffers
QEMU options
● CPU selection
○ -cpu [cortex-a53|cortex-a57|max]
● Debug output
○ -d [in_asm,...]
○ - dfilter 0xstart+0xrange
○ -D filename
● GDB Stub
○ -g 1234
● Help
○ -help
○ -flag help
QEMU gdbserver
Run program:
qemu-aarch64 -g 1234 <program>
Attach debugger:
gdb <program> -ex "target remote localhost:1234"
● Currently SVE registers (z/p) not viewable
Cross Architecture
Considerations
Program Start-up (ELF)
● Loader (INTERP)
● ld-linux.so
● finds and links libraries
● Link Libraries
● libc.so.6
● and many more….
● specific versions (HWCAP)
● Jump to main()
Avoiding Library Clashes
● chroot
○ set new /
● containers
○ uses namespaces/control groups
● multi-arch
○ file-system layout
Multi-Arch Support
● Builds on multi-lib
● supporting 32/64 bit user-space
● Side-by-side
● Shared Objects (.so libs)
● Headers
● Static libraries
● Versions must align
binfmt_misc
● See /proc/sys/fs/binfmt_misc/
● jar
● python
● qemu-FOO
● When kernel can’t run binary
● check magic numbers
● call helper
● System-wide setting
○ Shared with containers
Setup binfmt_misc
● Distro specific
● Install qemu-user/qemu-user-binfmt
● use the static packages
● $(QEMU_SRC)/scripts/qemu-binfmt-conf.sh
○ update-binfmts (Debian)
○ systemd
○ direct /proc/sys/fs/binfmt_misc access
Docker Builds in QEMU
● Builds on different Distros
○ CentOS, Fedora, Ubuntu, Debian, Travis
○ make docker-test-quick@centos7 J=n
● Cross-builds for different hosts
○ Using Debian Stretch + Multi-Arch Cross Compilers
○ Good for shaking out 64 bit assumptions!
○ make docker-test-build@debian-arm64-cross TARGET_LIST=aarch64-softmmu J=n
● Building TCG test-cases
○ Debian Cross Compilers (Stretch & Sid)
○ make -jN check-tcg
● Building linux-user containers
○ make docker-test-unit@debian-powerpc-user-cross J=n
Docker Make Targets in QEMU
● Run test on distro
○ make docker-TEST-SCRIPT@DISTRO J=n
● Run test on all enabled distros
○ make docker-test-unit J=n
○ make docker-test-quick J=n
● Run all tests on all images
○ make docker-all-tests
● Help
○ make docker
Docker binfmt targets
● Pre-requisites
○ binfmt_misc setup for /usr/bin/qemu-FOO
○ ./configure --disable-system --static
○ debootstrap/fakeroot installed
● Debootstrap
○ make docker-binfmt-image-debian-FOO DEB_ARCH=ARCH DEB_TYPE=DISTRO
EXECUTABLE=QEMU
Building Ubuntu ARM64 image
make docker-binfmt-image-debian-ubuntu-bionic-arm64 
DEB_ARCH=arm64 DEB_TYPE=bionic DEB_URL=http://ports.ubuntu.com 
EXECUTABLE=./aarch64-linux-user/qemu-aarch64 V=1
Running your Ubuntu ARM64 image
$ docker run --rm -it qemu:debian-ubuntu-bionic-arm64 /bin/bash
root@e68be4cb7b0f:/# uname -a
Linux e68be4cb7b0f 4.15.0-23-generic #25-Ubuntu SMP Wed May 23 18:02:16 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux
root@e68be4cb7b0f:/# exit
Setup Developer Environment
$ docker run -it qemu:debian-ubuntu-bionic-arm64 /bin/bash
root@c4dc9b5426ad:/# sed -i 's/main/main universe/' /etc/apt/sources.list
root@c4dc9b5426ad:/# apt update
root@c4dc9b5426ad:/# apt install -y gcc-8 g++-8 wget libtool autoconf libtool gdb less
root@c4dc9b5426ad:/# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 1000
root@c4dc9b5426ad:/# update-alternatives --install /usr/bin/++ g++ /usr/bin/g++-8 1000
root@c4dc9b5426ad:/# gcc --version
gcc (Ubuntu 8-20180414-1ubuntu2) 8.0.1 20180414 (experimental) [trunk revision 259383]
...
root@c4dc9b5426ad:/# exit
Save Developer Environment
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS NAMES
c4dc9b5426ad qemu:debian-ubuntu-bionic-arm64 "/bin/bash" 2 hours ago Exited (0) adoring_goodall
e174632927ba 238519b386bc "/bin/sh" 5 hours ago Exited (0) friendly_mayer
ad33c7bc7558 0da2cdd3455f "/bin/sh" 8 hours ago Exited (0) silly_noether
…
$ docker commit -m "setup arm64 env" adoring_goodall development:bionic-arm64-sve
sha256:25b770e5ce8a5b55ebbccad3b90b58a3474c4acdc5a70ca8ad42fdaf9f273f53
Running Development Environment
$ git clone https://git.linaro.org/toolchain/cortex-strings.git cortex-strings.git
$ cd cortex-strings.git
$ docker run --rm -it -u $(id -u) -v $(pwd):$(pwd) -w $(pwd) development:bionic-arm64-sve /bin/bash
user@container:~/cortex-strings.git $ ./autogen.sh
user@container:~/cortex-strings.git $ ./configure --with-sve --enable-static --disable-shared
user@container:~/cortex-strings.git $ make -j
Did it work?
user@container:~/cortex-strings.git $ make check -j
PASS: tests/test-memset
…
PASS: tests/test-strcmp
======================================================================
Testsuite summary for cortex-strings 1.1-2012.06~dev
======================================================================
# TOTAL: 12
# PASS: 12
Advantages
● “Native” build
○ configure runs as if on real HW
○ no need of “cross” compiles
○ tests work out of the box
● Container
○ Is stable and fixed, works every time
○ Running environment is ephemeral
● Source Code
○ Stays on host file-system
○ Use your own tools/editors independent of container
Useful Links
● https://www.linaro.org/blog/sve-in-qemu-linux-user/
Thank You!

More Related Content

More from Linaro

Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Linaro
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineHKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
Linaro
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineHKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
Linaro
 
HKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
HKG18- 115 - Partitioning ARM Systems with the Jailhouse HypervisorHKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
HKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
Linaro
 
HKG18-TR08 - Upstreaming SVE in QEMU
HKG18-TR08 - Upstreaming SVE in QEMUHKG18-TR08 - Upstreaming SVE in QEMU
HKG18-TR08 - Upstreaming SVE in QEMU
Linaro
 
HKG18-120 - Devicetree Schema Documentation and Validation
HKG18-120 - Devicetree Schema Documentation and Validation HKG18-120 - Devicetree Schema Documentation and Validation
HKG18-120 - Devicetree Schema Documentation and Validation
Linaro
 
HKG18-223 - Trusted FirmwareM: Trusted boot
HKG18-223 - Trusted FirmwareM: Trusted bootHKG18-223 - Trusted FirmwareM: Trusted boot
HKG18-223 - Trusted FirmwareM: Trusted boot
Linaro
 
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
Linaro
 
HKG18-317 - Arm Server Ready Program
HKG18-317 - Arm Server Ready ProgramHKG18-317 - Arm Server Ready Program
HKG18-317 - Arm Server Ready Program
Linaro
 
HKG18-312 - CMSIS-NN
HKG18-312 - CMSIS-NNHKG18-312 - CMSIS-NN
HKG18-312 - CMSIS-NN
Linaro
 
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...
Linaro
 
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...
Linaro
 
HKG18-212 - Trusted Firmware M: Introduction
HKG18-212 - Trusted Firmware M: IntroductionHKG18-212 - Trusted Firmware M: Introduction
HKG18-212 - Trusted Firmware M: Introduction
Linaro
 
HKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 ServersHKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 Servers
Linaro
 
HKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with CoresightHKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with Coresight
Linaro
 

More from Linaro (20)

Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
 
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineHKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
 
HKG18-100K1 - George Grey: Opening Keynote
HKG18-100K1 - George Grey: Opening KeynoteHKG18-100K1 - George Grey: Opening Keynote
HKG18-100K1 - George Grey: Opening Keynote
 
HKG18-318 - OpenAMP Workshop
HKG18-318 - OpenAMP WorkshopHKG18-318 - OpenAMP Workshop
HKG18-318 - OpenAMP Workshop
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineHKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
 
HKG18-315 - Why the ecosystem is a wonderful thing, warts and all
HKG18-315 - Why the ecosystem is a wonderful thing, warts and allHKG18-315 - Why the ecosystem is a wonderful thing, warts and all
HKG18-315 - Why the ecosystem is a wonderful thing, warts and all
 
HKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
HKG18- 115 - Partitioning ARM Systems with the Jailhouse HypervisorHKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
HKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
 
HKG18-TR08 - Upstreaming SVE in QEMU
HKG18-TR08 - Upstreaming SVE in QEMUHKG18-TR08 - Upstreaming SVE in QEMU
HKG18-TR08 - Upstreaming SVE in QEMU
 
HKG18-113- Secure Data Path work with i.MX8M
HKG18-113- Secure Data Path work with i.MX8MHKG18-113- Secure Data Path work with i.MX8M
HKG18-113- Secure Data Path work with i.MX8M
 
HKG18-120 - Devicetree Schema Documentation and Validation
HKG18-120 - Devicetree Schema Documentation and Validation HKG18-120 - Devicetree Schema Documentation and Validation
HKG18-120 - Devicetree Schema Documentation and Validation
 
HKG18-223 - Trusted FirmwareM: Trusted boot
HKG18-223 - Trusted FirmwareM: Trusted bootHKG18-223 - Trusted FirmwareM: Trusted boot
HKG18-223 - Trusted FirmwareM: Trusted boot
 
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
 
HKG18-317 - Arm Server Ready Program
HKG18-317 - Arm Server Ready ProgramHKG18-317 - Arm Server Ready Program
HKG18-317 - Arm Server Ready Program
 
HKG18-312 - CMSIS-NN
HKG18-312 - CMSIS-NNHKG18-312 - CMSIS-NN
HKG18-312 - CMSIS-NN
 
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...
 
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...
 
HKG18-212 - Trusted Firmware M: Introduction
HKG18-212 - Trusted Firmware M: IntroductionHKG18-212 - Trusted Firmware M: Introduction
HKG18-212 - Trusted Firmware M: Introduction
 
HKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 ServersHKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 Servers
 
HKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with CoresightHKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with Coresight
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Recently uploaded (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Setting up for sve development - Linaro HPC Workshop 2018

  • 1. Alex Bennée HPC Workshop, 26th July 2018 Setting up for SVE Development
  • 2. Agenda ● Introductions ● Building SVE programs ● Running & Debugging SVE programs with QEMU ● Setting up a SVE development environment with QEMU
  • 3. Introduction ● Alex Bennée ● Linaro Virtualization Engineer ● QEMU TCG, KVM ● alex.bennee@linaro.org ● IRC: ajb-linaro/stsquad
  • 4. ARM’s Scaleable Vector Extensions ● ● ○ ● ○ ○ ○ ● ○ ○ ○
  • 5. Compilers ● GCC-8 ○ Free and Open Source ○ -march=armv8.2-a+sve ● ARM HPC Compiler ○ Commercially licensed compiler ○ LLVM based ○ -march=armv8-a+sve
  • 6. Building with SVE enabled ● Environment Variables ○ CFLAGS=”-march=armv8.2-a+sve” ./configure ● Configure Parameters ○ ./configure --extra-cflags="-march=armv8.2-a+sve"
  • 7. Libraries ● Currently Upstreaming ○ glibc ○ musl ○ bionic ● cortex-strings ○ staging ground for mem/string functions ○ can be LD_PRELOADED ● If important to your workload ○ Build yourself!
  • 8. Running SVE programs ● Real Hardware ● Fast Models ○ Foundation Model ○ Fixed Virtual Platform ● ARMIE ● QEMU 3.0 linux-user
  • 10. What is QEMU linux-user mode? ● ○ ○ ○ ● ○ ○
  • 11. The Tiny Code Generator (TCG)
  • 12. Building QEMU $ ./configure --target-list=aarch64-linux-user --static $ make [-jN]
  • 13. Running with QEMU $ ./tests/Test_simd Illegal instruction (core dumped) $ qemu-aarch64 ./tests/Test_simd ... Current Grid git commit hash=ec9939c1ba8d61dbb2c583bfc2024c8f4baf608c: (HEAD -> develop, origin/develop, origin/HEAD) Grid : Message : 809944 usec : Requesting 1073741824 byte stencil comms buffers
  • 14. QEMU options ● CPU selection ○ -cpu [cortex-a53|cortex-a57|max] ● Debug output ○ -d [in_asm,...] ○ - dfilter 0xstart+0xrange ○ -D filename ● GDB Stub ○ -g 1234 ● Help ○ -help ○ -flag help
  • 15. QEMU gdbserver Run program: qemu-aarch64 -g 1234 <program> Attach debugger: gdb <program> -ex "target remote localhost:1234" ● Currently SVE registers (z/p) not viewable
  • 17. Program Start-up (ELF) ● Loader (INTERP) ● ld-linux.so ● finds and links libraries ● Link Libraries ● libc.so.6 ● and many more…. ● specific versions (HWCAP) ● Jump to main()
  • 18. Avoiding Library Clashes ● chroot ○ set new / ● containers ○ uses namespaces/control groups ● multi-arch ○ file-system layout
  • 19. Multi-Arch Support ● Builds on multi-lib ● supporting 32/64 bit user-space ● Side-by-side ● Shared Objects (.so libs) ● Headers ● Static libraries ● Versions must align
  • 20. binfmt_misc ● See /proc/sys/fs/binfmt_misc/ ● jar ● python ● qemu-FOO ● When kernel can’t run binary ● check magic numbers ● call helper ● System-wide setting ○ Shared with containers
  • 21. Setup binfmt_misc ● Distro specific ● Install qemu-user/qemu-user-binfmt ● use the static packages ● $(QEMU_SRC)/scripts/qemu-binfmt-conf.sh ○ update-binfmts (Debian) ○ systemd ○ direct /proc/sys/fs/binfmt_misc access
  • 22. Docker Builds in QEMU ● Builds on different Distros ○ CentOS, Fedora, Ubuntu, Debian, Travis ○ make docker-test-quick@centos7 J=n ● Cross-builds for different hosts ○ Using Debian Stretch + Multi-Arch Cross Compilers ○ Good for shaking out 64 bit assumptions! ○ make docker-test-build@debian-arm64-cross TARGET_LIST=aarch64-softmmu J=n ● Building TCG test-cases ○ Debian Cross Compilers (Stretch & Sid) ○ make -jN check-tcg ● Building linux-user containers ○ make docker-test-unit@debian-powerpc-user-cross J=n
  • 23. Docker Make Targets in QEMU ● Run test on distro ○ make docker-TEST-SCRIPT@DISTRO J=n ● Run test on all enabled distros ○ make docker-test-unit J=n ○ make docker-test-quick J=n ● Run all tests on all images ○ make docker-all-tests ● Help ○ make docker
  • 24. Docker binfmt targets ● Pre-requisites ○ binfmt_misc setup for /usr/bin/qemu-FOO ○ ./configure --disable-system --static ○ debootstrap/fakeroot installed ● Debootstrap ○ make docker-binfmt-image-debian-FOO DEB_ARCH=ARCH DEB_TYPE=DISTRO EXECUTABLE=QEMU
  • 25. Building Ubuntu ARM64 image make docker-binfmt-image-debian-ubuntu-bionic-arm64 DEB_ARCH=arm64 DEB_TYPE=bionic DEB_URL=http://ports.ubuntu.com EXECUTABLE=./aarch64-linux-user/qemu-aarch64 V=1
  • 26. Running your Ubuntu ARM64 image $ docker run --rm -it qemu:debian-ubuntu-bionic-arm64 /bin/bash root@e68be4cb7b0f:/# uname -a Linux e68be4cb7b0f 4.15.0-23-generic #25-Ubuntu SMP Wed May 23 18:02:16 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux root@e68be4cb7b0f:/# exit
  • 27. Setup Developer Environment $ docker run -it qemu:debian-ubuntu-bionic-arm64 /bin/bash root@c4dc9b5426ad:/# sed -i 's/main/main universe/' /etc/apt/sources.list root@c4dc9b5426ad:/# apt update root@c4dc9b5426ad:/# apt install -y gcc-8 g++-8 wget libtool autoconf libtool gdb less root@c4dc9b5426ad:/# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 1000 root@c4dc9b5426ad:/# update-alternatives --install /usr/bin/++ g++ /usr/bin/g++-8 1000 root@c4dc9b5426ad:/# gcc --version gcc (Ubuntu 8-20180414-1ubuntu2) 8.0.1 20180414 (experimental) [trunk revision 259383] ... root@c4dc9b5426ad:/# exit
  • 28. Save Developer Environment $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS NAMES c4dc9b5426ad qemu:debian-ubuntu-bionic-arm64 "/bin/bash" 2 hours ago Exited (0) adoring_goodall e174632927ba 238519b386bc "/bin/sh" 5 hours ago Exited (0) friendly_mayer ad33c7bc7558 0da2cdd3455f "/bin/sh" 8 hours ago Exited (0) silly_noether … $ docker commit -m "setup arm64 env" adoring_goodall development:bionic-arm64-sve sha256:25b770e5ce8a5b55ebbccad3b90b58a3474c4acdc5a70ca8ad42fdaf9f273f53
  • 29. Running Development Environment $ git clone https://git.linaro.org/toolchain/cortex-strings.git cortex-strings.git $ cd cortex-strings.git $ docker run --rm -it -u $(id -u) -v $(pwd):$(pwd) -w $(pwd) development:bionic-arm64-sve /bin/bash user@container:~/cortex-strings.git $ ./autogen.sh user@container:~/cortex-strings.git $ ./configure --with-sve --enable-static --disable-shared user@container:~/cortex-strings.git $ make -j
  • 30. Did it work? user@container:~/cortex-strings.git $ make check -j PASS: tests/test-memset … PASS: tests/test-strcmp ====================================================================== Testsuite summary for cortex-strings 1.1-2012.06~dev ====================================================================== # TOTAL: 12 # PASS: 12
  • 31. Advantages ● “Native” build ○ configure runs as if on real HW ○ no need of “cross” compiles ○ tests work out of the box ● Container ○ Is stable and fixed, works every time ○ Running environment is ephemeral ● Source Code ○ Stays on host file-system ○ Use your own tools/editors independent of container