$ show flexflow/flexflow-train
FlexFlow Train is a deep learning framework that automatically parallelizes and distributes neural network training across GPU/CPU clusters. The system ingests models from PyTorch, Keras, ONNX, or its own C++ API, converts them into a computation graph, and then applies a multi-stage optimization pipeline: graph-level substitutions (pattern matching and rewriting), series-parallel decomposition, cost estimation, and machine mapping via MCMC or dynamic programming. The optimized parallel graph is executed on the Legion/Realm runtime, coordinating distributed tasks across devices. The codebase is organized as a C++ library with Python bindings, comprising ~3500 files including kernels, a compiler, graph utilities, and model definitions. While the core architecture demonstrates sophisticated engineering with extensive tests and reusable graph abstractions, the repository carries significant complexity from heavy template metaprogramming, two execution backends, and partially implemented CPU/HIP kernels, making it more suitable for integration by teams with C++ and distributed systems expertise.
The LLM identified 2 files worth highlighting for reuse:
A comprehensive, templated graph library offering multiple abstraction levels (digraph, dataflow, kwarg, labelled, open) with algorithms for topological ordering, transitive reduction, series-parallel decomposition, and isomorphism detection. The design uses query-based edge/vertex access and copy-on-write semantics, making it reusable for any computational graph or DAG analysis task. Tests and property-based checks exist for many components.
A pattern-matching and graph rewriting framework that operates on parallel computation graphs. It supports unlabelled and operator-attribute-constrained patterns, output graph expressions, and shape inference after substitution. The core abstractions (pattern, substitution, apply) are decoupled from FlexFlow's specific operators and could be extracted for any graph transformation problem in compilers or optimization.