Difference between revisions of "SVE2"

From CDOT Wiki
Jump to: navigation, search
(Resources)
(Resources)
Line 6: Line 6:
 
* '''Introduction to SVE2''' - https://developer.arm.com/documentation/102340/0001/?lang=en
 
* '''Introduction to SVE2''' - https://developer.arm.com/documentation/102340/0001/?lang=en
 
* Intrinsics - Arm C Language Extensions for SVE (ACLE) - https://developer.arm.com/documentation/100987/latest
 
* Intrinsics - Arm C Language Extensions for SVE (ACLE) - https://developer.arm.com/documentation/100987/latest
* ARM Compiler User Guide - Note that this documentation is specific to Arm's own compiler, but most of it will be applicable to other compilers including gcc - https://developer.arm.com/documentation/100748/0616/SVE-Coding-Considerations-with-Arm-Compiler
+
* SVE Coding Considerations with Arm Compiler - Note that this documentation is specific to Arm's own compiler, but most of it will be applicable to other compilers including gcc - https://developer.arm.com/documentation/100748/0616/SVE-Coding-Considerations-with-Arm-Compiler
  
 
== Building SVE2 Code ==
 
== Building SVE2 Code ==

Revision as of 14:51, 8 March 2022

The Armv9 Scalable Vector Extensions verision 2 (SVE2) provide a variable-witdh SIMD capability for AArch64 systems.

Resources

Building SVE2 Code

C Compiler Options

To build code that includes SVE2 instructions, you will need to instruct the complier or assembler to emit code for an Armv8a processor that also understands the SVE2 instructions; this is performed using the -march= option (which is read as "machine architecture"). The architecture specificaion for this target is currently "armv8-a+sve2":

gcc -march=armv8-a+sve2 ...

Remember that in order to invoke the autovectorizer in GCC version 11, you must use -O3:

gcc -O3 -march=armv8-a+sve2 ...

Using SVE2 Intrinsics Header Files

To use SVE2 intrinsics in a C program, include the header file arm_sve.h:

#include <arm_sve2.h>

Running SVE2 Code

To run SVE2 code on an Armv8 system, you can use the QEMU usermode system. This will trap SVE2 instructions and emulate them in software, while executing Armv8a instructions directly on the hardware:

qemu-aarch64 ./binary
Idea.png
Running AArch64 code on x86_64
The QMEU user mode software can also be used to run AArch64 code on an x86_64 system (albeit slowly). However, this requires a full AArch64 userspace (applications and tools, such as ld) to be installed on the x86_64 system.