CMSIS-DSP: SDF Improvements

Improvement to the SDF memory optimization using graph coloring.
pull/19/head
Christophe Favergeon 4 years ago
parent 0adc9f21e3
commit ef0d63f451

@ -31,9 +31,17 @@ source [label=<
source:i -> filter:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >7</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >5</FONT>>,label="f32(11)"] source:i -> filter:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >7</FONT>
filter:i -> sink:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >5</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >5</FONT>>,label="f32(5)"] </TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >5</FONT>
</TD></TR></TABLE>>,label="f32(11)"]
filter:i -> sink:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >5</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >5</FONT>
</TD></TR></TABLE>>,label="f32(5)"]
} }

@ -23,13 +23,13 @@ arm_add_f321 [label=<
<TD ALIGN="CENTER" ROWSPAN="2">arm_add_f32<BR/>(CMSIS-DSP)</TD> <TD ALIGN="CENTER" ROWSPAN="2">arm_add_f32<BR/>(CMSIS-DSP)</TD>
<TD PORT="o"><FONT POINT-SIZE="9.0">o</FONT></TD> <TD PORT="o"><FONT POINT-SIZE="9.0">o</FONT></TD>
</TR> </TR>
<TR> <TR>
<TD PORT="ib"><FONT POINT-SIZE="9.0">ib</FONT></TD> <TD PORT="ib"><FONT POINT-SIZE="9.0">ib</FONT></TD>
<TD></TD>
</TR>
</TABLE>>];
<TD></TD></TR>
</TABLE>>];
arm_scale_f321 [label=< arm_scale_f321 [label=<
@ -39,13 +39,13 @@ arm_scale_f321 [label=<
<TD ALIGN="CENTER" ROWSPAN="2">arm_scale_f32<BR/>(CMSIS-DSP)</TD> <TD ALIGN="CENTER" ROWSPAN="2">arm_scale_f32<BR/>(CMSIS-DSP)</TD>
<TD PORT="o"><FONT POINT-SIZE="9.0">o</FONT></TD> <TD PORT="o"><FONT POINT-SIZE="9.0">o</FONT></TD>
</TR> </TR>
<TR> <TR>
<TD PORT="ib"><FONT POINT-SIZE="9.0">ib</FONT></TD> <TD PORT="ib"><FONT POINT-SIZE="9.0">ib</FONT></TD>
<TD></TD>
</TR>
</TABLE>>];
<TD></TD></TR>
</TABLE>>];
arm_scale_f322 [label=< arm_scale_f322 [label=<
@ -55,13 +55,13 @@ arm_scale_f322 [label=<
<TD ALIGN="CENTER" ROWSPAN="2">arm_scale_f32<BR/>(CMSIS-DSP)</TD> <TD ALIGN="CENTER" ROWSPAN="2">arm_scale_f32<BR/>(CMSIS-DSP)</TD>
<TD PORT="o"><FONT POINT-SIZE="9.0">o</FONT></TD> <TD PORT="o"><FONT POINT-SIZE="9.0">o</FONT></TD>
</TR> </TR>
<TR> <TR>
<TD PORT="ib"><FONT POINT-SIZE="9.0">ib</FONT></TD> <TD PORT="ib"><FONT POINT-SIZE="9.0">ib</FONT></TD>
<TD></TD>
</TR>
</TABLE>>];
<TD></TD></TR>
</TABLE>>];
audioWin [label=< audioWin [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"> <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
@ -99,7 +99,8 @@ toMono [label=<
<TD ALIGN="CENTER" ROWSPAN="2">toMono<BR/>(Unzip)</TD> <TD ALIGN="CENTER" ROWSPAN="2">toMono<BR/>(Unzip)</TD>
<TD PORT="o1"><FONT POINT-SIZE="9.0">o1</FONT></TD> <TD PORT="o1"><FONT POINT-SIZE="9.0">o1</FONT></TD>
</TR> </TR>
<TR> <TR>
<TD></TD> <TD></TD>
<TD PORT="o2"><FONT POINT-SIZE="9.0">o2</FONT></TD> <TD PORT="o2"><FONT POINT-SIZE="9.0">o2</FONT></TD>
</TR> </TR>
@ -107,7 +108,6 @@ toMono [label=<
</TABLE>>]; </TABLE>>];
srcDelay [label=< srcDelay [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"> <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
<TR> <TR>
@ -116,26 +116,62 @@ srcDelay [label=<
</TABLE>>]; </TABLE>>];
src:i -> srcDelay:i [taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >320</FONT>>] src:i -> srcDelay:i [taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >320</FONT>
srcDelay:i -> toMono:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >320</FONT>>,label="f32(330)"] </TD></TR></TABLE>>]
srcDelay:i -> toMono:i [headlabel=<
toMono:o1 -> arm_scale_f321:ia [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>>,label="f32(160)"] <TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >320</FONT>
</TD></TR></TABLE>>,label="f32(330)"]
toMono:o2 -> arm_scale_f322:ia [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>>,label="f32(160)"]
arm_scale_f321:o -> arm_add_f321:ia [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>>,label="f32(160)"] toMono:o1 -> arm_scale_f321:ia [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>
arm_scale_f322:o -> arm_add_f321:ib [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>>,label="f32(160)"] </TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>
arm_add_f321:o -> audioWin:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >320</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>>,label="f32(320)"] </TD></TR></TABLE>>,label="f32(160)"]
audioWin:i -> mfcc:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >640</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >640</FONT>>,label="f32(640)"] toMono:o2 -> arm_scale_f322:ia [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>
mfcc:i -> mfccWind:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >250</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >10</FONT>>,label="f32(250)"] </TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>
mfccWind:i -> TFLite:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >500</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >500</FONT>>,label="f32(500)"] </TD></TR></TABLE>>,label="f32(160)"]
arm_scale_f321:o -> arm_add_f321:ia [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>
</TD></TR></TABLE>>,label="f32(160)"]
arm_scale_f322:o -> arm_add_f321:ib [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>
</TD></TR></TABLE>>,label="f32(160)"]
arm_add_f321:o -> audioWin:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >320</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >160</FONT>
</TD></TR></TABLE>>,label="f32(320)"]
audioWin:i -> mfcc:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >640</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >640</FONT>
</TD></TR></TABLE>>,label="f32(640)"]
mfcc:i -> mfccWind:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >250</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >10</FONT>
</TD></TR></TABLE>>,label="f32(250)"]
mfccWind:i -> TFLite:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >500</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >500</FONT>
</TD></TR></TABLE>>,label="f32(500)"]
HALF [label=< HALF [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"> <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">

@ -16,13 +16,13 @@ arm_mult_f321 [label=<
<TD ALIGN="CENTER" ROWSPAN="2">arm_mult_f32<BR/>(CMSIS-DSP)</TD> <TD ALIGN="CENTER" ROWSPAN="2">arm_mult_f32<BR/>(CMSIS-DSP)</TD>
<TD PORT="o"><FONT POINT-SIZE="9.0">o</FONT></TD> <TD PORT="o"><FONT POINT-SIZE="9.0">o</FONT></TD>
</TR> </TR>
<TR> <TR>
<TD PORT="ib"><FONT POINT-SIZE="9.0">ib</FONT></TD> <TD PORT="ib"><FONT POINT-SIZE="9.0">ib</FONT></TD>
<TD></TD>
</TR>
</TABLE>>];
<TD></TD></TR>
</TABLE>>];
audioOverlap [label=< audioOverlap [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"> <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
@ -82,21 +82,53 @@ toReal [label=<
src:i -> audioWin:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >128</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >192</FONT>>,label="f32(256)"] src:i -> audioWin:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >128</FONT>
audioWin:i -> arm_mult_f321:ia [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>>,label="f32(256)"] </TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >192</FONT>
arm_mult_f321:o -> toCmplx:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>>,label="f32(256)"] </TD></TR></TABLE>>,label="f32(256)"]
toCmplx:i -> cfft:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>>,label="f32(512)"] audioWin:i -> arm_mult_f321:ia [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>
cfft:i -> icfft:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>>,label="f32(512)"] </TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>
icfft:i -> toReal:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>>,label="f32(512)"] </TD></TR></TABLE>>,label="f32(256)"]
toReal:i -> audioOverlap:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>>,label="f32(256)"] arm_mult_f321:o -> toCmplx:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>
audioOverlap:i -> sink:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >192</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >128</FONT>>,label="f32(256)"] </TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>
</TD></TR></TABLE>>,label="f32(256)"]
toCmplx:i -> cfft:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>
</TD></TR></TABLE>>,label="f32(512)"]
cfft:i -> icfft:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>
</TD></TR></TABLE>>,label="f32(512)"]
icfft:i -> toReal:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>
</TD></TR></TABLE>>,label="f32(512)"]
toReal:i -> audioOverlap:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>
</TD></TR></TABLE>>,label="f32(256)"]
audioOverlap:i -> sink:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >192</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >128</FONT>
</TD></TR></TABLE>>,label="f32(256)"]
HANN [label=< HANN [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"> <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">

@ -16,13 +16,13 @@ arm_mult_f321 [label=<
<TD ALIGN="CENTER" ROWSPAN="2">arm_mult_f32<BR/>(CMSIS-DSP)</TD> <TD ALIGN="CENTER" ROWSPAN="2">arm_mult_f32<BR/>(CMSIS-DSP)</TD>
<TD PORT="o"><FONT POINT-SIZE="9.0">o</FONT></TD> <TD PORT="o"><FONT POINT-SIZE="9.0">o</FONT></TD>
</TR> </TR>
<TR> <TR>
<TD PORT="ib"><FONT POINT-SIZE="9.0">ib</FONT></TD> <TD PORT="ib"><FONT POINT-SIZE="9.0">ib</FONT></TD>
<TD></TD>
</TR>
</TABLE>>];
<TD></TD></TR>
</TABLE>>];
audioOverlap [label=< audioOverlap [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"> <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
@ -82,21 +82,53 @@ toReal [label=<
src:i -> audioWin:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >128</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >192</FONT>>,label="f32(256)"] src:i -> audioWin:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >128</FONT>
audioWin:i -> arm_mult_f321:ia [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>>,label="f32(256)"] </TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >192</FONT>
arm_mult_f321:o -> toCmplx:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>>,label="f32(256)"] </TD></TR></TABLE>>,label="f32(256)"]
toCmplx:i -> cfft:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>>,label="f32(512)"] audioWin:i -> arm_mult_f321:ia [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>
cfft:i -> icfft:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>>,label="f32(512)"] </TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>
icfft:i -> toReal:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>>,label="f32(512)"] </TD></TR></TABLE>>,label="f32(256)"]
toReal:i -> audioOverlap:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>>,label="f32(256)"] arm_mult_f321:o -> toCmplx:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>
audioOverlap:i -> sink:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >192</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >128</FONT>>,label="f32(256)"] </TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>
</TD></TR></TABLE>>,label="f32(256)"]
toCmplx:i -> cfft:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>
</TD></TR></TABLE>>,label="f32(512)"]
cfft:i -> icfft:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>
</TD></TR></TABLE>>,label="f32(512)"]
icfft:i -> toReal:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >512</FONT>
</TD></TR></TABLE>>,label="f32(512)"]
toReal:i -> audioOverlap:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>
</TD></TR></TABLE>>,label="f32(256)"]
audioOverlap:i -> sink:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >192</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >128</FONT>
</TD></TR></TABLE>>,label="f32(256)"]
HANN [label=< HANN [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"> <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">

@ -52,15 +52,35 @@ toMono [label=<
src:i -> toMono:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >384</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >384</FONT>>,label="q15(384)"] src:i -> toMono:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >384</FONT>
toMono:i -> audioWin:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >768</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >192</FONT>>,label="q15(768)"] </TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >384</FONT>
audioWin:i -> mfcc:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >1024</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >1024</FONT>>,label="q15(1024)"] </TD></TR></TABLE>>,label="q15(384)"]
mfcc:i -> mfccWin:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >377</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >13</FONT>>,label="q15(377)"] toMono:i -> audioWin:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >768</FONT>
mfccWin:i -> sink:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >754</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >754</FONT>>,label="q15(754)"] </TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >192</FONT>
</TD></TR></TABLE>>,label="q15(768)"]
audioWin:i -> mfcc:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >1024</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >1024</FONT>
</TD></TR></TABLE>>,label="q15(1024)"]
mfcc:i -> mfccWin:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >377</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >13</FONT>
</TD></TR></TABLE>>,label="q15(377)"]
mfccWin:i -> sink:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >754</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >754</FONT>
</TD></TR></TABLE>>,label="q15(754)"]
} }

@ -45,13 +45,29 @@ src [label=<
src:i -> audioWin:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >128</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >192</FONT>>,label="f32(256)"] src:i -> audioWin:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >128</FONT>
audioWin:i -> mfcc:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>>,label="f32(256)"] </TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >192</FONT>
mfcc:i -> mfccWin:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >13</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >13</FONT>>,label="f32(13)"] </TD></TR></TABLE>>,label="f32(256)"]
mfccWin:i -> sink:i [headlabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >13</FONT>>,taillabel=<<FONT COLOR="blue" POINT-SIZE="12.0" >26</FONT>>,label="f32(26)"] audioWin:i -> mfcc:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >256</FONT>
</TD></TR></TABLE>>,label="f32(256)"]
mfcc:i -> mfccWin:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >13</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >13</FONT>
</TD></TR></TABLE>>,label="f32(13)"]
mfccWin:i -> sink:i [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >13</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >26</FONT>
</TD></TR></TABLE>>,label="f32(26)"]
} }

@ -68,6 +68,9 @@ class Configuration:
# True for an horizontal graphviz layout # True for an horizontal graphviz layout
self.horizontal = True self.horizontal = True
# Display FIFO buffers in graph instead of datatype
self.displayFIFOBuf = False
@property @property
def debug(self): def debug(self):
return (self.debugLimit > 0) return (self.debugLimit > 0)

@ -40,6 +40,9 @@ from sdf.schedule.node import *
from sdf.schedule.config import * from sdf.schedule.config import *
from sdf.schedule.types import * from sdf.schedule.types import *
# To debug graph coloring for memory optimization
#import matplotlib.pyplot as plt
class IncompatibleIO(Exception): class IncompatibleIO(Exception):
pass pass
@ -67,16 +70,14 @@ class FIFODesc:
def __init__(self,fifoid): def __init__(self,fifoid):
# The FIFO is in fact just an array # The FIFO is in fact just an array
self.isArray=False self.isArray=False
# Max distance between a write and a read to the FIFO
# If it is 1, data written to FIFO
# is immediately read so buffer can be reused
self.distance=1
# FIFO length # FIFO length
self.length=0 self.length=0
# FIFO type # FIFO type
self.theType=None self.theType=None
# Buffer used by FIFO # Buffer used by FIFO
self.buffer=None self.buffer=None
# Used for plot in graphviz
self.bufferID=-1
self._fifoID=fifoid self._fifoID=fifoid
# Source IO # Source IO
self.src = None self.src = None
@ -84,15 +85,16 @@ class FIFODesc:
self.dst = None self.dst = None
# FIFO delay # FIFO delay
self.delay=0 self.delay=0
# Can use a shared buffer ?
self.isShared = False
self._writeTime= 0
# Track when FIFO is used # Used for liveliness analysis
# For allocation of shared buffers we need # To share buffers between FIFO in memory optimization
# to know when 2 buffers are used at same time # mode, we need to know when a FIFO is in use.
self._timeOfUse=[] # We compute the maximum extent : so the biggest interval
# and not a disconnected union of intervals
# This could be improved. We could use
# a disjoint union of intervals but they should be mapped
# to the same node in the interference graph
self._liveInterval=(-1,-1)
# shared buffer number not yet allocated # shared buffer number not yet allocated
self.sharedNB=-1 self.sharedNB=-1
@ -110,36 +112,31 @@ class FIFODesc:
return(self.delay>0) return(self.delay>0)
def dump(self): def dump(self):
shared=0
if self.isShared: print("array %d len %d %s id %d src %s:%s dst %s:%s " %
shared=1
print("array %d dist %d len %d %s id %d src %s:%s dst %s:%s shared:%d" %
(self.isArray, (self.isArray,
self.distance,
self.length, self.length,
self.theType.ctype, self.theType.ctype,
self.fifoID, self.fifoID,
self.src.owner.nodeID, self.src.owner.nodeID,
self.src.name, self.src.name,
self.dst.owner.nodeID, self.dst.owner.nodeID,
self.dst.name, self.dst.name))
shared))
@property @property
def fifoID(self): def fifoID(self):
return self._fifoID return self._fifoID
def recordWrite(self,theTime): def recordWrite(self,theTime):
self._timeOfUse.append(theTime) start,stop=self._liveInterval
if self._writeTime == 0: if start==-1:
self._writeTime = theTime self._liveInterval=(theTime,stop)
def recordRead(self,theTime): def recordRead(self,theTime):
self._timeOfUse.append(theTime) start,stop=self._liveInterval
delta = theTime - self._writeTime if (theTime > stop):
self._writeTime = 0 self._liveInterval=(start,theTime)
if delta > self.distance:
self.distance = delta
def analyzeStep(vec,allFIFOs,theTime): def analyzeStep(vec,allFIFOs,theTime):
"""Analyze an evolution step to know which FIFOs are read and written to""" """Analyze an evolution step to know which FIFOs are read and written to"""
@ -209,7 +206,7 @@ class Graph():
return(res) return(res)
def initializeFIFODescriptions(self,config,allFIFOs, fifoLengths): def initializeFIFODescriptions(self,config,allFIFOs, fifoLengths,maxTime):
"""Initialize FIFOs datastructure""" """Initialize FIFOs datastructure"""
for fifo in allFIFOs: for fifo in allFIFOs:
edge = self._sortedEdges[fifo.fifoID] edge = self._sortedEdges[fifo.fifoID]
@ -218,113 +215,126 @@ class Graph():
fifo.src=src fifo.src=src
fifo.dst=dst fifo.dst=dst
fifo.delay=self.getDelay(edge) fifo.delay=self.getDelay(edge)
# When a FIFO is working as an array then its buffer may
# potentially be shared with other FIFOs workign as arrays
if src.nbSamples == dst.nbSamples: if src.nbSamples == dst.nbSamples:
if fifo.delay==0: if fifo.delay==0:
fifo.isArray = True fifo.isArray = True
if fifo.distance==1:
if fifo.delay==0:
fifo.isShared = True
fifo.theType = src.theType fifo.theType = src.theType
#fifo.dump() #fifo.dump()
# When we have bufA -> Node -> bufB then
# bufA and bufB can't share the same memory.
# For the allocation of shared buffer we scan all times bufferID=0
# of use and for each time we look at the FIFOs which allBuffers=[]
# can be potentially shared.
# For each time of use, record the potentially shareable fifos # Compute a graph describing when FIFOs are used at the same time
# which are used # The use graph coloring to allocate buffer to those FIFOs.
fifoForTime={} # Then size the buffer based on the longest FIFO using it
for fifo in allFIFOs: if config.memoryOptimization:
if fifo.isShared: G = nx.Graph()
for t in fifo._timeOfUse:
if t in fifoForTime: for fifo in allFIFOs:
fifoForTime[t].append(fifo) if fifo.isArray:
else: G.add_node(fifo)
fifoForTime[t]=[fifo]
# Create the interference graph
# If several shareable FIFOs are used at same time, they
# must be assigned to different shared buffers if possible # Dictionary of active FIFOs at a given time.
usedAtSameTime={} # The time is a scheduling step
for t in sorted(fifoForTime.keys()): active={}
if len(fifoForTime[t])>2: currentTime=0
# This case is not managed in this version. while currentTime<=maxTime:
# It could occur with quadripoles for instance # Remove fifo no more active.
for fifo in fifoForTime[t]: # Thei stop time < currenTime
fifo.isShared=False toDelete=[]
elif len(fifoForTime[t])==2: for k in active:
# 2 FIFOs are used at the same time start,stop=k._liveInterval
fifoA = fifoForTime[t][0] if stop<currentTime:
fifoB = fifoForTime[t][1] toDelete.append(k)
if fifoA.sharedNB >= 0 and fifoA.sharedNB == fifoB.sharedNB: for k in toDelete:
# Those FIFOs are already both assigned to a buffer del active[k]
# and we can't reassign and they use the same buffer
# So we can't consistently associate shared buffers to those # Check FIFOs becoming active.
# FIFOs # They are added to the active list
fifoA.isShared=False # and an interference edge is added between thus FIFO
fifoB.isShared=False # and all the FIFOs active at same time.
else: for fifo in allFIFOs:
# The 2 FIFOs were never associated with a shared buffer if fifo.isArray:
if fifoA.sharedNB < 0 and fifoB.sharedNB < 0: start,stop=fifo._liveInterval
fifoA.sharedNB=0 # If a src -> node -> dst
fifoB.sharedNB=1 # At time t, node will read for src and the stop time
# One FIFO is associated, so we associate the other one # will be currentTime t.
# to the other shared buffer # And it will write to dst and the start time will be
elif fifoA.sharedNB < 0: # currentTime
fifoA.sharedNB = 1 - fifoB.sharedNB # So, src and dst are both live at this time.
else: # Which means the condition on the stop time must be
fifoB.sharedNB = 1 - fifoA.sharedNB # stop >= currentTime and not a strict comparison
else: if start<=currentTime and stop >= currentTime:
fifoA = fifoForTime[t][0] if not (fifo in active):
if fifoA.sharedNB < 0: for k in active:
fifoA.sharedNB = 0 G.add_edge(k,fifo)
active[fifo]=True
currentTime = currentTime + 1
# To debug and display the graph
if False:
labels={}
for n in G.nodes:
labels[n]="%s -> %s" % (n.src.owner.nodeName,n.dst.owner.nodeName)
pos = nx.spring_layout(G, seed=3113794652)
subax1 = plt.subplot(121)
nx.draw_networkx_edges(G, pos, width=1.0, alpha=0.5)
nx.draw_networkx_labels(G, pos, labels, font_size=10)
plt.show()
quit()
# Graph coloring
d = nx.coloring.greedy_color(G, strategy="largest_first")
# Allocate the colors (buffer ID) to the FIFO
# and keep track of the max color number
# Since other buffers (for real FIFOs) will have their
# numbering start after this one.
for fifo in d:
fifo.sharedNB=d[fifo]
bufferID=max(bufferID,fifo.sharedNB)
# Now we create buffers
maxSharedA=0
maxSharedB=0
allBuffers=[]
for fifo in allFIFOs:
lengthInBytes = fifo.theType.bytes * fifo.length
if fifo.isShared:
if fifo.sharedNB == 0:
if lengthInBytes > maxSharedA:
maxSharedA = lengthInBytes
if fifo.sharedNB == 1:
if lengthInBytes > maxSharedB:
maxSharedB = lengthInBytes
bufferID=0
sharedA=None # Compute the max size for each shared buffer
sharedB=None maxSizes={}
if maxSharedA > 0 and config.memoryOptimization: for fifo in d:
# Create the shared buffer if memory optimization on lengthInBytes = fifo.theType.bytes * fifo.length
sharedA = FifoBuffer(bufferID,CType(UINT8),maxSharedA) if fifo.sharedNB in maxSizes:
allBuffers.append(sharedA) maxSizes[fifo.sharedNB] = max(maxSizes[fifo.sharedNB],lengthInBytes)
bufferID = bufferID + 1 else:
maxSizes[fifo.sharedNB]=lengthInBytes
if maxSharedB > 0 and config.memoryOptimization:
# Create the shared buffer if memory optimization on # Create the buffers
sharedB = FifoBuffer(bufferID,CType(UINT8),maxSharedB) for theID in maxSizes:
allBuffers.append(sharedB) sharedA = FifoBuffer(theID,CType(UINT8),maxSizes[theID])
bufferID = bufferID + 1 allBuffers.append(sharedA)
for fifo in allFIFOs: for fifo in allFIFOs:
# Use shared buffer if memory optimization # Use shared buffer if memory optimization
if fifo.isShared and config.memoryOptimization: if fifo.isArray and config.memoryOptimization:
if fifo.sharedNB == 0: fifo.buffer=allBuffers[fifo.sharedNB]
fifo.buffer=sharedA fifo.bufferID=fifo.sharedNB
else: # Create a new buffer for a real FIFO
fifo.buffer=sharedB # Use bufferID which is starting after the numbers allocated
# to shared buffers
else: else:
buf = FifoBuffer(bufferID,fifo.theType,fifo.length) buf = FifoBuffer(bufferID,fifo.theType,fifo.length)
allBuffers.append(buf) allBuffers.append(buf)
fifo.buffer=buf fifo.buffer=buf
fifo.bufferID = bufferID
bufferID = bufferID + 1 bufferID = bufferID + 1
# Compute the total memory used in bytes
self._totalMemory = 0 self._totalMemory = 0
for buf in allBuffers: for buf in allBuffers:
self._totalMemory = self._totalMemory + buf._theType.bytes * buf._length self._totalMemory = self._totalMemory + buf._theType.bytes * buf._length
@ -529,7 +539,7 @@ class Graph():
fifoMax=np.floor(bMax).astype(np.int32) fifoMax=np.floor(bMax).astype(np.int32)
allBuffers=self.initializeFIFODescriptions(config,allFIFOs,fifoMax) allBuffers=self.initializeFIFODescriptions(config,allFIFOs,fifoMax,evolutionTime)
self._allFIFOs = allFIFOs self._allFIFOs = allFIFOs
self._allBuffers = allBuffers self._allBuffers = allBuffers
return(Schedule(self,self._sortedNodes,self._sortedEdges,schedule)) return(Schedule(self,self._sortedNodes,self._sortedEdges,schedule))

@ -115,10 +115,23 @@ digraph structs {
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >{{fifos[id].src.nbSamples}}</FONT> <TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >{{fifos[id].src.nbSamples}}</FONT>
</TD></TR></TABLE>>] </TD></TR></TABLE>>]
{% if config.displayFIFOBuf %}
{{delayBoxID(id)}}:i -> {{io(fifos[id].dst.owner,fifos[id].dst)}} [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >{{fifos[id].dst.nbSamples}}</FONT>
</TD></TR></TABLE>>,label="buf{{fifos[id].bufferID}}"]
{% else %}
{{delayBoxID(id)}}:i -> {{io(fifos[id].dst.owner,fifos[id].dst)}} [headlabel=< {{delayBoxID(id)}}:i -> {{io(fifos[id].dst.owner,fifos[id].dst)}} [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >{{fifos[id].dst.nbSamples}}</FONT> <TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >{{fifos[id].dst.nbSamples}}</FONT>
</TD></TR></TABLE>>,label="{{fifos[id].theType.graphViztype}}({{fifos[id].length}})"] </TD></TR></TABLE>>,label="{{fifos[id].theType.graphViztype}}({{fifos[id].length}})"]
{% endif %}
{% else %}
{% if config.displayFIFOBuf %}
{{io(fifos[id].src.owner,fifos[id].src)}} -> {{io(fifos[id].dst.owner,fifos[id].dst)}} [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >{{fifos[id].dst.nbSamples}}</FONT>
</TD></TR></TABLE>>,taillabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >{{fifos[id].src.nbSamples}}</FONT>
</TD></TR></TABLE>>,label="buf{{fifos[id].bufferID}}"]
{% else %} {% else %}
{{io(fifos[id].src.owner,fifos[id].src)}} -> {{io(fifos[id].dst.owner,fifos[id].dst)}} [headlabel=< {{io(fifos[id].src.owner,fifos[id].src)}} -> {{io(fifos[id].dst.owner,fifos[id].dst)}} [headlabel=<
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >{{fifos[id].dst.nbSamples}}</FONT> <TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >{{fifos[id].dst.nbSamples}}</FONT>
@ -126,6 +139,7 @@ digraph structs {
<TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >{{fifos[id].src.nbSamples}}</FONT> <TABLE BORDER="0" CELLPADDING="2"><TR><TD><FONT COLOR="blue" POINT-SIZE="12.0" >{{fifos[id].src.nbSamples}}</FONT>
</TD></TR></TABLE>>,label="{{fifos[id].theType.graphViztype}}({{fifos[id].length}})"] </TD></TR></TABLE>>,label="{{fifos[id].theType.graphViztype}}({{fifos[id].length}})"]
{% endif %} {% endif %}
{% endif %}
{% endfor %} {% endfor %}
{% for c in constObjs %} {% for c in constObjs %}

Loading…
Cancel
Save