<br><br><div class="gmail_quote">On Mon, Mar 16, 2009 at 11:41 AM, Nicolas Cellier <span dir="ltr">&lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Eliot,<br>AFAIK, VW does not use the nan trick, so it has to perform extra conversions on SmallDouble, doesn&#39;t it?</blockquote><div><br></div><div>That&#39;s right.  The VW 64-bit immediate double representation is </div>
<div>msb                                                            lsb</div><div>| 8 bit exponent | 52 bit mantissa | sign | 3 bit tag |</div><div><br></div><div>i.e. immediate doubles occupy the middle range of the doubles that corresponds to single-precision floats, ~ 10-38.</div>
<div><br></div><div>Putting the sign bit down low means that +/- 0 are the only immediate double values whose bit patterns are &lt;= 15.</div><div><br></div><div>Converting an immediate double to an IEEE double then involves</div>
   - logical shift right 3 bits (sign is now lsb)<div>   - compare against 1 to distinguish +/- 0 from others</div><div>   - if &gt; 1 (not +/- 0)</div><div>        - add exponent offset (maps 8-bit exponent to 11-bit exponent)</div>
<div>   - rotate right 1 (move sign to sign bit)</div><div>   - move integer reg to float reg</div><div><br></div><div>Going in the other direction</div><div>    - move fp reg to integer reg</div><div>    - rotate left 1 bit (sign is now lsb)</div>
<div>    - compare against 1 to distinguish +/- 0 from others</div><div>    - if &gt; 1 (not +/- 0)</div><div>          - subtract exponent offset (maps 11-bit exponent to 8-bit exponent)</div><div>          - fail if overflow (e.g. jump to code that boxes the float)</div>
<div>    - shift left 3</div><div>    - add tags</div><div><br></div><div>So more complicated than immediate integers but of a similar complexity to the fp unit&#39;s internal operations on floats (extracting exponent, shifting mantissa by exponent).</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br><br>Nicolas<br><br><div class="gmail_quote">2009/3/16 Eliot Miranda <span dir="ltr">&lt;<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>&gt;</span><div class="im">
<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><br><br><div class="gmail_quote"><div>So the experience with my 64-bit VW implementation was that</div>

<div>    - typical large symbolic benchmarks (e.g. all senders) were 15% to 20% slower in 64-bits than in 32-bits.</div><div>    - immediate double arithmetic is about 3 times faster at about half the speed of immediate integer operations</div>


<div>    - images are about 55% larger when converted from 32-bit to 64-bit</div><div><br></div><div><br></div><div>Eliot</div><div><br></div></div>
<br></blockquote></div></div><br>
<br><br>
<br></blockquote></div><br>