DEV Community

Smit Gabani
Smit Gabani

Posted on

SPO Project : Auto-vectorization with iFunc - Stage 1

"ifunc"

ifunc was introduced for developers to create programs that can use advance SIM, SVE, SVE2 i.e. create multiple implementation of a function and select amongst them at runtime using a resolver function.

The resolver function is used to determine between the different implemented functions based on the system's architecture. i.e. to determine the appropriate function during runtime.

Auto-vectorization:

... where a computer program is converted from a scalar implementation, which processes a single pair of operands at a time, to a vector implementation, which processes one operation on multiple pairs of operands at once.

Automatic vectorization have three major implementation of SIMD instructions for AArch64, Advanced SIMD, SVE and SVE2. Some modern gcc compiler have option to choose from one of these implementations at runtime using the function ifunc.

**Learn about ifunc and autovectorization to implement the project.

The purpose of the created tool is:

Given a function create and implement an ifunc resolver.Then automatically compile the function using auto-vectorization for multiple SIMD systems.Or the runtime compiler will choose one from them and generate a single output file.

Call the program in place of compiling. In between assembly and linking phase.

The language I will be using: Python

I am comfortable coding and understanding pyton code and I know python has many library that I can use. The reason I an not using C or C++ is that I am not sure I can complete the project if I face any troble while working with C++. But at last I decided to work with C

I plan that my code produces 3 builds successfully and automatically select a build that is appropriate with the hardware. Then execute the build. Should get the output. Different output can be used.

The program will accept 2 files one will be the main file and other will be the argument. For testing case function.c file which will contain a single function which will get vectorized.

The tool will only work on aarch64 system. So the testing will be done on the israel machine. Will focus on three SIMD implementations: ASIMD, SVE and SVE2.

Steps:
Get argument using sys i.e. function.c file.

Linker function
Functions for different modules
will figure out in the future.

Challenges:

Rename the functions and add those to ifunc c file and header file
Calling the linking stage multiple times during building for different modules.

Top comments (0)