DNN compiler, Apache TVM, Hummingbird and ONNX-MLIR


This is an article for MLOps Advent Calendar 2022.

Deep neural networks (DNNs) are complex machine learning models that are composed of multiple layers of interconnected nodes, or “neurons,” which are used to process and analyze large amounts of data. These models are typically trained using vast amounts of data and require significant computational resources to run. To optimize the performance of DNNs, many tools and technologies have been developed, including DNN compilers. DNN compiler is a software tool that is used to optimize the performance of DNNs by reducing the computational resources required to execute them. This is achieved through a variety of techniques, including graph optimization, hardware specific optimization, and code generation.

One of the most popular DNN compiler is Apache TVM. TVM is an open-source DNN compiler that is designed to optimize the performance of DNNs on a wide range of hardware platforms, including CPUs, GPUs, and DNN accelerators. TVM uses a combination of hardware agnostic optimization techniques, such as graph optimization, and hardware-specific code generation to achieve great performance improvements for DNNs.

Another DNN compilers is ONNX-MLIR. ONNX-MLIR is an open-source compiler infrastructure that is designed to support the optimization and deployment of machine learning models with ONNX format. It is built on top of the MLIR (Multi-Level Intermediate Representation) framework which was developed by Google. MLIR is also used in TensorFlow for model optimization.

Microsoft’s Hummingbird is another tool that is related to DNN compilers. Hummingbird is an open-source Python library that is designed to optimize traditional machine learning models by compiling them into tensor computations that is friendly to GPU/TPU. The supported models includes Scikit-learn, XGBoost, and LightGBM and can be converted into PyTorch, ONNX and TVM formats.

In summary, DNN compilers are an important tool for optimizing the performance of deep neural networks. By reducing the computational resources required to run DNNs and optimizing them for specific hardware platforms, DNN compilers can help to make machine learning more accessible and widely available. Tools such as Apache TVM, ONNX-MLIR and Hummingbird are examples of DNN compilers that are used to optimize the performance of DNNs in various situations.