ChrisCummins/ProGraML
A Graph-based Program Representation for Data Flow Analysis and Compiler Optimizations
What it solves
ProGraML provides a language-independent way to represent computer programs as graphs, making them suitable as input for machine learning models. It solves the problem of converting complex source code (like C, C++, LLVM-IR, and XLA) into a structured format that captures the essential logic and relationships of the program without being tied to a specific language's syntax.
How it works
The tool converts source code into a graph representation (specifically a protocol buffer) that captures every control, data, and call relation across the entire program. The core construction process is implemented in C++ for speed, with a Python interface for ease of use. Users can then transform these graphs into common machine learning graph formats like NetworkX, DGL, or JSON, or visualize them via Graphviz.
Who it’s for
It is designed for researchers and developers working on program analysis, compiler optimizations, and machine learning for code, specifically those needing a structured, expressive representation of programs for reasoning tasks at the whole-program, per-instruction, or per-relation level.
Highlights
- Language Independent: Supports C, C++, LLVM-IR, and XLA out-of-the-box.
- Fast Performance: Core graph construction is written in C++ with efficient parallelization support.
- Easy Integration: Simple
pip installwith no compilation required for the user. - Expressive Representation: Captures comprehensive control, data, and call relations.
- Multiple Export Formats: Supports NetworkX, DGL, Graphviz, and JSON.
Related
- Project
- Project
- Project
- Project