Skip to content

Commit fb38723

Browse files
Merge branch 'main' of https://github.com/Accelergy-Project/accelforge into main
2 parents 3cf93f8 + 1bfa3b1 commit fb38723

3 files changed

Lines changed: 1316 additions & 9 deletions

File tree

accelforge/mapper/FFM/_make_pmappings/make_pmappings_from_templates/make_tile_shapes.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,11 @@ def _try_admit(n: int) -> bool:
761761
else:
762762
n += 1
763763

764+
# Force n to be a multiple of the inner size. ctrl-f for
765+
# IMPERFECT_OUTER_ONLY_ASSUMPTION. Note we also require that the enumeration
766+
# order is inner -> outer if we're doing imperfect.
767+
n = math.ceil(n / inner_size) * inner_size
768+
764769
# One more in case coarseness jumped the max value
765770
_try_admit(outer_size)
766771

@@ -906,8 +911,9 @@ def get_padded_choices(
906911
if subs in choices_padded:
907912
choices_padded[s] = choices_padded[subs]
908913
else:
909-
choices_padded[s] = ones * subs
910-
914+
choices_padded[s] = np.full(
915+
choices_enumerated.shape[0], subs, dtype=choices_enumerated.dtype
916+
)
911917
for k, v in choices_padded.items():
912918
assert isinstance(v, np.ndarray), f"{k} is not a numeric array: {v}"
913919

@@ -1219,10 +1225,11 @@ def hybrid(s):
12191225
if isinstance(tiled_by, Symbol) and tiled_by not in enumerated_set:
12201226
score_unknown -= 1
12211227

1222-
# Score for bringing in an entirely-new formula
1228+
# Score for bringing in an entirely-new formula. NOTE: This caused memory to
1229+
# blow up for some workloads when the punishment was set higher.
12231230
for o in objectives:
12241231
if s in o._free_symbols and not o._free_symbols & enumerated_set:
1225-
score_unknown -= 10
1232+
score_unknown -= .1
12261233

12271234
return (
12281235
-keep, # Punish enumerating keep symbols because they're always diff
@@ -1781,10 +1788,10 @@ def update_symbol2goal(
17811788
# Haven't done any pruning, so valid is the # of total choices
17821789
valid = [choices_enumerated.shape[0]]
17831790

1784-
porp = sum(valid) / max(1, choices_enumerated.shape[0])
1791+
porp = int(np.sum(valid)) / max(1, choices_enumerated.shape[0])
17851792
job.log_porp_pmappings_kept(
17861793
f"{objective.name}",
1787-
sum(valid) / max(1, prev_size),
1794+
int(np.sum(valid)) / max(1, prev_size),
17881795
)
17891796
DEBUG and log_message(
17901797
f"Valid check", f"{objective.name}", f"porp={porp:.2%}"
@@ -1832,10 +1839,10 @@ def update_symbol2goal(
18321839
# Everyone valid (for counting purposes)
18331840
valid = [choices_enumerated.shape[0]]
18341841

1835-
porp = sum(valid) / max(1, choices_enumerated.shape[0])
1842+
porp = int(np.sum(valid)) / max(1, choices_enumerated.shape[0])
18361843
job.log_porp_pmappings_kept(
18371844
f"{objective.name}",
1838-
sum(valid) / max(1, prev_size),
1845+
int(np.sum(valid)) / max(1, prev_size),
18391846
)
18401847
DEBUG and log_message(
18411848
f"Valid check", f"{objective.name}", f"porp={porp:.2%}"
@@ -1980,7 +1987,7 @@ def update_symbol2goal(
19801987
prev_size = choices_enumerated.shape[0]
19811988
choices_enumerated = choices_enumerated[keep]
19821989
job.log_porp_pmappings_kept(
1983-
f"Pareto", sum(keep) / choices_enumerated.shape[0]
1990+
f"Pareto", int(np.sum(keep)) / choices_enumerated.shape[0]
19841991
)
19851992
DEBUG and log_message(
19861993
"pareto", f"size {prev_size} -> {choices_enumerated.shape[0]}"

tests/hwcomponents_expected.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
}
1616
},
1717
"GlobalBuffer": {
18+
"area": 6.8574526567307686e-06,
19+
"leak_power": 0.00025508039081958506,
1820
"area": 6.8574526567307686e-06,
1921
"leak_power": 0.00025508039081958506,
2022
"actions": {
@@ -29,6 +31,8 @@
2931
}
3032
},
3133
"InputScratchpad": {
34+
"area": 3.8736612980769225e-10,
35+
"leak_power": 4.3815839033400895e-07,
3236
"area": 3.8736612980769225e-10,
3337
"leak_power": 4.3815839033400895e-07,
3438
"actions": {
@@ -43,6 +47,8 @@
4347
}
4448
},
4549
"WeightScratchpad": {
50+
"area": 3.534394038461538e-09,
51+
"leak_power": 7.663684917510134e-07,
4652
"area": 3.534394038461538e-09,
4753
"leak_power": 7.663684917510134e-07,
4854
"actions": {
@@ -57,6 +63,8 @@
5763
}
5864
},
5965
"OutputScratchpad": {
66+
"area": 4.5613394230769223e-10,
67+
"leak_power": 4.4143907783400897e-07,
6068
"area": 4.5613394230769223e-10,
6169
"leak_power": 4.4143907783400897e-07,
6270
"actions": {
@@ -71,6 +79,8 @@
7179
}
7280
},
7381
"MAC": {
82+
"area": 1.1748028846153846e-09,
83+
"leak_power": 8.851870775236185e-06,
7484
"area": 1.1748028846153846e-09,
7585
"leak_power": 8.851870775236185e-06,
7686
"actions": {
@@ -97,6 +107,8 @@
97107
}
98108
},
99109
"GlobalBuffer": {
110+
"area": 2.3951167124150845e-07,
111+
"leak_power": 9.50865964351506e-06,
100112
"area": 2.3951167124150845e-07,
101113
"leak_power": 9.50865964351506e-06,
102114
"actions": {
@@ -111,6 +123,8 @@
111123
}
112124
},
113125
"InputBuffer": {
126+
"area": 5.391208241958042e-09,
127+
"leak_power": 1.2069544874830208e-06,
114128
"area": 5.391208241958042e-09,
115129
"leak_power": 1.2069544874830208e-06,
116130
"actions": {
@@ -125,6 +139,8 @@
125139
}
126140
},
127141
"WeightBuffer": {
142+
"area": 1.0703430381765736e-07,
143+
"leak_power": 1.2611510646849734e-05,
128144
"area": 1.0703430381765736e-07,
129145
"leak_power": 1.2611510646849734e-05,
130146
"actions": {
@@ -139,6 +155,8 @@
139155
}
140156
},
141157
"AccumulationBuffer": {
158+
"area": 2.2003072874125873e-09,
159+
"leak_power": 6.034779422382222e-07,
142160
"area": 2.2003072874125873e-09,
143161
"leak_power": 6.034779422382222e-07,
144162
"actions": {
@@ -167,6 +185,8 @@
167185
}
168186
},
169187
"MAC": {
188+
"area": 1.4715951923076922e-10,
189+
"leak_power": 1.2382323818087997e-06,
170190
"area": 1.4715951923076922e-10,
171191
"leak_power": 1.2382323818087997e-06,
172192
"actions": {

0 commit comments

Comments
 (0)