update ppaAnalyze to analyze correctionly freqSweep

This commit is contained in:
James E. Stine 2023-11-13 02:39:25 -06:00
parent 7b79d8edeb
commit 46bfdf5df9
4 changed files with 62 additions and 39 deletions

View File

@ -11,7 +11,7 @@ export MOD ?= orig
# title to add a note in the synth's directory name
TITLE =
# tsmc28, sky130, and sky90 presently supported
export TECH ?= sky90
export TECH ?= sky130
# MAXCORES allows parallel compilation, which is faster but less CPU-efficient
# Avoid when doing sweeps of many optimization points in parallel
export MAXCORES ?= 1
@ -24,7 +24,7 @@ export WIDTH ?= 32
time := $(shell date +%F-%H-%M)
hash := $(shell git rev-parse --short HEAD)
export OUTPUTDIR := runs/$(DESIGN)_$(WIDTH)_$(CONFIG)_$(MOD)_$(TECH)_$(FREQ)_MHz_$(time)_$(TITLE)_$(hash)
export OUTPUTDIR := runs/ppa_$(DESIGN)_$(WIDTH)_$(CONFIG)_$(TECH)_$(FREQ)_MHz_$(time)_$(TITLE)_$(hash)
export SAIFPOWER ?= 0
OLDCONFIGDIR ?= ${WALLY}/config

View File

@ -3,12 +3,12 @@ binencoder,sky130,8,1000,1.0000,50.960001,24.761,0.010685929975270078
binencoder,sky130,16,1000,1.0000,136.220003,77.243,0.021773774467348
binencoder,sky130,32,1000,1.0000,372.400007,189.626,0.04371111111111111
binencoder,sky130,64,1000,1.0000,797.720015,382.205,0.07393850658857981
binencoder,sky130,128,1000,1.0000,1602.300031,610.009,0.1261366969785861
binencoder,sky130,128,900,1.1111,1602.300031,610.009,0.1261366969785861
adder,sky130,8,1000,1.0000,253.820005,154.438,0.10825587752870422
adder,sky130,16,1000,1.0000,722.260013,485.109,0.32460910944935417
adder,sky130,32,1000,1.0000,1440.600027,714.057,0.6580226904376014
adder,sky130,64,1000,1.0000,2781.240054,1050.0,0.9392239364188874
adder,sky130,128,1000,1.0000,6186.740118,2230.0,2.1480106100795755
adder,sky130,128,900,1.1111,6186.740118,2230.0,2.1480106100795755
csa,sky130,8,1000,1.0000,266.560005,154.202,0.13650573115665163
csa,sky130,16,1000,1.0000,533.12001,308.404,0.27263530601922104
csa,sky130,32,1000,1.0000,1066.240021,616.808,0.5448072247308093
@ -18,12 +18,12 @@ shifter,sky130,8,1000,1.0000,259.700005,196.451,0.07534088282874972
shifter,sky130,16,1000,1.0000,666.400006,558.433,0.19552906110283155
shifter,sky130,32,1000,1.0000,1475.880027,768.262,0.3807431082700759
shifter,sky130,64,1000,1.0000,3914.120062,2680.0,1.144802541988198
shifter,sky130,128,1000,1.0000,9192.400136,6080.0,2.9008914525432616
shifter,sky130,128,900,1.1111,9192.400136,6080.0,2.9008914525432616
comparator,sky130,8,1000,1.0000,200.900004,136.6,0.05001033271337053
comparator,sky130,16,1000,1.0000,358.680007,189.253,0.06321553011448482
comparator,sky130,32,1000,1.0000,690.900013,315.709,0.10771793448084398
comparator,sky130,64,1000,1.0000,1372.980026,508.393,0.2048577820389901
comparator,sky130,128,1000,1.0000,2744.980052,796.047,0.34396273737011823
comparator,sky130,32,1500,0.666666,690.900013,315.709,0.10771793448084398
comparator,sky130,64,1300,0.7692307,1372.980026,508.393,0.2048577820389901
comparator,sky130,128,1100,0.909090,2744.980052,796.047,0.34396273737011823
flop,sky130,8,1000,1.0000,133.279999,64.8145,0.193835
flop,sky130,16,1000,1.0000,266.5599975,129.629,0.38715000000000005
flop,sky130,32,1000,1.0000,533.119995,259.258,0.7723000000000001
@ -48,7 +48,7 @@ mul,sky130,8,1000,1.0000,2194.220041,1440.0,1.421374045801527
mul,sky130,16,1000,1.0000,7519.540137,4940.0,6.376128385155466
mul,sky130,32,1000,1.0000,25200.700446,14900.0,24.931847968545217
mul,sky130,64,1000,1.0000,86011.661365,42600.0,88.84651898734177
mul,sky130,128,1000,1.0000,296198.144128,114000.0,273.3148854961832
mul,sky130,128,800,1.2500,296198.144128,114000.0,273.3148854961832
binencoder,sky90,8,7683,0.12508649056358195,50.960001,24.761,0.010685929975270078
binencoder,sky90,16,5773,0.16977016282695304,136.220003,77.243,0.021773774467348
binencoder,sky90,32,4500,0.2218912222222222,372.400007,189.626,0.04371111111111111
@ -158,7 +158,7 @@ adder,tsmc28psyn,8,13838,0.07207477814713109,34.272,187.089,0.013311172134701546
adder,tsmc28psyn,16,11521,0.08678002100512108,90.972001,475.207,0.03367763214998698
adder,tsmc28psyn,32,9812,0.1018860211985324,209.286002,1060.0,0.08153281695882594
adder,tsmc28psyn,64,8206,0.12185605215695831,388.836003,1770.0,0.1409943943456008
adder,tsmc28psyn,128,7354,0.13597341881968997,907.452008,4360.0,0.3451183029643731
adder,tsmc28psyn,128,7000,0.142857142857,907.452008,4360.0,0.3451183029643731
csa,tsmc28psyn,8,24524,0.040663382319360626,52.416,482.462,0.02173381177621921
csa,tsmc28psyn,16,24524,0.040663382319360626,104.832,964.99,0.04346762355243842
csa,tsmc28psyn,32,24524,0.040663382319360626,209.664,1930.0,0.08677214157559941

1 Module Tech Width Target Freq Delay Area L Power (nW) D energy (nJ)
3 binencoder sky130 16 1000 1.0000 136.220003 77.243 0.021773774467348
4 binencoder sky130 32 1000 1.0000 372.400007 189.626 0.04371111111111111
5 binencoder sky130 64 1000 1.0000 797.720015 382.205 0.07393850658857981
6 binencoder sky130 128 1000 900 1.0000 1.1111 1602.300031 610.009 0.1261366969785861
7 adder sky130 8 1000 1.0000 253.820005 154.438 0.10825587752870422
8 adder sky130 16 1000 1.0000 722.260013 485.109 0.32460910944935417
9 adder sky130 32 1000 1.0000 1440.600027 714.057 0.6580226904376014
10 adder sky130 64 1000 1.0000 2781.240054 1050.0 0.9392239364188874
11 adder sky130 128 1000 900 1.0000 1.1111 6186.740118 2230.0 2.1480106100795755
12 csa sky130 8 1000 1.0000 266.560005 154.202 0.13650573115665163
13 csa sky130 16 1000 1.0000 533.12001 308.404 0.27263530601922104
14 csa sky130 32 1000 1.0000 1066.240021 616.808 0.5448072247308093
18 shifter sky130 16 1000 1.0000 666.400006 558.433 0.19552906110283155
19 shifter sky130 32 1000 1.0000 1475.880027 768.262 0.3807431082700759
20 shifter sky130 64 1000 1.0000 3914.120062 2680.0 1.144802541988198
21 shifter sky130 128 1000 900 1.0000 1.1111 9192.400136 6080.0 2.9008914525432616
22 comparator sky130 8 1000 1.0000 200.900004 136.6 0.05001033271337053
23 comparator sky130 16 1000 1.0000 358.680007 189.253 0.06321553011448482
24 comparator sky130 32 1000 1500 1.0000 0.666666 690.900013 315.709 0.10771793448084398
25 comparator sky130 64 1000 1300 1.0000 0.7692307 1372.980026 508.393 0.2048577820389901
26 comparator sky130 128 1000 1100 1.0000 0.909090 2744.980052 796.047 0.34396273737011823
27 flop sky130 8 1000 1.0000 133.279999 64.8145 0.193835
28 flop sky130 16 1000 1.0000 266.5599975 129.629 0.38715000000000005
29 flop sky130 32 1000 1.0000 533.119995 259.258 0.7723000000000001
48 mul sky130 16 1000 1.0000 7519.540137 4940.0 6.376128385155466
49 mul sky130 32 1000 1.0000 25200.700446 14900.0 24.931847968545217
50 mul sky130 64 1000 1.0000 86011.661365 42600.0 88.84651898734177
51 mul sky130 128 1000 800 1.0000 1.2500 296198.144128 114000.0 273.3148854961832
52 binencoder sky90 8 7683 0.12508649056358195 50.960001 24.761 0.010685929975270078
53 binencoder sky90 16 5773 0.16977016282695304 136.220003 77.243 0.021773774467348
54 binencoder sky90 32 4500 0.2218912222222222 372.400007 189.626 0.04371111111111111
158 adder tsmc28psyn 16 11521 0.08678002100512108 90.972001 475.207 0.03367763214998698
159 adder tsmc28psyn 32 9812 0.1018860211985324 209.286002 1060.0 0.08153281695882594
160 adder tsmc28psyn 64 8206 0.12185605215695831 388.836003 1770.0 0.1409943943456008
161 adder tsmc28psyn 128 7354 7000 0.13597341881968997 0.142857142857 907.452008 4360.0 0.3451183029643731
162 csa tsmc28psyn 8 24524 0.040663382319360626 52.416 482.462 0.02173381177621921
163 csa tsmc28psyn 16 24524 0.040663382319360626 104.832 964.99 0.04346762355243842
164 csa tsmc28psyn 32 24524 0.040663382319360626 209.664 1930.0 0.08677214157559941

View File

@ -38,7 +38,7 @@ def synthsintocsv():
each line contains the module, tech, width, target freq, and resulting metrics
'''
print("This takes a moment...")
bashCommand = "find . -path '*runs/ppa*rv32e*' -prune"
bashCommand = "find . -path '*runs/ppa*' -prune"
output = subprocess.check_output(['bash','-c', bashCommand])
allSynths = output.decode("utf-8").split('\n')[:-1]
@ -51,7 +51,6 @@ def synthsintocsv():
for oneSynth in allSynths:
module, width, risc, tech, freq = specReg.findall(oneSynth)[2:7]
tech = tech[:-2]
metrics = []
for phrase in [['Path Slack', 'qor'], ['Design Area', 'qor'], ['100', 'power']]:
bashCommand = 'grep "{}" '+ oneSynth[2:]+'/reports/*{}*'
@ -87,7 +86,7 @@ def cleanup():
output = subprocess.check_output(['bash','-c', bc])
except: pass
bashCommand = "find . -path '*runs/ppa*rv32e*' -prune"
bashCommand = "find . -path '*runs/ppa*' -prune"
output = subprocess.check_output(['bash','-c', bashCommand])
allSynths = output.decode("utf-8").split('\n')[:-1]
for oneSynth in allSynths:
@ -186,7 +185,7 @@ def genLegend(fits, coefs, r2=None, spec=None, ale=False):
legend_elements += [lines.Line2D([0], [0], color=spec.color, ls='', marker=spec.shape, label='$R^2$='+ str(round(r2, 4)))]
return legend_elements
def oneMetricPlot(module, var, freq=None, ax=None, fits='clsgn', norm=True, color=None):
def oneMetricPlot(module, widths, var, freq=None, ax=None, fits='clsgn', norm=True, color=None):
''' module: string module name
freq: int freq (MHz)
var: string delay, area, lpower, or denergy
@ -519,7 +518,7 @@ def squarify(fig):
l = (1.-axs/h)/2
fig.subplots_adjust(bottom=l, top=1-l)
def plotPPA(mod, freq=None, norm=True, aleOpt=False):
def plotPPA(mod, widths, freq=None, norm=True, aleOpt=False):
''' for the module specified, plots width vs delay, area, leakage power, and dynamic energy with fits
if no freq specified, uses the synthesis with best achievable delay for each width
overlays data from both techs
@ -539,7 +538,7 @@ def plotPPA(mod, freq=None, norm=True, aleOpt=False):
if (arr[i][j]=='delay') and (f==10):
pass
else:
r2 = oneMetricPlot(mod, arr[i][j], ax=axs[i, j], freq=f, norm=norm)
r2 = oneMetricPlot(mod, widths, arr[i][j], ax=axs[i, j], freq=f, norm=norm)
ls = '--' if f else '-'
leg += [lines.Line2D([0], [0], color='red', label='$R^2$='+str(round(r2, 4)), linestyle=ls)]
@ -568,6 +567,7 @@ def makeLineLegend():
fullLeg = [lines.Line2D([0], [0], color='black', label='fastest', linestyle='-')]
fullLeg += [lines.Line2D([0], [0], color='black', label='smallest', linestyle='--')]
fullLeg += [lines.Line2D([0], [0], color='blue', label='tsmc28', marker='^')]
fullLeg += [lines.Line2D([0], [0], color='blue', label='tsmc28psyn', marker='x')]
fullLeg += [lines.Line2D([0], [0], color='green', label='sky90', marker='o')]
fullLeg += [lines.Line2D([0], [0], color='green', label='sky130', marker='+')]
fullLeg += [lines.Line2D([0], [0], color='red', label='combined', marker='_')]
@ -694,7 +694,7 @@ def makePlotDirectory():
os.makedirs(new_directory)
os.chdir(new_directory)
if 'freq' in folder:
for tech in ['sky90', 'sky130', 'tsmc28']:
for tech in ['sky90', 'sky130', 'tsmc28', 'tsmc28psyn']:
for mod in modules:
tech_directory = os.path.join(new_directory, tech)
mod_directory = os.path.join(tech_directory, mod)
@ -707,14 +707,16 @@ def makePlotDirectory():
if __name__ == '__main__':
##############################
# set up stuff, global variables
widths = [8, 16, 32, 64, 128]
modules = ['priorityencoder', 'add', 'csa', 'shiftleft', 'comparator', 'flop', 'mux2', 'mux4', 'mux8', 'mult']
widths = [64, 128]
modules = ['adder', 'comparator']
normAddWidth = 32 # divisor to use with N since normalizing to add_32
fitDict = {'add': ['cg', 'l', 'l'], 'mult': ['cg', 's', 's'], 'comparator': ['cg', 'l', 'l'], 'csa': ['c', 'l', 'l'], 'shiftleft': ['cg', 'l', 'ln'], 'flop': ['c', 'l', 'l'], 'priorityencoder': ['cg', 'l', 'l']} fitDict.update(dict.fromkeys(['mux2', 'mux4', 'mux8'], ['cg', 'l', 'l']))
fitDict = {'adder': ['cg', 'l', 'l'], 'mul': ['cg', 's', 's'], 'comparator': ['cg', 'l', 'l'], 'csa': ['c', 'l', 'l'], 'shifter': ['cg', 'l', 'ln'], 'flop': ['c', 'l', 'l'], 'binencoder': ['cg', 'l', 'l']}
fitDict.update(dict.fromkeys(['mux2', 'mux4', 'mux8'], ['cg', 'l', 'l']))
TechSpec = namedtuple("TechSpec", "tech color shape delay area lpower denergy")
techSpecs = [['sky90', 'green', 'o', 43.2e-3, 1440.600027, 714.057, 0.658022690438], ['sky130', 'red', 'o', 43.2e-3, 1440.600027, 714.057, 0.658022690438], ['tsmc28', 'blue', '^', 12.2e-3, 209.286002, 1060.0, .08153281695882594]]
techSpecs = [['sky90', 'green', 'o', 43.2e-3, 1440.600027, 714.057, 0.658022690438], ['sky130', 'red', 'o', 43.2e-3, 1440.600027, 714.057, 0.658022690438], ['tsmc28', 'blue', '^', 12.2e-3, 209.286002, 1060.0, .08153281695882594], ['tsmc28psyn', 'blue', '^', 12.2e-3, 209.286002, 1060.0, .08153281695882594]]
techSpecs = [TechSpec(*t) for t in techSpecs]
combined = TechSpec('combined fit', 'red', '_', 0, 0, 0, 0)
##############################
@ -734,9 +736,10 @@ if __name__ == '__main__':
for mod in modules:
for w in widths:
freqPlot('sky90', mod, w)
#freqPlot('sky130', mod, w)
#freqPlot('sky90', mod, w)
freqPlot('sky130', mod, w)
#freqPlot('tsmc28', mod, w)
#plotPPA(mod, norm=False)
#freqPlot('tsmc28psyn', mod, w)
#plotPPA(mod, widths, norm=False)
#plotPPA(mod, aleOpt=True)
plt.close('all')

View File

@ -32,6 +32,19 @@ def freqSweep(module, width, tech):
synthsToRun += [[synth.module, str(synth.width), synth.tech, str(freq)]]
return synthsToRun
def freqModuleSweep(widths, modules, tech):
synthsToRun = []
arr = [-8, -6, -4, -2, 0, 2, 4, 6, 8]
allSynths = synthsfromcsv('ppa/bestSynths.csv')
for w in widths:
for module in modules:
for synth in allSynths:
if (synth.module == str(module)) & (synth.tech == tech) & (synth.width == w):
f = 1000/synth.delay
for freq in [round(f+f*x/100) for x in arr]:
synthsToRun += [[synth.module, str(synth.width), synth.tech, str(freq)]]
return synthsToRun
def filterRedundant(synthsToRun):
bashCommand = "find . -path '*runs/ppa*rv32e*' -prune"
output = subprocess.check_output(['bash','-c', bashCommand])
@ -57,7 +70,7 @@ def allCombos(widths, modules, techs, freqs):
if __name__ == '__main__':
##### Run specific syntheses
##### Run specific syntheses for a specific frequency
widths = [8, 16, 32, 64, 128]
modules = ['mul', 'adder', 'shifter', 'flop', 'comparator', 'binencoder', 'csa', 'mux2', 'mux4', 'mux8']
techs = ['sky90', 'sky130', 'tsmc28', 'tsmc28psyn']
@ -70,8 +83,15 @@ if __name__ == '__main__':
tech = 'tsmc28psyn'
synthsToRun = freqSweep(module, width, tech)
##### Run a sweep for multiple modules/widths based on best delay found in existing syntheses
modules = ['adder', 'comparator']
widths = [64, 128]
tech = 'sky130'
synthsToRun = freqModuleSweep(widths, modules, tech)
##### Only do syntheses for which a run doesn't already exist
synthsToRun = filterRedundant(synthsToRun)
pool = Pool(processes=25)
pool.starmap(runCommand, synthsToRun)