forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 98
Open
Description
Develop a static analysis tool using LLVM/Clang to identify functions in C/C++ code that exhibit data parallelism, i.e. performing the same operation on independent data elements. The tool should emit a diagnostic message for each function demonstrating data parallelism.
Key Tasks
- Introduce a new command-line option (e.g., -analyze-data-parallelism) to enable the data parallelism analysis.
- Define what constitutes data parallelism (e.g., independent iterations of loops).
- Determine patterns and indicators of data parallelism in LLVM IR.
- Identify loops and determine if iterations are independent (i.e., no data dependencies).
- Emit diagnostics for functions with data parallelism, explaining the detected data parallelism.
Example(s)
Data Parallelism
void compute(float* data, int N) {
for (int i = 0; i < N; ++i) {
data[i] = sin(data[i]) + cos(data[i]);
}
}
No Data Parallelism
void process(float* data, int N) {
for (int i = 0; i < N; ++i) {
if (data[i] > 0) {
data[i] = sqrt(data[i]);
}
}
}
Expected Output
Function 'compute' has data parallelism: - Independent loop iterations detected at line 42
Metadata
Metadata
Assignees
Labels
No labels