Introduction to the Glow Project
The Glow project is a pioneering initiative in the field of machine learning, centered around creating a compiler and execution engine specifically for hardware accelerators. Glow aims to serve as a backend for high-level machine learning frameworks, offering cutting-edge optimizations and code generation for neural network graphs. This project is continuously evolving, with plans and developments tracked in its GitHub issues section and detailed in the Glow Roadmap.
Project Partners
Glow thrives on collaboration and contributions from a diverse group of partners, including industry leaders like Bitmain, Habana, Intel, and Synopsys. These partnerships demonstrate the broad support and engagement from the technology community, which aims to drive innovation and development within Glow.
How Does Glow Work?
Glow operates by transforming a traditional neural network dataflow graph into a multi-phase, strongly-typed intermediate representation (IR). The high-level IR enables the optimizer to execute domain-specific optimizations, while a lower-level instruction-based IR focuses on memory-related optimizations such as instruction scheduling and static memory allocation. This sophisticated process culminates in machine-specific code generation to leverage specialized hardware features optimally.
A key innovation within Glow is its lowering phase, which simplifies the input space and facilitates the addition of new hardware backends. This phase eliminates the need to implement all operators on all targets, allowing developers to concentrate on a few essential linear algebra primitives. The design and methodology behind Glow are elaborated in an arXiv paper.
Getting Started with Glow
System Requirements
Glow is compatible with macOS and Linux platforms. It requires a modern C++ compiler that supports C++11, as well as dependencies like CMake, LLVM (version 7.0 or later), glog, protocol buffers, and libpng.
Installation
To begin using Glow, the repository must first be cloned from GitHub:
git clone [email protected]:pytorch/glow.git # or: git clone https://github.com/pytorch/glow.git
cd glow
Glow relies on certain submodules (googletest, onnx, and FP16 conversion libraries), which can be initialized with:
git submodule update --init --recursive
Platform-specific Instructions
On macOS, dependencies can be installed using Homebrew or MacPorts. Ubuntu users need to install specific packages, as outlined in the provided instructions.
Building and Testing Glow
To compile Glow, a build directory should be created, and CMake commands must be executed, followed by building with Ninja or another CMake generator:
mkdir build_Debug
cd build_Debug
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ../glow
ninja all
Glow includes multiple unit tests to ensure reliability and functionality. Tests can be executed using:
ninja test
Running C++ API Examples
Glow offers various test programs demonstrating its capabilities in image classification and language modeling, such as mnist
, cifar10
, and ptb
. After downloading necessary datasets, these programs can be run to observe Glow's performance and capabilities.
Contribution and Collaboration
Contributions to Glow are warmly welcomed. Interested collaborators can follow guidelines outlined in the project's Contributing Guide, Coding Standards, and Code of Conduct. Discussions and further collaboration take place in forums like the PyTorch discussion platform with a dedicated "glow" category.
Licensing
Glow is distributed under the Apache 2.0 License, ensuring it remains open-source and accessible for continued growth and improvement.
In summary, the Glow project stands as a versatile and innovative initiative in machine learning, backed by strong industry collaboration and detailed design philosophy. Its commitment to optimization, accessibility, and community contribution make it a valuable endeavor in the realm of hardware-accelerated machine learning.