llvm / llvm/llvm-project

Static Analysis for Identifying Data Parallelism Using LLVM/Clang

Open
#190,508 9 comments 1 reaction 0 assignees View on GitHub
incomplete
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

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`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.