Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
adud
rapportstagem2
Commits
dd19a5ec
Commit
dd19a5ec
authored
Jun 18, 2021
by
Antonin Dudermel
Browse files
spellcheck lsb
parent
99227006
Changes
1
Hide whitespace changes
Inline
Sidebyside
report/lsb.tex
View file @
dd19a5ec
...
...
@@ 14,11 +14,11 @@ numbers on \(w\) bits potentially gives a number on \(2w\) bits. Ensuring that
every multiplication is exact would lead to a tremendous number of bits at the
end of the computations. Worse, there are some very convenient numbers, such as
\(
0
.
1
\)
, that don't have a finite binary representation. This is mainly due to
the fact that humans  and particular
i
ly in signal processing where attenuation
the fact that humans  and particularly in signal processing where attenuation
is expressed in decibels  compute in base 10, whereas most of the computers
prefer the base 2.
So errors are unavoidable, yet it is not an hopless case. In the real (or at
So errors are unavoidable, yet it is not an hop
e
less case. In the real (or at
least physical) world, every value, every measure has an uncertainity. But it is
not a problem, provided that one can prove that this uncertainity is bounded by
a value that is negligible when compared with the result. For instance in sound
...
...
@@ 52,9 +52,9 @@ second one is that if we compute a result that is more accurate than
because of the small input of the DAC. These two ideas are at the core of
FloPoCo's motto:
\emph
{
``Compute Just Right''
}
. Compute right, to have (almost)
all the bits of the output correct, but don't do more than what is needed. In
other words, every computed bit must be meaningful. An
t
oher important part of
other words, every computed bit must be meaningful. Ano
t
her important part of
FloPoCo philosophy is that one should not write operators depending on a given
precision (single, double, quad precision floats) but instad have a generator
precision (single, double, quad precision floats) but inst
e
ad have a generator
that can compute operators parameterized by the accuracy of its inputs and
outputs. This allow the operators to be more versatile and futureproof. The aim
of this part is to apply this philosophy to Faust programs.
...
...
@@ 65,7 +65,7 @@ one mathematical operation, there is one generator along with one academic paper
proving its correctness. Here, we are dealing with an arbitrary Faust
program. The second difference comes from the input part of the audio processing
circuit. The dual operator of the DAC is the ADC (for AnalogtoDigital
Converter). Its role is to transform analogic data (such as the vibration of the
Converter). Its role is to transform analogic
al
data (such as the vibration of the
membrane of the microphone) into a digital one. This process, called
quantization, leads to unavoidable errors directly in the inputs, where in
FloPoCo, one of the work hypotheses is that every input is correct.
...
...
@@ 83,7 +83,7 @@ FloPoCo, one of the work hypotheses is that every input is correct.
It should be clear by now that
\texttt
{
a + b
}
does not implement
\(
a
+
b
\)
,
mainly because there is absolutely no guarantee that
\(
a
+
b
\)
can be
represented in the same format as
\(
a
\)
and
\(
b
\)
. But it can be modelled as
follow. One can ensure that
e
\texttt
{
a + b
}
implements
\(
\rnd
(
a
+
b
)
\)
, with
follow. One can ensure that
\texttt
{
a + b
}
implements
\(
\rnd
(
a
+
b
)
\)
, with
\(
\rnd
\)
a
\emph
{
rounding
}
operator, for instance RN for RoundingtoNearest,
which replaces
\(
a
+
b
\)
by the number in the output format that is the nearest
to the real mathematical value
\(
a
+
b
\)
. This is very convenient, because this
...
...
@@ 123,7 +123,7 @@ example:\footnote{assuming our backend doesn't have a fusedmultiplyadd}
&
\leq
\maxerr
^
+
\times
c +
\maxerr
^
\times
\end{align*}
Remark that the error on
\(
f
(
a,b,c
)
\)
depe
d
ns on a bound on the value of
Remark that the error on
\(
f
(
a,b,c
)
\)
depen
d
s on a bound on the value of
\(
c
\)
. Error analysis also depends on bounds of values as determined in the
previous section. If this technique seems automatic, there are some tricks
involved. For instance, why inserting the lesserroneous term
...
...
@@ 188,7 +188,7 @@ proofs.
\subsection
{
Local Rules, easy to implement but hard to devise
}
\label
{
sec:localrules
}
At the begining of this internship, the forseen technique to design accuracy was
At the begin
n
ing of this internship, the for
e
seen technique to design accuracy was
to use a simple walk on the signal graph, apart maybe from feedback loops. My
role was to design a set of rules that would determine the LSB of a node of the
signal graph (
\ie
{}
a signal) depending on its type (
\(
+
,
\times
\)
, constant,
...
...
@@ 196,7 +196,7 @@ input, etc\dots), the LSB of its input nodes (its arguments if it is an
operator) when doing an InputtoOutput approach and the LSB of its output nodes
(the operators fed by the signal) when doing an OutputtoInput approach.
However, having failed to implement convincing rules, I succeded to show in
However, having failed to implement convincing rules, I succe
e
ded to show in
which extent this approach is missing relevant information in order to determine
LSB.
...
...
@@ 205,7 +205,7 @@ LSB.
The first natural idea was to start from the inputs and to do computations as
precise as possible, in order to avoid roundoff errors. According to this
priciple, some rules are very easy to derive, for instance the sum of two
pri
n
ciple, some rules are very easy to derive, for instance the sum of two
elements with LSB
\(
\lsb
_
1
,
\lsb
_
2
\)
must have a LSB
\(
\lsb
=
\min
(
\lsb
_
1
,
\lsb
_
2
)
\)
, their product must have
\(
\lsb
=
\lsb
_
1
+
\lsb
_
2
\)
. At this condition, fixedpoint multiplication and
...
...
@@ 227,11 +227,11 @@ addition are exact (see \figref{fig:scalebest}).
\label
{
fig:scalebest
}
\end{figure}
\faustexfig
{
Pondera
ted sum
}{
\label
{
fig:pond
}}
%
\faustexfig
{
Weigh
ted sum
}{
\label
{
fig:pond
}}
%
{
0.4
}{
../code/pondblock.png
}
%
{
0.5
}{
../code/pondsigold.png
}
%
{}{
../code/pond.dsp
}
%
On the
pondera
ted sum example~
\figref
{
fig:pond
}
, assuming an input LSB of 23 would
On the
weigh
ted sum example~
\figref
{
fig:pond
}
, assuming an input LSB of 23 would
give an output LSB of 28.
Yet this approach raises many questions concerning primitives such as the
...
...
@@ 286,7 +286,7 @@ and \(x(t)\) with LSB \(\lsb, \lsb'\) such that \(\lsb > \lsb'\), bits of
\label
{
fig:scaleworst
}
\end{figure}
On the
pondera
ted sum example~
\figref
{
fig:pond
}
, this would lead to a LSB of
On the
weigh
ted sum example~
\figref
{
fig:pond
}
, this would lead to a LSB of
\(

23
\)
on the whole circuit. If the question of the irrational primitives is
still pending, using always the worst precision makes the datapath shrink
instead of growing, so the circuit costs far less, and because of the format of
...
...
@@ 307,7 +307,7 @@ scaletobest case is also true, but on each signal. For instance
on~
\figref
{
fig:pond
}
the last sum is between an element of LSB index
\(

23
\)
and
an element of LSB
\(

28
\)
, so the 5 last bits of the bottom part of the sum must
be truncated. However, this information is not backpropagated, indicating that
those last bits are not useful
l
.
those last bits are not useful.
Finally, there are many cases on which the LSB does not represent the error on
the signal. The most obvious case is the integer signal which is exact but whose
...
...
@@ 315,7 +315,7 @@ LSB is 0. Integers are very easy to detect at compiletime, but this can be
generalized to any LSB index using sliders. A slider is a Faust primitive used
to declare GUI elements that allows the user to interact with a Faust program
(see
\figref
{
fig:sliders
}
). One can declare a slider with 5 arguments: its name,
default value, minimum, maximum and step. The signal outputed by the slider can
default value, minimum, maximum and step. The signal output
t
ed by the slider can
then take a value between its minimum and maximum that is an integer multiple of
the step. A very basic usage is the gain slider: multiplying a signal by a
slider between 0 and 1 just before the final output allows to tune the volume at
...
...
@@ 394,7 +394,7 @@ we then have
So, to ensure
\(
\abserr
_
T
\leq
2
^{
\lsb
}\)
, we need to have
\(
\lsb
'
=
\lsb

2
\)
. Note that the bits at index
\(
\lsb

1
,
\lsb

2
\)
are finally dropped but they
are not useless, they participate in the accuracy of the result before the
rounding. These bits are named
\emph
{
guard bits
}
in the lit
t
erature.
rounding. These bits are named
\emph
{
guard bits
}
in the literature.
As optimal as this result might be, we can still do better. If we want the
result of
\(
(
a
_
1
+
a
_
2
)
+
(
a
_
3
+
a
_
4
)
\)
with an LSB of 23, applying the rule a
...
...
@@ 460,7 +460,7 @@ asglobalaspossible automatic approach. We opted for the following method
\begin{enumerate}
\item
Detect patterns on the graph and contract them into one special node
indexed with the pattern
\item
Apply one of the aformention
n
ed local rules on the contracted graph
\item
Apply one of the afor
e
mentioned local rules on the contracted graph
\item
Compute the LSB of the elements of each pattern according to the global
outputs and inputs of the pattern computed at the above step
\end{enumerate}
...
...
@@ 490,7 +490,7 @@ useful\cite{volkova2017reliableimplementation}. We fall back on the literal
programming problem: once implemented, there is absolutely no clue to tell the
compiler that the wanted processor was a biquad. Yet, as biquads are very useful
processors, they are already implemented in the standard library. So the biquad
implementation of most reallife
f
aust programs is simply calling the
implementation of most reallife
F
aust programs is simply calling the
\lstinline
{
biquad
}
function of the filters library from the standard library,
which is very easy to detect, but this must be done before functions evaluation.
...
...
@@ 503,7 +503,7 @@ adding a rounding to \(2^{\lsb}\) before the output, and doing every computation
with
\(
1
+
\lceil
\log
(
n
)
\rceil
\)
guards bits (
\ie
{}
with an LSB index of
\(
2
^{
\lsb

1

\lceil
\log
(
n
)
\rceil
}\)
). For the biquad case, and more
generally for any LTI filter, the tool described in
\cite
{
volkova2017reliableimplementation
}
would also be very useful
l
. Indeed,
\cite
{
volkova2017reliableimplementation
}
would also be very useful. Indeed,
WCPG are necessary to estimate the error propagation: for a filter
\(
f
\)
with
WCPG
\(
W
\)
, by linearity
\(
f
(
x
(
t
)
+
\abserr
_
x
)

f
(
x
(
t
))

=
f
(
x
(
t
)
+
\abserr
_
x

x
(
t
))

=
f
(
\abserr
_
x
)

\leq
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment