Commit eb9cbb33 authored by Antonin Dudermel's avatar Antonin Dudermel
Browse files

ajuste quelque points avant la générale

parent 808933c6
......@@ -42,6 +42,9 @@ all: $(FILENAME).pdf
faust -sg $< > /dev/null
dot -Tsvg $<-sig.dot > $@
../code/contract-sig-old.svg: ../code/contract.dot
dot -Tsvg $< > $@
%-sig.svg: %.dsp
faustint -wi 1 -sg $< > /dev/null
dot -Tsvg $<-sig.dot > $@
......
strict digraph loopgraph {
rankdir=LR; node [fontsize=10];
S0x5565d29b46a0[label="+" color="red" style="bold" shape="ellipse"];
S0x5565d29b3430[label="*" color="red" style="bold" shape="ellipse"];
S0x5565d29b3250[label="0.5" color="red" shape="box"];
S0x5565d29b3250 -> S0x5565d29b3430[ color="red"];
S0x7facb000e310[label="INPUT_0" color="red" style="bold" shape="ellipse"];
S0x7facb000e310 -> S0x5565d29b3430[ color="red" style="bold"];
S0x5565d29b3430 -> S0x5565d29b46a0[ color="red" style="bold"];
S0x5565d29b3770[label="*" color="red" style="bold" shape="ellipse"];
S0x5565d29b3600[label="0.25" color="red" shape="box"];
S0x5565d29b3600 -> S0x5565d29b3770[ color="red"];
S0x7facb000e400[label="INPUT_1" color="red" style="bold" shape="ellipse"];
S0x7facb000e400 -> S0x5565d29b3770[ color="red" style="bold"];
S0x5565d29b3770 -> S0x5565d29b46a0[ color="red" style="bold"];
S0x5565d29b3c30[label="*" color="red" style="bold" shape="ellipse"];
S0x5565d29b3ac0[label="0.125" color="red" shape="box"];
S0x5565d29b3ac0 -> S0x5565d29b3c30[ color="red"];
S0x7facb000e4f0[label="INPUT_2" color="red" style="bold" shape="ellipse"];
S0x7facb000e4f0 -> S0x5565d29b3c30[ color="red" style="bold"];
S0x5565d29b3c30 -> S0x5565d29b46a0[ color="red" style="bold"];
S0x5565d29b40f0[label="*" color="red" style="bold" shape="ellipse"];
S0x5565d29b3fc0[label="0.0625" color="red" shape="box"];
S0x5565d29b3fc0 -> S0x5565d29b40f0[ color="red"];
S0x7facb000e5e0[label="INPUT_3" color="red" style="bold" shape="ellipse"];
S0x7facb000e5e0 -> S0x5565d29b40f0[ color="red" style="bold"];
S0x5565d29b40f0 -> S0x5565d29b46a0[ color="red" style="bold"];
S0x5565d29b45b0[label="*" color="red" style="bold" shape="ellipse"];
S0x5565d29b44c0[label="0.03125" color="red" shape="box"];
S0x5565d29b44c0 -> S0x5565d29b45b0[ color="red"];
S0x7facb000e6d0[label="INPUT_4" color="red" style="bold" shape="ellipse"];
S0x7facb000e6d0 -> S0x5565d29b45b0[ color="red" style="bold"];
S0x5565d29b45b0 -> S0x5565d29b46a0[ color="red" style="bold"];
OUTPUT_0[color="red2" style="filled" fillcolor="pink"];
S0x5565d29b46a0 -> OUTPUT_0[ color="red" style="bold"];
}
No preview for this file type
\documentclass{beamer}
\usepackage{appendixnumberbeamer}
\usepackage{lmodern} % For BBB
\usepackage[T1]{fontenc}
%\includeonlyframes{loc}
\mode<handout>{
\usepackage{pgfpages}
\pgfpagesuselayout{4 on 1}[a4paper, border shrink=2mm, landscape]
......@@ -158,7 +162,6 @@
Leads to loops in the signal graph
\end{frame}
\begin{frame}{FAST: Faust on FPGA}
Low-latency programs can't be executed on computers.
\begin{center}
......@@ -289,7 +292,7 @@
\item \(x\in [-1,1]\) gives \(x * x \in [-1, 1] * [-1, 1] = [-1, 1]\)
\item \lstinline{frac(n) = n - floor(n)}
\end{itemize}
\item Information may be hidden in the code
\item Information may be hidden in the code: for \(x\in [0,1]\)
\begin{eqnarray*}
x(1-x) & = & 1/4 - (x - 1/2)^2\\
\text{bad}& & \text{good}\\
......@@ -300,13 +303,12 @@
\end{frame}
\begin{frame}{Recursive Signals Problem}
Int phaser : \lstinline{process = \%(10) ~ +(1);} (\texttt{\%} is the modulo)
\begin{figure}
\centering
\subfloat[blocks]{\includegraphics[width = 0.4\textwidth, valign=c]{../code/rec-block.png}}
\hspace{\stretch{1}}
\subfloat[graph]{\includegraphics[width = 0.5\textwidth, valign=c]{../code/rec-sig-old.png}}
\end{figure}
Int phaser: (\texttt{\%} is the modulo)
\faustex{Int Phaser}{}
{0.3}{../code/rec-block.png}
{0.5}{../code/rec-sig-old.png}
{\(y(t) = 1 + y(t-1) \mod 10\)}{../code/rec.dsp}
Problem: The interval of the sample \(s(t)\) of the signal at time \(t\)
relies on the interval of the previous sample \(s(t-1)\).
\end{frame}
......@@ -371,43 +373,23 @@
\faustex{A smoother}{\label{fig:smooth}}
{0.4}{../code/smooth-block.png}
{0.5}{../code/smooth-sig-old.png}
{\(y(t) = x(t) + \frac{1}{2} y(t-1)\)}{../code/smooth.dsp}
{\only<1,4->{\small \(y(t) = x(t) + \sum_{t'=0}^{t-1} 2^{-t'}y(t')\)}
\only<2-3>{\small \( y(t) = x(t) + \frac{1}{2} y(t-1)\)}
}{../code/smooth.dsp}
With \(f: X \mapsto [-1, 1] + 1/2 * X\)\\
\only<1>{Step 0 : \([0, 0]\)}
\only<2>{Step 1 : \(f([0, 0]) \cup [0,0] = [-1,1] \cup [0,0] = [-1,1]\)}
\only<3>{Step 2 : \(f([-1, 1]) \cup [-1, 1] = [-1.5, 1.5] \cup [-1, 1] = [-1.5, 1.5]\)}
\only<1>{Step 0 : \([0, 0]\)} \only<2>{Step 1 :
\(f([0, 0]) \cup [0,0] = [-1,1] \cup [0,0] = [-1,1]\)} \only<3>{Step 2 :
\(f([-1, 1]) \cup [-1, 1] = [-1.5, 1.5] \cup [-1, 1] = [-1.5, 1.5]\)}
\only<4>{Step 3 : \(f([-1.5, 1.5]) \cup [-1.5, 1.5] = [-1.75, 1.75] \)}
\only<5>{Step \(\infty\) : \(f(\IntR) \cup \IntR = \IntR \)}\\
\uncover<4->{Infinite converging sum!\\}
\uncover<5>{Implemented workaround: signal annotation}
\uncover<4->{Infinite converging sum!\\} \uncover<5>{Implemented workaround:
signal annotation}
% \only<5>{Step \(t\) : \(f([- 2 + 2^{-t-1}, 2 - 2^{-t-1}]) \cup
% [- 2 + 2^{-t-1}, 2 - 2^{-t-1}] = [- 2 + 2^{-t}, 2 - 2^{-t}] \)}
\end{frame}
\section{Designing Accuracy for Small but Correct Computations (LSB)}
\begin{frame}{Error Model}
Use a rounding operator \(\rnd\) for computed arithmetic primitives.\\
\lstinline{(a + b) * c} implements \emph{exactly} \(\rnd(\rnd(a + b) \times c)\)\\
Absolute error \(\abserr_f = (a + b) \times c - \rnd(\rnd(a + b) \times c)\)
\begin{eqnarray*}
\abserr_f &=& (a + b)\times c - \rnd(\rnd(a + b)\times c) \pause\\
&=& (a + b)\times c - \rnd(a + b)\times c
+ \rnd(a + b)\times c -\rnd(\rnd(a + b)\times c)\pause\\
&=& [(a + b) - \rnd(a + b)]\times c +
\left[\rnd(a + b)\times c -\rnd(\rnd(a + b)\times c)
\right] \pause\\
&=& \abserr^+(a, b)\times c +
\abserr^\times (\rnd(a + b), c) \pause\\
|\abserr_f| &=& |\abserr^+(a, b)\times c +
\abserr^\times (\rnd(a + b), c) |\\
&\leq& |\abserr^+(a, b)\times c| +
|\abserr^\times (\rnd(a + b), c)|\\
&\leq& \maxerr^+ \times c + \maxerr^\times
\end{eqnarray*}
Upperbounding \(\abserr\) for any \(a,b,c\): \emph{worst-case absolute error}
\end{frame}
\begin{frame}{Local Rules, a natural idea}
Local rule: devising the LSB of a node output depending only on its type
\(+, \times\dots\) and the LSB of its inputs/outputs.
......@@ -419,32 +401,35 @@
\end{minipage}
\end{frame}
\begin{frame}{Tentatives of local rules}
\begin{frame}[label=loc]{Tentatives of local rules}
\begin{itemize}
\item From the Input to the Outputs, scale to best
\item From the Inputs to the Outputs, scale to best
\(+ : \lsb_o = \min \lsb_i^{(1)}, \lsb_i^{(2)}\)
\begin{itemize}
\item As accurate as possible
\item Potentially useless big datapath
\item \(\sin, \exp\)? \(0.1\)?
\item Don't work with loops
\end{itemize}\pause
\item From the Input to the Outputs, scale to worst
\item From the Inputs to the Outputs, scale to worst
\(+ : \lsb_o = \min \lsb_i^{(1)}, \lsb_i^{(2)}\)
\begin{itemize}
\item mostly floating-point arithmetic with a static exponent
\item LSB \(\neq\) accuracy (integers)
\item Useless bits computed everywhere
\end{itemize}\pause
\item From the Outputs to the Inputs, satisfying requirements
\(+ : \lsb_i^{(1)} = \lsb_i^{(2)} = \lsb_o - 2\)
\begin{itemize}
\item Certifies required accuracy (only if input is exact!)
\item Really suboptimal
\item Don't work with loops
\end{itemize}\pause
\end{itemize}
\end{itemize}
Local rules fail because they are local.
\end{frame}
\begin{frame}{One step back, global rules needed}
\begin{frame}[t]{One step back, global rules needed}
Outline of a possible algorithm:
\begin{itemize}
\item Detect patterns on the signal graph and contract them into one node
......@@ -455,23 +440,11 @@
\begin{minipage}{1.0\linewidth}
\centering
\includegraphics[width=.7\textwidth]{../code/pond-sig-old.png}
\mode<presentation>{\only<1>{\includegraphics[height=0.5\textheight]{../code/pond-sig-old.png}}}
\only<2>{\includegraphics[height=0.5\textheight]{../code/contract-sig-old.png}}
\end{minipage}
\end{frame}
\begin{frame}{Example of recursive pattern: IIR filters}
IIR filters : everything that can be written as a Constant-Coefficient
Difference Equation.
\[y(t) = \sum_{k=0}^M b_kx(t-k) - \sum_{k=1}^Na_ky(t-k)\]
Intuition: filters are very common in signal processing and most of the
recursive patterns of Faust are probably about implementing filters.
Previous work: thesis by A. Volkova\cite{volkova2017reliableimplementation} determining MSB and LSB for direct form I
IIR filters.
\end{frame}
\section{Conclusion and Perspectives}
\begin{frame}{Conclusion}
......@@ -505,6 +478,48 @@
\end{itemize}
\end{frame}
\appendix
\begin{frame}
\Huge \centering Thanks
\end{frame}
\begin{frame}{Error Model}
Use a rounding operator \(\rnd\) for computed arithmetic primitives.\\
\lstinline{(a + b) * c} implements \emph{exactly} \(\rnd(\rnd(a + b) \times c)\)\\
Absolute error \(\abserr_f = (a + b) \times c - \rnd(\rnd(a + b) \times c)\)
\begin{eqnarray*}
\abserr_f &=& (a + b)\times c - \rnd(\rnd(a + b)\times c) \pause\\
&=& (a + b)\times c - \rnd(a + b)\times c
+ \rnd(a + b)\times c -\rnd(\rnd(a + b)\times c)\pause\\
&=& [(a + b) - \rnd(a + b)]\times c +
\left[\rnd(a + b)\times c -\rnd(\rnd(a + b)\times c)
\right] \pause\\
&=& \abserr^+(a, b)\times c +
\abserr^\times (\rnd(a + b), c) \pause\\
|\abserr_f| &=& |\abserr^+(a, b)\times c +
\abserr^\times (\rnd(a + b), c) |\\
&\leq& |\abserr^+(a, b)\times c| +
|\abserr^\times (\rnd(a + b), c)|\\
&\leq& \maxerr^+ \times c + \maxerr^\times
\end{eqnarray*}
Upperbounding \(\abserr\) for any \(a,b,c\): \emph{worst-case absolute error}
\end{frame}
\begin{frame}{Example of recursive pattern: IIR filters}
IIR filters : everything that can be written as a Constant-Coefficient
Difference Equation.
\[y(t) = \sum_{k=0}^M b_kx(t-k) - \sum_{k=1}^Na_ky(t-k)\]
Intuition: filters are very common in signal processing and most of the
recursive patterns of Faust are probably about implementing filters.
Previous work: thesis by A. Volkova\cite{volkova2017reliableimplementation} determining MSB and LSB for direct form I
IIR filters.
\end{frame}
\mode<beamer>{
\begin{frame}[allowframebreaks]{References}
\bibliographystyle{plain}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment