Input Formats
Top-Level Keys
Timeloop and Accelergy take inputs in the form of a YAML file with specific top-level keys. These top-level keys may be included in one or more files (one or more top-level keys per file) that are concatenated together by the tool.
Some keys are used only for one of the programs or are optional. So a skeleton input with the top-level keys for a run of timeloop-mapper
would look like:
problem:
...
architecture:
...
sparse_optimizations:
...
contraints:
....
mapper:
....
The following top-level keys are available to the Timeloop+Accelergy
specification.
Top-level keys that are wrapped in * may be specified multiple times using
prefixes and suffixes (e.g., constraints_1, constraints_2, map_constraints,
arch_constraints). Their contents will be combined by the parser.
- architecture: The architecture specification.
- *constraints*: Additional constraints on the mapspace (optional).
- *variables*: Top-level variables to be used in parsing (optional).
- *components*: Compound components used in the system.
- mapper: Directives for the Mapper such as search algorithm and timeout (only if using the Mapper).
- problem: Workload specification.
- sparse_optimizations: Optimizations available for sparse tensor accelerators.
- *globals*: Global environment variables and directives for the parser.
- mapspace: Directives describing the mapspace (i.e., imperfectly-factorized or perfectly-factorized)
Jinja parsing
The Timeloop Python Front-End can take in a Jinja2 template and parse it to
create a top-level file.
Parser functions available
- add_to_path(path): Adds a path to the environment. This will be used to
search for files in later parsing.
- cwd(): Returns the path of the current file. - include(file_path,
subkey=None): Parses the other file, returning the value at
the subkey. If subkey is None, the contents of the full file are returned.
This function substutes a YAML object into the YAML object of the current
location; it does not do text substitution. Subkey may also be a
period-separated list of subkeys (e.g., "a.b.c").
- include_text(file_path): Substitutes text from the file into the current
location. This function does text substitution.
- include_all(file_path, subkey): Parses all files that match the file_path
and returns a list with the content of each file. This function substutes a
YAML object into the YAML object of the current location; it does not do text
substitution. Subkey may also be a period-separated list of subkeys (e.g.,
"a.b.c").
- path_exists(path): Returns True if a path exists and False otherwise.
Example top-level file using Jinja2 templating
accessibility