|
4 | 4 | import islpy as isl
|
5 | 5 |
|
6 | 6 | from bindings.config import Config
|
7 |
| -from bindings.looptree import LooptreeModelApp, LooptreeWorkload |
| 7 | +from bindings.looptree import LooptreeModelApp, LooptreeWorkload, LooptreeWorkloadDependencyAnalyzer |
8 | 8 |
|
9 | 9 | from pytimeloop.file import gather_yaml_configs
|
10 | 10 |
|
11 | 11 | from pytimeloop.looptree.capacity import compute_capacity_usage
|
12 | 12 | from pytimeloop.looptree.reuse.isl.des import deserialize_looptree_output
|
| 13 | +from pytimeloop.looptree.reuse.summarized import analyze_reuse |
13 | 14 | from pytimeloop.looptree.energy import gather_actions, compute_energy_from_actions
|
14 | 15 | from pytimeloop.looptree.latency import get_latency
|
15 | 16 |
|
@@ -69,3 +70,49 @@ def run_looptree(config_dir, paths, tmp_path, bindings, call_accelergy):
|
69 | 70 | actions,
|
70 | 71 | mem_latency,
|
71 | 72 | capacity_usage=component_capacity_usage)
|
| 73 | + |
| 74 | + |
| 75 | +def run_looptree_symbolic(config_dir, paths, tmp_path, bindings, call_accelergy): |
| 76 | + yaml_str = gather_yaml_configs(config_dir, paths) |
| 77 | + |
| 78 | + config = Config(yaml_str, 'yaml') |
| 79 | + workload = LooptreeWorkload.parse_cfg(config.root['problem']) |
| 80 | + analyzer = LooptreeWorkloadDependencyAnalyzer(workload) |
| 81 | + |
| 82 | + spec = Specification.from_yaml_files([ |
| 83 | + str(config_dir / p) for p in paths |
| 84 | + ]) |
| 85 | + |
| 86 | + if call_accelergy: |
| 87 | + if isinstance(tmp_path, Path): |
| 88 | + tmp_path = str(tmp_path) |
| 89 | + call_accelergy_verbose(spec, tmp_path) |
| 90 | + spec = Specification.from_yaml_files([ |
| 91 | + str(config_dir / p) for p in paths |
| 92 | + ] + [str(Path(tmp_path) / 'ERT.yaml')]) |
| 93 | + |
| 94 | + |
| 95 | + tile_shapes, result = analyze_reuse(spec.mapping.nodes, workload, analyzer) |
| 96 | + |
| 97 | + actions = gather_actions(result, spec.mapping, workload, bindings, use_name=True) |
| 98 | + energy = compute_energy_from_actions(actions, spec.ERT) |
| 99 | + |
| 100 | + latency, comp_latency, mem_latency = get_latency(result, |
| 101 | + spec.mapping, |
| 102 | + workload, |
| 103 | + spec.architecture, |
| 104 | + bindings) |
| 105 | + |
| 106 | + capacity_usage = compute_capacity_usage(spec.mapping.nodes, |
| 107 | + result.occupancy, |
| 108 | + workload) |
| 109 | + component_capacity_usage = {} |
| 110 | + for level, component in bindings.items(): |
| 111 | + if level in capacity_usage: |
| 112 | + component_capacity_usage[component] = capacity_usage[level] |
| 113 | + |
| 114 | + return LoopTreeStatistics(latency, |
| 115 | + energy, |
| 116 | + actions, |
| 117 | + mem_latency, |
| 118 | + capacity_usage=component_capacity_usage) |
0 commit comments