Compiler Vector Variant Address Maps for Indirect Call Vectorization
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing compilers fail to vectorize indirect function calls in programming languages like C and C++, which limits the concurrent processing capabilities of SIMD computer architectures since function identities are determined at runtime, preventing efficient execution of loops containing function calls.
Innovation Solution
A compute device with a compiler module that generates offset maps and vector variant address maps at compile time, allowing deterministic mapping of function pointers to vector variants, enabling efficient vectorization and execution of indirect function calls at runtime.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If indirect function calls are used in loops, then programming flexibility and runtime adaptability are improved, but vectorization capability and concurrent processing efficiency deteriorate
Solution Approach 1:
The compiler performs preliminary analysis at compile time to identify all possible target functions that indirect function pointers may reference. It generates multiple vectorized versions of each candidate function and creates a mapping table that associates each function pointer with its corresponding vectorized variant, enabling runtime selection without sacrificing vectorization benefits.
Solution Approach 2:
The invention changes the parameter representation by transforming function pointers into indices that reference a pre-computed mapping table. This allows the runtime system to select among multiple vectorized function variants by simply changing the index parameter, maintaining both flexibility and performance.
2Device complexity
If indirect function calls are sequentially executed, then runtime overhead is reduced, but loss of SIMD capabilities and processing speed deteriorate
Solution Approach 1:
The compiler performs preliminary vectorization of all candidate functions before runtime execution. It generates optimized vectorized code for each possible target function and prepares mapping tables that enable direct jumps to these pre-compiled vectorized variants, eliminating the need for sequential scalar execution at runtime.
Solution Approach 2:
The invention introduces mapping tables as an intermediary structure between function pointers and their target implementations. These tables store pre-computed offsets or addresses that directly reference vectorized function variants, serving as a mediator that enables fast runtime dispatch without sacrificing vectorization.
3Productivity
If vector variants are generated for all scalar functions, then concurrent processing capability is improved, but manufacturing complexity and memory usage increase
Solution Approach 1:
The compiler applies vectorization selectively based on local analysis of each function's characteristics and the specific loop context. It generates vectorized variants only for functions that are both candidates for indirect calls and suitable for vectorization, rather than universally vectorizing all functions, thus reducing unnecessary complexity.
Solution Approach 2:
The invention performs partial vectorization by generating vectorized variants only for the subset of functions that are actual targets of indirect calls in vectorizable loops. This partial action approach avoids the excessive complexity of vectorizing all possible functions while still achieving concurrent processing for the relevant cases.
Data Source
AI summary
Technologies for indirectly calling vector functions include a compute device that includes a memory device to store source code and a compiler module. The compiler module is to identify a set of declarations of vector variants for scalar functions in the source code, generate a vector variant address map for each set of vector variants, generate an offset map for each scalar function, and identify, in the source code, an indirect call to the scalar functions, wherein the indirect call is to be vectorized. The compiler module is also to determine, based on a context of the indirect call, a vector variant to be called and store, in object code and in association with the indirect call, an offset into one of the vector variant address maps based on (i) the determined vector variant to be called and (ii) the offset map that corresponds to each scalar function.


