Skip to content

Static Analysis for Identifying Data Parallelism Using LLVM/Clang #4

@Ritanya-B-Bharadwaj

Description

@Ritanya-B-Bharadwaj

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions