Project Plan - 2

INTRODUCTION 

Hello, this blog is about the first version of the device that I am trying to make it. which is going to copy the function 3 times in different manner in file using auto-vectorization.The function that is given as the argument is created in three different ways by this device. When creating the main output file from these routines, this device leverages the ifunc capability to select the optimum approach.

PROCEDURE 

The second argument, function.c, is initially read before anything else. But before that, I used the Sys library to retrieve an array of parameters. By doing this, I was able to get the filename for both the first and second inputs. I was able to store the names of both files in two variables as a result. I then used the fopen() technique to read the function.c file. I then used std::string::find and std::string::replace to alter the function's name. After reviewing the function, I changed the function name and printed the f function three times. For Advanced SIMD, I prefixed the function name with asimd. I added sve and sve2 for SVE and SVE2, respectively.

I then replaced printf with the appropriate message in each of the functions. After three iterations, I wrote the code three times in the directories function1.c, function2.c, and function3.c. As a result, the device was able to construct three different functions. The ifunc.h header file was then created. I needed the function prototype to make this happen. I extracted the prototype with str.find (). I retrieved the prototypes of all three functions and stored them in three variables. The three prototypes were then combined, and I saved them in a brand-new file called "ifun.h." ifunc.h, a header file, was created as a result.

The ifunc.c file needed to be written at this point. To do this, I created a template first. I created a template using the lecturer's open source code for the resolver. I selected a portion of the template that I had created for this purpose and saved it. I then typed some placeholders that I would later replace with function prototypes. After reading the template from this file in implement.c, I placed it in variables. I then swapped out placeholders that had been there before by using str.replace. All three of the earlier retrieved prototypes from the functions were modified before being included to the template.In this manner, I produced the resolver function in the file ifunc.c.

The final phase was creating three functions that produced three output files, then using ifunc to connect those output files to create the main binary output file. To do this, I created a bash script. 
The following commands create three different versions of functions: 
gcc -g -O3 -march=armv8-a -c function1.c -o function1.o
gcc -g -O3 -march=armv8-a+sve -c function2.c -o function2.o
gcc -g -O3 -march=armv8-a+sve2 -c function3.c -o function3.o
The last gcc command was then added to link all the files together and produce the primary binary output file.

TOOLS

The primary output binary file is produced with this utility. However, it will also produce a number of output files or C files beside it. The list of files produced during tool execution is provided below.
  • main : The output binary file.
  • ifunc.c : The ifunc function, which is the resolver that chooses the best version of SIMD implementation at runtime, is contained in this c file.
  • ifunc.h :This file serves as the ifunc.c header and contains function prototypes.
  • function1.c : This is ASIMD's initial implementation of the function.
  • function2.c : This is SVE's second iteration of the function.
  • function3.c : For SVE2, this is the third iteration of the function.
  • function1.o : Produced an output file after creating function1.c.
  • function2.o : Produced an output file after creating function2.c.
  • function3.o : Produced an output file after creating function3.c.

GITHUB LINK : https://github.com/mdpatel1/spo600Project.git
I have written the function copying and creating part in this code.

TEST

To run the simple clone the my GitHub and write the command call python tools.py argument1  argument2 and then clone the test file and then run the command python tools.py main.c function.c

Comments

Popular posts from this blog

ifunc function

Lab2 - 6502 Assembly Language Lab(Calculation)

Lab1 - 2 Open Sources Packages