Skip to content

Commit d1331ac

Browse files
author
Michael Gilbert
committed
[looptree] Finish test for symbolic reuse analysis
1 parent e893dfe commit d1331ac

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

tests/looptree/test_symbolic_reuse_analysis.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import unittest
2-
from pathlib import Path
3-
from itertools import starmap
2+
from sympy import ceiling
43

5-
from bindings.looptree import *
6-
from tests.util import TEST_TMP_DIR
4+
from bindings.looptree import LooptreeWorkload, LooptreeWorkloadDependencyAnalyzer
75

86
from tests.load_config_mixin import LoadConfigMixin
97

@@ -22,5 +20,20 @@ def test_model_with_two_level_mm(self):
2220
workload = LooptreeWorkload.parse_cfg(config.root['problem'])
2321
analyzer = LooptreeWorkloadDependencyAnalyzer(workload)
2422

25-
result = analyze_reuse(mapping, workload, analyzer)
26-
print(result)
23+
tile_shapes, result = analyze_reuse(mapping, workload, analyzer)
24+
25+
self.assertEqual(len(tile_shapes), 3)
26+
P1_tile_shape, C1_tile_shape, M1_tile_shape = tile_shapes
27+
28+
REFERENCE_FILLS = {
29+
('DRAM', 0, 0): (None, 18),
30+
('DRAM', 1, 0): (None, 8),
31+
('DRAM', 2, 0): (None, 36),
32+
('GlobalBuffer', 0, 0): (None, 18.0*ceiling(4/M1_tile_shape)),
33+
('GlobalBuffer', 1, 0): (None, 8)
34+
}
35+
36+
for key, ref_value in REFERENCE_FILLS.items():
37+
self.assertEqual(result.fills[key],
38+
ref_value,
39+
f'fills for {key} do not match')

tests/test_configs/symbolic-mapping.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ mapping:
22
type: fused
33
nodes:
44
- type: storage
5-
target: 0
5+
target: DRAM
66
dspace: [Filter1, Fmap1, Fmap2]
77
- type: storage
8-
target: 1
8+
target: GlobalBuffer
99
dspace: [Filter1]
1010
- type: temporal
1111
rank: P1
1212
- type: storage
13-
target: 2
13+
target: GlobalBuffer
1414
dspace: [Fmap2]
1515
- type: temporal
1616
rank: C1
1717
- type: spatial
1818
rank: M1
1919
- type: storage
20-
target: 3
20+
target: GlobalBuffer
2121
dspace: [Fmap1]
2222
- type: compute
2323
einsum: Fc1
24-
target: 4
24+
target: MAC

0 commit comments

Comments
 (0)