$ show NVlabs/timeloop
Timeloop is a framework for modeling, mapping, and design-space exploration of dense and sparse tensor algebra workloads on hardware accelerators. It combines a polyhedral analysis engine (based on the Integer Set Library, ISL) with a configurable architecture model to evaluate mappings (tiling, permutation, datatype bypass) in terms of energy, latency, and area. The primary application is the `timeloop-mapper` executable, which searches over a customizable mapping space using strategies like exhaustive, random, hybrid, or pruned search. A companion `timeloop-model` evaluates a single mapping, and `timeloop-metrics` computes detailed statistics. The codebase is predominantly C++ with Python scripts for automation and post-processing. It also includes subprojects: **Tenssella** (a polyhedral-based emulation and code generation framework) and **Orojenesis** (a Python tool for deriving operational intensity bounds of fused tensor algorithms). While the core is a robust software tool for accelerator architects, the presence of experimental subdirectories, multiple code generations, and research-oriented features (sparse tensor compression, density models, fused workloads) gives it a hybrid characterβpart production tool, part research prototype. The architecture is modular, with clear separation between mapping representation, loop analysis, hardware modeling, and search algorithms. Key entry points include `src/applications/mapper/mapper.cpp` and `src/applications/model/model.cpp`. External dependencies include ISL, barvinok, Boost, yaml-cpp, and libconfig.
The LLM identified 4 files worth highlighting for reuse:
Provides a unified configuration interface that abstracts over libconfig (`.cfg`) and YAML formats. Features hierarchical key lookup, variable substitution, type conversion, and node manipulation. The implementation uses a dual-backend strategy (libconfig vs yaml-cpp) with a common `CompoundConfigNode` interface. This component is isolated, well-tested, and could be extracted for any project needing a flexible config parser.
Encapsulates common ISL operations (reorder, project, apply, intersect, etc.) in a C++ interface with automatic context management. Reduces the boilerplate of raw ISL C API calls and provides thread-safe context creation. Reusable in any project that uses ISL for polyhedral analysis, provided the same ISL version is available.
Contains generic C++ templates for combinatorial enumeration: `CartesianCounter` (iterates over Cartesian product of ranges), `Factoradic` (factorial number system), and `Factors` (multiplicative decomposition). These are header-only, have no internal dependencies, and solve common problems in search-space enumerationβdirectly reusable in other projects.
Implements a thread-safe synchronization primitive `Buffet<T>` that models a buffer with states (Empty, Ready, Locked) and uses condition variables for blocking and signaling. It supports multi-reader, multi-writer with configurable capacity and access patterns. This is a generic, well-crafted pattern for pipelined or buffered concurrency in emulation or simulation contexts.