How wangyu-/mlsys20_workshop works
Project type and purpose
• This is an open-source research tool for “Energy-aware DNN Graph Optimization,” implemented in C++ with CUDA/cuDNN and Intel MKL backends. It provides:
• A core graph-representation and operator library
• A graph-substitution/optimization engine
• Power-measurement scripts and a small database of results
• Export utilities (e.g., to TensorRT)
• Its goal is to analyze, measure, and optimize DNN compute graphs for energy efficiency.
File structure
• Top-level:
• README.md, module.txt, qsub.txt (docs, submission hints)
• code/ (all C++ source, CUDA kernels, MKL-backed kernels, operator definitions, Makefile, scripts, data files)
• notused/ (legacy Python executor, install script)
• In code/:
• operator implementations: conv2d.*, pool2d.*, matmul.*, batchnorm.*, activation.*, concat.*
• Three backends: _cudnn.cu, _mkl.cc, pure CC versions
• Graph optimization: substitution.cc/.h, subst_examples.*
• Measurement tools and scripts: manual_measure.sh, measure_power.sh, db.txt
• Export to other frameworks: graph_to_trt.cc, export_graphs.sh
• Build: Makefile
• No classic frontend/backend split—this is a library/CLI tool with multiple modules.
README
• Confirms it’s a reproducible code base for the MLSys’20 workshop paper.
• Points to an online Wiki for architecture details.
• Notes it is based on MetaFlow (another graph optimizer).
Main components & their relationships
a. Core Graph Library
• Data structures (nodes, edges, operator definitions: code/ops.h, densenet.h, resnet.h, etc.)
b. Operator Backends
• cuDNN kernels (code/*_cudnn.cu)
• MKL kernels (code/*_mkl.cc)
• Reference C++ kernels (code/*.cc)
c. Graph Optimization Engine
• subst_examples.{cc,h}: sample transformations
d. Measurement & Profiling Module
• manual_measure.sh, measure_power.sh: harness to run specific operators or graphs and record power/time
• db.txt: stores measurement results
e. Export & Integration
• graph_to_trt.cc, export_graphs.sh: convert optimized graphs to TensorRT representations
f. Build & Glue
• code/Makefile
• cuda_helper.h/.cu, mkl_helper.h for abstraction
Architectural patterns and design principles
• Modular backends: each operator can be plugged in with either a CUDA, MKL, or reference implementation.
• Rule-based graph rewriting: the substitution engine applies transformation rules at the graph level.
• Data-driven tuning: measurement results in db.txt guide which substitutions to apply.
• Scripted orchestration: shell scripts glue together build, measurement, optimization, and export steps.
• Graph definitions → SubstitutionEngine
• SubstitutionEngine → Selected Backend Plugin
• Backend plugin → Measurement Harness → Database
• Optimizer ← Measurement results from Database
• Optimized Graph → Exporter → External Framework (TensorRT)
• Blue: Core library components
• Green: Backends
• Orange: Measurement & storage
• Purple: Export/integration
• Rectangles for modules