Automatic testing method and device based on SIMD library
Through automatic testing methods and devices, the problems of difficulty in selecting SIMD libraries and lack of benchmark tests are solved, and the appropriate SIMD libraries are automatically selected, which improves code readability and portability, and provides unified API and benchmark evaluation to meet users. Required SIMD library selection.
Patent Information
- Application Number
- CN202310375698.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-10
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2043-04-10
AI Technical Summary
When programming using SIMD technology, it is difficult for the prior art to effectively select the appropriate SIMD library, resulting in code portability and compatibility issues, and a lack of a unified benchmarking method to evaluate the performance and code size of different SIMD libraries.
Provide an automatic testing method and device based on SIMD library. By obtaining user targets and applications to be tested, the source files corresponding to each SIMD library are generated, and through compilation and performance testing, the SIMD with the smallest code size or the best performance is automatically selected. Library, providing a unified API to abstract different SIMD libraries, implementing automatic detection and selection.
Users can accurately find the SIMD library backend that meets their needs, reduce selection difficulties, improve code readability and portability, and evaluate the performance and applicability of different SIMD libraries through benchmarks in different fields.
Smart Images

Figure CN116594682B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer software engineering, and in particular relates to an automatic testing method and device based on a SIMD library. Background Art
[0002] SIMD (Single Instruction Multiple Data) is a classic computing model. It was first introduced in vector machines and is now an indispensable feature of most commercial microprocessors. SIMD extension describes the parallel processing of multiple data in a microprocessor with a single instruction. The registers used are unique SIMD registers, and multiple data can be stored in one register. During calculation, multiple data on the register are calculated simultaneously instead of a single data in sequence, thereby achieving parallel processing of data. As people's requirements for program processing performance increase, SIMD registers are also growing. Take Intel as an example, from the MMX technology introduced for image processing at the beginning to the instruction sets SSE, SSE2, SSE3, SSE4, and advanced vector extensions AVX and AVX2 introduced specifically for SIMD. AVX-512 was also introduced in 2013. The capacity of a SIMD register is 512 bits, which can store 16 single-precision floating-point numbers for simultaneous calculation, or 8 double-precision floating-point numbers for simultaneous calculation. In addition, SIMD instruction set extensions have also appeared in ARM, PowerPC and RISC-V architectures, such as NEON and SVE of ARM architecture, VMX of PowerPC and vector extension of RISC-V. SIMD technology helps improve the performance of multi-threaded applications and matrix calculations, and is widely used in computer graphics, video encoding and decoding, audio processing, signal processing and other fields.
[0003] In order to be applied to the underlying SIMD unit, the program code must first be adapted to the underlying hardware through vectorization. Vectorization is a programming technique that can improve the parallel performance of a program by applying a single instruction to multiple data. The easiest way is the compiler's automatic vectorization. These compilers implement one or more automatic vectorization passes, usually applying loop vectorization and superword-level parallelism (SLP). During such an optimization pass, the compiler analyzes the code and looks for instructions that can be converted from scalar to vector, and then converts them into corresponding vector instructions. For traditional automatic loop vectorization, this approach is successful for rule-compliant induced variables and statically analyzable inter-loop and intra-loop predictions, but it cannot vectorize code with complex control flow or structured data layout. Therefore, in order to better utilize the performance of SIMD, developers may need to manually vectorize the code. This may require a deep understanding of the SIMD instruction set and writing code specific to the underlying hardware, and may cause code portability issues.
[0004] When programmers choose to manually vectorize their code using intrinsics functions, they need to spend more effort to write the code. Intrinsics are low-level functions that implement all SIMD instructions in the processor architecture. Although they are at a higher level of abstraction than assembly programming, there are some disadvantages to coding with them, such as effort, portability, and compatibility. Despite this, intrinsic coding is still considered state-of-the-art and can achieve the greatest performance gains because of its low-level approach that can effectively utilize the hardware.
[0005] When programming with SIMD technology, we need to make a trade-off between workload and performance. In order to find a balance, researchers have been studying and developing more convenient programming models that can provide good performance while reducing workload. Due to issues such as portability, compatibility, and large workload of SIMD instruction sets, there are already many SIMD high-level abstraction libraries, such as VCL, Vc, highway, MIPP, and xsimd. These libraries mainly encapsulate intrinsics functions of different architectures through C++ template programming technology, abstract a layer above the intrinsics level, eliminate the details of the intrinsics functions, and provide readable and portable interfaces for users. These libraries can solve problems such as the non-portability, incompatibility, and large workload of SIMD instruction sets while retaining the high performance of intrinsics programming.
[0006] After the introduction of SIMD libraries, although the portability and compatibility issues were solved while maintaining high performance, more and more SIMD libraries have emerged. For example, VCL, Vc, highway, MIPP, xsimd, EVE, tsimd, nsimd, std_simd, Simde, ume::simd, etc. However, different SIMD libraries support different architectures, have different performance, generate different code sizes, and support different element types. Due to the large number of SIMD libraries, users are not sure how to choose the right SIMD library when using it to vectorize and accelerate their applications. Summary of the invention
[0007] In order to solve the above problems, the present invention provides an automatic testing method and device based on a SIMD library, which can help users accurately find a suitable SIMD library backend for a target application while meeting user requirements.
[0008] The technical contents of the present invention include:
[0009] An automatic testing method based on a SIMD library, the method comprising:
[0010] Get the user target and the application to be tested;
[0011] Vectorize the application program to be tested based on different SIMD libraries to obtain source files corresponding to each SIMD library;
[0012] Generate new files corresponding to each SIMD library according to the source files;
[0013] When the user's goal is code size testing, the new file is compiled to obtain a target file, and based on a text section in the target file, a SIMD library with a minimum code size is obtained;
[0014] When the user's goal is performance testing, the performance test is performed by embedding the test core code into the new file to obtain the SIMD library with the best performance.
[0015] Furthermore, the vectorizing the application program to be tested based on different SIMD libraries to obtain source files corresponding to each SIMD library includes:
[0016] A general API is abstracted on top of each SIMD library; wherein, the general API overloads the code of several versions of the SIMD library to allow the compiler to select the matching SIMD library in turn, so as to realize the implementation of corresponding functions of different SIMD libraries corresponding to the same function interface, and the functions provided by the general API include: basic arithmetic operations, storage and loading, reduce operations, mathematical functions, mask operations and logical operations.
[0017] The application program to be tested is sent to the general API to obtain source files corresponding to each SIMD library.
[0018] Furthermore, the general API includes: single instruction multiple data and single program multiple data; wherein the single instruction multiple data is the underlying SIMD instruction, and the single program multiple data is a plurality of different instantiated programs, and there is no dependency between the instantiated programs.
[0019] Furthermore, after generating new files corresponding to each SIMD library according to the source files, the method further includes:
[0020] Detect whether to obtain the local architecture parameters, and if the local architecture parameters are not obtained, automatically detect the local architecture to obtain the local architecture parameters;
[0021] According to the native architecture parameters, obtain the SIMD library that supports the native architecture;
[0022] Tests the user's target with SIMD libraries that support the native architecture.
[0023] Furthermore, after generating new files corresponding to each SIMD library according to the source files, the method further includes:
[0024] Check if the compiler path is empty;
[0025] When the compiler path is empty, select the system default compiler path;
[0026] If the compiler path is not empty, the compiler path specified by the user is selected.
[0027] Furthermore, when the user's goal is performance testing, the performance test is performed by embedding the test core code into the new file to obtain the SIMD library with the best performance, including:
[0028] Determine whether the test function name is the main function;
[0029] If it is the main function, insert the test core code into the main function to generate a test program;
[0030] If it is not the main function, delete the main function and insert the test core code to generate a test program;
[0031] When the test function parameters are correct, a SIMD library with the best performance is obtained based on the test program.
[0032] Furthermore, the test performance of the test core code includes one or more of: maximum running time, minimum running time, average value of performance, median value of performance, standard deviation of performance and number of runs.
[0033] An automatic testing device based on a SIMD library, the device comprising:
[0034] The acquisition module is used to obtain user targets and the application to be tested;
[0035] A general API, used for vectorizing the application program under test based on different SIMD libraries, and obtaining source files corresponding to each SIMD library;
[0036] The autobench module is used to generate new files corresponding to each SIMD library according to the source file; when the user's goal is code size testing, the new file is compiled to obtain a target file, and based on the text section in the target file, a SIMD library with the smallest code size is obtained; when the user's goal is performance testing, a performance test is performed by embedding the test core code into the new file to obtain the SIMD library with the best performance.
[0037] An electronic device, characterized in that the electronic device comprises: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, any of the above methods is implemented.
[0038] A computer-readable storage medium, characterized in that computer program instructions are stored on the computer-readable storage medium, and when the computer program instructions are executed by a processor, any of the above methods is implemented.
[0039] Compared with the prior art, the present invention can help users accurately find the appropriate SIMD library backend for the application being written while meeting the user's needs, and provides a set of benchmarks in different fields for users and library developers to explore the utilization of the underlying SIMD units, and to judge which fields different SIMD libraries are more friendly to through representative benchmarks in different fields. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 It is a diagram of the overall system architecture of the present invention.
[0041] Figure 2 It is the autobench front-end architecture diagram of the present invention.
[0042] Figure 3 It is a backend architecture diagram of the present invention.
[0043] Figure 4 It is a flow chart of the method of the present invention. DETAILED DESCRIPTION
[0044] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, the present invention is further described in detail below through its specific embodiments in conjunction with the accompanying drawings.
[0045] Currently, algorithms in various fields are using vectorization to take advantage of the underlying SIMD units to improve performance. For example, convolution operations and pooling operations frequently appear in the field of artificial intelligence. However, since there are too many SIMD libraries available on the market, users do not know how to choose the SIMD library that best suits their application field for vectorization. More precisely, there is a lack of a set of benchmarks that can be used to evaluate the performance of various SIMD libraries in various fields or the size of generated code, which is also the first problem.
[0046] In addition, some SIMD benchmarks use assembly language, GCC vector extension, and macro-wrapped intrinsics functions to vectorize scalar code to explore the characteristics of the underlying SIMD unit. However, these methods have some disadvantages. Assembly language is not very readable and is extremely dependent on the architecture and instruction set, which makes the same version of the code unable to be applied to different architectures and instruction sets. In addition, the writing requirements of assembly language are very high and it is not easy for ordinary programmers to learn. GCC Vector Extensions provides cross-architecture vector code portability for C and C++, but its use is still limited to the operations and builtin functions provided by GCC. In addition, the macro-wrapped intrinsics functions do not really hide the differences between architectures and instruction sets, and do not actually support portability. This requires defining a large number of macros for categories and operations in different SIMD instruction sets, which increases the workload and reduces code readability. This is also the second problem: some SIMD benchmarks use assembly language, GCC vector extension, and macro-wrapped intrinsics functions to vectorize scalar code. Some of these three methods do not support portability, and some are too limited.
[0047] When comparing the performance of different SIMD high-level abstraction libraries, since each library provides different user APIs, multiple benchmark codes need to be written for each library. This will lead to poor code reusability and more redundant code, which is the third problem. In addition, due to the large number of SIMD libraries, users are unclear about how to choose the right SIMD library when using it to vectorize and accelerate their own applications, which is the fourth problem.
[0048] In response to the above problems, Figure 1-3As shown, the present invention abstracts a unified API layer on top of many different SIMD libraries, and uses different SIMD library implementations as the backend of the unified API (the third problem is solved here); we provide a set of benchmark codes for different fields written using a unified API, including convolution and pooling benchmarks in the field of artificial intelligence, blackscholes in the field of economics, mandelbrot and julia in the field of mathematics, and other representative benchmarks (the first and second problems are solved here); considering that the classic benchmarks in each field mentioned above are representative, they cannot represent that all programs in the field are suitable for this SIMD library. Therefore, we provide an automatic testing system. When users use the API provided by us to write vectorized code, they can use the automatic testing system to perform real-time testing and select the SIMD library backend that meets the user's needs (the fourth problem is solved here).
[0049] That is, the user uses the API provided by the present invention to manually vectorize his own application as the input of autobench. In addition, the user needs to specify the function that needs to be tested in the application and pass it into autobench as a parameter. If the user wants to test the entire file, just pass it into the main function. In addition, since different compilers and compilation parameters have different effects on performance or generated code, the user also needs to input the compiler path and compilation parameters that he wants to test in the local machine as the input of autobench. Finally, according to the user's needs, whether to obtain the best performance or the smallest generated code is passed in as the target. After passing in the above parameters, autobench will test the application in real time and output a SIMD backend that meets the user's needs.
[0050] Specifically, the automatic testing method based on SIMD library of the present invention is as follows: Figure 4 As shown, the process includes the following steps (1-3).
[0051] Step 1: The user manually vectorizes the application program to be tested using the general API provided by the present invention to obtain a source file, and uses its path as one of the autobench inputs.
[0052] The user manually vectorizes the application to be tested by using various functions provided by the general API provided by the present invention. The various functions provided by the API include basic arithmetic operations, storage and loading, reduce operations, mathematical functions, mask operations and logical operations. The source file path after vectorization is completed is used as the input of the autobench module.
[0053] In one embodiment, the details of the general API are as follows. Whether it is the intrinsics function or the function provided by the SIMD high-level abstraction library, they all utilize the underlying SIMD instructions, so the specific operation still depends on the type of SIMD instruction operation. Different SIMD libraries simply abstract easy-to-understand interfaces on top of these intrinsics functions, making it easier for users to develop their own programs. And each intrinsic function usually corresponds to a vector instruction, so these two programming models, namely intrinsics programming and simd high-level abstraction library, have a common source.
[0054] Taking the AVX2 instruction set of x86 as an example, intrinsics provide three different vector types: __m256i represents a 256-bit integer vector type, __m256 and __m256d represent 256-bit single floating point and double floating point vector types respectively. The simd high-level abstraction library wraps these vector types through C++ class templates to design a highly readable C++ custom type, such as EVE's wide <tp>and wide <Tp,fixed <n>> type. Then, through the instruction set dispatch technique, these custom types can statically or dynamically select the corresponding instruction set. The similarity of custom types in different simd libraries is that they basically abstract two types, namely, the best instruction set type for a specified platform and the custom type for user-specified vector length or instruction set. For example, batch in xsimd <tp>and batch<Tp,arch> 、nsimd's pack <tp>and pack<Tp,N> and native_simd of std_simd <tp>and fixed_size_simd<Tp,N> . It can be seen that the types defined by these simd libraries have the same characteristics. One is to select the best instruction set type for the platform based on the basic element type Tp, and the other is a user-defined type that specifies the vector length or instruction set. Therefore, this test system selects the best instruction set vector type for the specified platform as different backend types xxxx_t_v_native based on this same characteristic, and selects different backends by passing different backend types to evaluate different programming models. For the operations provided by different simd libraries, they can be roughly divided into the following types according to the wrapped intrinsics functions: data movement, reduction operations, mask operations, and shuffles operations. In order to implement the corresponding functions of different SIMD libraries corresponding to the same function interface, we overloaded the code of several versions of the SIMD library in turn to let the compiler select the matching SIMD library implementation. For some type constraints, we used the concepts of C++20 and the characteristics of the requires clause. For some special element type requirements, we made type constraints at the interface of the test system, such as shift operations require the element type to be integer and exponential operations require the element type to be floating point. In addition, for different vector types VecNT of the VCL library, in order to reduce unnecessary overloading, we use conditional compilation to obtain the type corresponding to the current instruction set during compilation. For example, when passing the -mavx option, we will select different types such as Vec8f, Vec4d, Vec8i according to the basic element type. In turn, determine the VCL type wrapped by the vcl_t_v_native type under the current instruction set. In order to detect whether the semantics of different benchmarks are the same, we designed a test module to determine whether the running results of the system function interface of each overloaded version are the same. Since different benchmarks are wrapped by a set of code to implement different simd libraries, the code logic of each SIMD library is the same, so you only need to test whether different interfaces are correct to know whether the semantics of the benchmark are the same. In terms of code reusability, it originally required more than 1,000 lines of code to be written, but now it only takes more than 100 lines to implement. For other SIMD libraries added later, we can easily create a xxx_core.h header file and add it according to the packaging method of other libraries. In the test module, we only need to add the type of the newly added simd library in the header file, which greatly increases the reusability of the code.
[0055] Optionally, the general API of the present invention can achieve SPMD+SIMD. SIMD is single instruction multiple data, that is, the API uses the underlying SIMD instructions, and SPMD is single program multiple data. SPMD means that the same program is copied to each processor, while different data is distributed on different processors. In this way, each processor in the system runs the same program, but performs operations on different data.
[0056] The code of an example is as follows:
[0057] AXPY_SIMD <scalar t v <elemtype>,ElemType>(a,x,y,res);
[0058] AXPY_SIMD<highway_t v_native <elemtype>,ElemType>(a,x,y,res);
[0059] AXPY_SIMD<eve t v native <elemtype>, ElemType>(a,x,y,res);
[0060] In the above code, the single program refers to the AXPY_SIMD program, but we pass three different template parameters to the same program, that is, there are three different instantiation programs, and there is no dependency between each program. In this way, the three different instantiation programs are run in three threads, and each thread uses the underlying SIMD instructions, so that SPMD+SIMD parallelism can be achieved.
[0061] Step 2: The user enters the remaining parameters of autobench according to his or her needs.
[0062] Autobench is a script program written in Perl language, with the test core embedded inside. First, after receiving the source file path, autobench copies a new file. According to the test requirements, autobench will delete the main function in the copied file as a whole. Then, according to the function name, function parameters and element type entered by the user (because the different element types have a great impact on performance), the test code is embedded into the copied file. By passing in different backend types, real-time testing is performed according to the compiler path and compiler parameters passed in by the user. Then, autobench will redirect the output content to a txt file, and use text processing to filter out the SIMD backend type with the best performance and output it to the user.
[0063] Regarding the real-time test of generated code size, autobench generates different target files by executing different SIMD backends in sequence according to the source file path, compiler path, compiler parameters, and element type passed in by the user. Then, it outputs the SIMD backend type with the smallest generated code size to the user based on the text section in the target file.
[0064] In one embodiment, the user target is the user's indicator for the application to be tested, such as performance or generated code size. The choice of compiler path is to select the system default compiler path or the user-specific compiler path. Since different compiler types will cause different results, autobench will select the default compiler path by default. The compiler parameter is the compilation option when the compiler is compiled. Since different compilation options will cause different results, this parameter can be omitted. The element type parameter is the type of vector element in the user's own application program when vectorizing it. Since different element types will cause different results. The test function name is a specific function name in the source file to be tested. If you want to test the entire program, you need to pass in "main". The test function parameters are the actual parameters that need to be provided in the function to be tested. The native architecture is the processor architecture type that autobench runs, such as x86, RISCV, etc. This parameter can be omitted, and autobench will automatically detect the native architecture type.
[0065] Step 3: Autobench will test the application under test based on the provided parameters and finally output the SIMD backend type that meets the user's goals.
[0066] In one embodiment, the present invention tests the application to be tested including the following steps (3.1-3.7):
[0067] Step 3.1: The user inputs the source file path to be tested and the remaining parameters of autobench into the autobench module.
[0068] Step 3.2: The autobench module first detects whether the user has passed in the "native architecture" parameter. If not, autobench automatically detects the native architecture. Autobench detects whether there is a library supporting this architecture in all simd backends based on the native architecture parameter. If not, the program will be terminated and an error will be output. If so, proceed to step 3.
[0069] Step 3.3: Autobench detects whether the compiler path is empty. If it is empty, it selects the system default compiler path. If it is not empty, it selects the user-specified compiler path.
[0070] Step 3.4: Autobench selects whether to perform a performance test or a code size test based on the "user goal" parameter provided by the user. If it is a code size test, the application to be tested is compiled, and the SIMD backend with the smallest generated code size is calculated based on the .text segment of the target file obtained after compilation as output. If it is a performance test, proceed to step 5.
[0071] Step 3.5: Autobench determines whether the "test function name" parameter is the main function. If it is the main function, it tests the performance of the entire program and inserts the test core code inside the main function for testing. If it is not the main function, according to the requirements of the test core, the main function is deleted and the test code is inserted.
[0072] Step 3.6: Autobench determines whether the "test function parameters" are correct. If not, an error message will be displayed, prompting the user to enter the correct function parameters. If correct, proceed to step 7.
[0073] Step 3.7: The test core provided by autobench tests the program to be tested and finally outputs the SIMD backend type with the best performance.
[0074] In summary, the present invention aims at various differences in the numerous SIMD libraries that have emerged to solve the problems of readability and portability, and adds a layer of abstraction on top of each SIMD library, so that each SIMD library becomes the back end of the test system. Users can directly use the unified abstraction provided by us to write SIMD vectorized code, but when selecting different SIMD back ends, users may not be able to choose the SIMD back end type that meets their goals according to their needs for a while. In order to alleviate the difficulty of user selection, we designed the autobench module as the front end of our system. The autobench module will test the source files and various parameters input by the user in real time locally, and output the SIMD back end type that meets the user's needs. In addition, we also provide a set of benchmarks for different fields, which are written using the unified API abstraction layer designed by us for reference by a large number of testers.
[0075] A person skilled in the art may modify or make equivalent substitutions to the technical solution of the present invention, and the protection scope of the present invention shall be subject to the claims.< / elemtype> < / elemtype> < / elemtype> < / tp> < / tp> < / tp> < / n> < / tp>
Claims
1. An automatic testing method based on SIMD library, characterized in that: The method comprises: Get the user target and the application to be tested; Vectorizing the application program to be tested based on different SIMD libraries to obtain source files corresponding to each SIMD library; wherein vectorizing the application program to be tested based on different SIMD libraries to obtain source files corresponding to each SIMD library includes: A general API is abstracted on top of each SIMD library; wherein the general API overloads the code of several versions of the SIMD library to allow the compiler to select a matching SIMD library in turn, so as to implement the implementation of corresponding functions of different SIMD libraries corresponding to the same function interface, and the functions provided by the general API include: basic arithmetic operations, storage and loading, reduce operations, mathematical functions, mask operations and logical operations; Sending the application program to be tested into the general API to obtain source files corresponding to each SIMD library; Generate new files corresponding to each SIMD library according to the source files; When the user's goal is code size testing, the new file is compiled to obtain a target file, and based on a text section in the target file, a SIMD library with a minimum code size is obtained; When the user's goal is performance testing, the performance test is performed by embedding the test core code into the new file to obtain the SIMD library with the best performance.
2. The method according to claim 1, characterized in that The general API includes: single instruction multiple data and single program multiple data; wherein the single instruction multiple data is the underlying SIMD instruction, and the single program multiple data is a plurality of different instantiated programs, and there is no dependency between the instantiated programs.
3. The method according to claim 1, characterized in that After generating new files corresponding to each SIMD library according to the source files, the method further includes: Detect whether to obtain the local architecture parameters, and if the local architecture parameters are not obtained, automatically detect the local architecture to obtain the local architecture parameters; According to the native architecture parameters, obtain the SIMD library that supports the native architecture; Tests the user's target with SIMD libraries that support the native architecture.
4. The method according to claim 1, characterized in that After generating new files corresponding to each SIMD library according to the source files, the method further includes: Check if the compiler path is empty; When the compiler path is empty, select the system default compiler path; If the compiler path is not empty, the compiler path specified by the user is selected.
5. The method according to claim 1, characterized in that When the user's goal is performance testing, the performance test is performed by embedding the test core code into the new file to obtain the SIMD library with the best performance, including: Determine whether the test function name is the main function; If it is the main function, insert the test core code into the main function to generate a test program; If it is not the main function, delete the main function and insert the test core code to generate a test program; When the test function parameters are correct, a SIMD library with the best performance is obtained based on the test program.
6. The method according to claim 1, characterized in that The test performance of the test core code includes: one or more of: maximum running time, minimum running time, average value of performance, median value of performance, standard deviation of performance and number of runs.
7. An automatic testing device based on SIMD library, characterized in that: The device comprises: The acquisition module is used to obtain user targets and the application to be tested; A general API, used to vectorize the application program under test based on different SIMD libraries to obtain source files corresponding to each SIMD library; wherein, vectorizing the application program under test based on different SIMD libraries to obtain source files corresponding to each SIMD library includes: A general API is abstracted on top of each SIMD library; wherein the general API overloads the code of several versions of the SIMD library to allow the compiler to select a matching SIMD library in turn, so as to implement the implementation of corresponding functions of different SIMD libraries corresponding to the same function interface, and the functions provided by the general API include: basic arithmetic operations, storage and loading, reduce operations, mathematical functions, mask operations and logical operations; Sending the application program to be tested into the general API to obtain source files corresponding to each SIMD library; The autobench module is used to generate new files corresponding to each SIMD library according to the source file; when the user's goal is code size testing, the new file is compiled to obtain a target file, and based on the textsection in the target file, the SIMD library with the smallest code size is obtained; when the user's goal is performance testing, the performance test is performed by embedding the test core code into the new file to obtain the SIMD library with the best performance.
8. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.
