<?xml version="1.0"?>
<!-- name="generator" content="blosxom/2.0" -->
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">

<rss version="0.91">
  <channel>
    <title>onepartcode.com   </title>
    <link>http://onepartcode.com/main</link>
    <description>onepartcode.com - Dave Moore</description>
    <language>en</language>

  <item>
    <title>Stop it.</title>
    <link>http://onepartcode.com/main/2007/12/13#stopit</link>
    <description>
&lt;p&gt;
If you are in possession of a mail server, and your mail filter strips
out ZIP files and replaces them with a snotty message: stop it.  Stop
it, stop it, stop it!  You are not increasing security, you are simply
pissing me off.
&lt;/p&gt;

&lt;p&gt;
That's all, thank you.
&lt;/p</description>
  </item>
  <item>
    <title>360 Controller in Maya</title>
    <link>http://onepartcode.com/main/2007/06/01#X360_Maya</link>
    <description>
&lt;div class=&quot;flowright&quot;&gt;
&lt;a href=&quot;/projects/ControllerServer.cpp&quot;&gt;&lt;img width=&quot;284&quot; height=&quot;236&quot; src=&quot;/images/projects/SourceShot.png&quot;/&gt;&lt;/a&gt;&lt;br/&gt;
&lt;/div&gt;

&lt;p&gt;

Honestly, this is exactly what you were looking for. You were looking
at your $1500 copy of Maya, and thinking: why can't I control this
with my $20 USB Xenon controller?  Wonder no more: &lt;a
href=&quot;/projects/ControllerServer.cpp&quot;&gt;ControllerServer&lt;/a&gt; is here!

&lt;/p&gt;

&lt;p&gt;

This is a little one-off that I did for &lt;a
href=&quot;http://216.39.145.248/&quot;&gt;Steve&lt;/a&gt; the other day that's kinda
fun.  It allows you to connect your 360 controller to Maya as a Motion
Capture device.  The inspiration for this was &lt;a
href=&quot;http://www.geocities.com/jlimperials/realtime.html&quot;&gt;Joystick
Server&lt;/a&gt;, by Jorge Luis Imperial-Sosa.  Sadly, Steve wasn't able to
contact the author, and there were some limitations in the program
that couldn't be worked around without the source (e.g., Joystick
Server doesn't expose buttons or analog triggers), so I banged this
out for him, and cleaned it up for release.

&lt;/p&gt;

&lt;p&gt;

Pushed into the public domain, for the 2 other crazy people that want
to prototype game controls in Maya.  Should be easy to modify to use
general purpose DirectInput devices, or multiple controller inputs.
Just think, with 2 controllers, you could use Maya to play the world's
most overpriced game of Pong!

&lt;/p&gt;</description>
  </item>
  <item>
    <title>&lt;a href=&quot;http://maps.google.com/maps?f=q&amp;hl=en&amp;q=http://onepartcode.com/rides/2006_9_28/28_Sept_2006.kml&amp;ie=UTF8&amp;om=1&amp;z=11&amp;t=h&quot;&gt;Ride: Snoqualmie Valley&lt;/a&gt;</title>
    <link>http://onepartcode.com/main/2006/09/29#ride_28_sept_2006</link>
    <description>
&lt;div class=&quot;flowright&quot;&gt;
&lt;a href=&quot;http://maps.google.com/maps?f=q&amp;hl=en&amp;q=http://onepartcode.com/rides/2006_9_28/28_Sept_2006.kml&amp;ie=UTF8&amp;om=1&amp;z=11&amp;t=h&quot;&gt;&lt;img width=&quot;247&quot; height=&quot;277&quot; src=&quot;/rides/2006_9_28/28_9_2006_ride.PNG&quot; alt=&quot;Google maps view of the ride&quot;/&gt;&lt;/a&gt;&lt;br/&gt;
&lt;/div&gt;


&lt;p&gt;

Took the bike out in the company of 3 cars of which the largest was a
Miata.  We organized a Thursday afternoon ride with:

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.eelpi.gotdns.org/&quot;&gt;Tom&lt;/a&gt; and &lt;a
href=&quot;http://eelpi.livejournal.com/&quot;&gt;Louise&lt;/a&gt; in their &lt;a
href=&quot;http://www.caterham.co.uk/showroom/index.htm&quot;&gt;Caterham
7&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.glaister.com/&quot;&gt;Andy Glaister&lt;/a&gt; in his &lt;a
href=&quot;http://www.lotuscars.com/&quot;&gt;Lotus Elise&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.thegleam.com/ke5fx/index.html&quot;&gt;John Miles&lt;/a&gt;
in his &lt;a
href=&quot;http://www.mazdausa.com/MusaWeb/displayPage.action?pageParameter=modelsMain&amp;vehicleCode=MX5&quot;&gt;Miata&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Me, on my &lt;a
href=&quot;http://flickr.com/photo_zoom.gne?id=177425025&amp;size=l&quot;&gt;Suzuki
VX-800&lt;/a&gt; (Minus the windscreen for this trip.)&lt;/li&gt;
&lt;/ul&gt;

&lt;/p&gt;

&lt;p&gt;

Jeff was supposed to join us in his &lt;a
href=&quot;http://www.arielatom.com/&quot;&gt;Crazymobile&lt;/a&gt;, but had a family
emergency, so bowed out of this ride.  Hopefully we can get another
ride in before the rains begin, since his car has less protection
against water, wind, etc. than my &lt;i&gt;bike&lt;/i&gt;.

&lt;/p&gt;

&lt;p&gt;
The plan was to motor east on Novelty Hill Road, and hug the west side
of the Snoqualmie Valley up to High Bridge Road which is a wonderfully
bendy bit of two lane climbing out of the northwest corner of the
valley, and from there, work our way more or less straight back to
Kirkland.
&lt;/p&gt;

&lt;p&gt;
We started off with a straight bit of highway driving, I405 S to
SR520, which was relatively empty, allowing a bit of lane jockeying
and Unseemly Displays of Acceleration.  Taking Redmond Way east, we
turned north at 204th Place NE (an inspired detour suggested by Andy),
which was the best curvy section of the day, IMO.  I'm actually
somewhat embarrassed that I didn't know about this road, since it's
less than a mile from my house.  Heading through the boring bit of
Novelty Hill, we hit the curves on the end, and turned north on NE
Snoqualmie Valley Road.
&lt;/p&gt;


&lt;p&gt;

This is where things came off the rails a bit.  About a mile up the
road, we found that the DOT had shutdown our route for maintainance.
Bummer.  This actually turned out to be fortuitous, since we decided
to take a slightly longer route than we had originally planned.  Off
to Duvall!  Cutting over to 203, we headed north to the start of
Cherry Valley Road, a newly paved loop behind Duvall.  Sadly, we got
stuck behind a slow-moving Dodge Caravan for most of the fun bits.  At
the reconnection with 203, we stopped to grab a drink and found out
from the woman working the counter that the section of High Bridge
that we were originally aiming for was actually open once you were
past the closure.  We cut over the north end of the valley at Crescent
Lake Rd, passing an odd farm with Department of Corrections signs all
over it.  Very strange, but since it was unoccupied (apparently), I
couldn't quite make out what the deal was.  Honor farm?  Work release?

&lt;/p&gt;

&lt;p&gt;

Connecting with High Bridge, we headed north up and out of the valley.
More fun curves here, although again we got stuck behind a slow-moving
vehicle.  (Amy, stop reading here.)  Probably for the best, since I
blew an S-curve, and nearly entered the opposing lane of traffic.  I
was able to use the rear brake to get the bike under control before
crossing the line, but I probably made Andy step on the brakes a
little harder than he was planning.  Need to practice those compound
curve entries and exits...

&lt;/p&gt;

&lt;p&gt;

From there, it was more or less just cruising back to Kirkland, via
522 and 202.  There was a gratifying bit when we were stopped briefly
on 522 at a light with nothing in front of us for at least a mile.
This provided another great opportunity for an Unseemly Display of
Acceleration.  I was in the lead, and Andy was polite enough not to
blow by me in the Lotus, which was a bit disappointing, since I wanted
to see what the Elise could do from the line.

&lt;/p&gt;

&lt;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://onepartcode.com/rides/2006_9_28/28_Sept_2006.kml&quot;&gt;Google Earth KML&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Load the track in &lt;a href=&quot;http://maps.google.com/maps?f=q&amp;hl=en&amp;q=http://onepartcode.com/rides/2006_9_28/28_Sept_2006.kml&amp;ie=UTF8&amp;om=1&amp;z=11&amp;t=h&quot;&gt;Google maps&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
Sadly, the GPS cut out for one major leg, the long straight line
across the valley starts at the location we were turned around by the
road closure.
&lt;/p&gt;</description>
  </item>
  <item>
    <title>Cache Misses: Bad</title>
    <link>http://onepartcode.com/main/2006/09/14#cache_misses</link>
    <description>
&lt;p&gt;

So that's not a particularly controversial statement, but it really
took on new meaning this afternoon.  While plowing through &lt;a
href=&quot;http://radgametools.com/gramain.htm&quot;&gt;Granny&lt;/a&gt; in the &lt;a
href=&quot;http://www.xbox.com/&quot;&gt;Xbox 360&lt;/a&gt; profiler, I noticed something
rather improbable.  A function that did essentially no computation,
just a loop and a few conditional dispatches, was taking in excess of
10% of the time in one of our critical sampling paths.  Odd.
Mispredicted branches are bad, but &lt;i&gt;that&lt;/i&gt; bad?  So, after setting
up a decent test case and stuffing it through the profiler, one number
jumped out.  In 100 calls to the function, it was missing the &lt;a
href=&quot;http://en.wikipedia.org/wiki/CPU_cache&quot;&gt;L2 data cache&lt;/a&gt; 22000
times.

&lt;/p&gt;

&lt;p&gt;

&lt;b&gt;22 f***ing thousand cache misses!!!&lt;/b&gt;

&lt;/p&gt;

&lt;p&gt;

It's really hard to overstate just how bad that is.  &lt;a
href=&quot;http://radgametools.com/gramain.htm&quot;&gt;Granny&lt;/a&gt; is by it's
nature somewhat non-local in it's memory accesses, but that's simply
ridiculous.  200+ cache misses per call?  A handy rule of thumb for
the time taken by L2$ misses on the X360 is &quot;5000 misses ~= 1
millisecond&quot;.  That's pretty close on the &lt;a
href=&quot;http://www.us.playstation.com/PS3/&quot;&gt;PS3&lt;/a&gt; as well, assuming
that the SPUs aren't banging on the memory bus at the same time.  So
the function was wasting around 4.5 milliseconds per frame just
waiting around for memory to be delivered.

&lt;/p&gt;

&lt;p&gt;

The good news is that the problem was really easy to fix.  Thrown in a
few prefetches, and the cache misses dropped to essentially zero.
(~600 per 100 calls, which is totally acceptable.)  Throw a few more
around, and the application which was missing L2$ 44k times per frame
now drops to 12k.  That's a savings of 32k L2$ misses ~= 6
milliseconds.  Per frame!  12k cache lines is roughly 1.5 megs on the
360, which is close to the working set size of this particular stress
test.  Much better.  Five lines of prefetches sped up the test app by
20%.

&lt;/p&gt;

&lt;p&gt;

The whole episode points to part of the fun (and the pain) of
developing for multiple platforms at the present moment in the gaming
technology curve.  If you don't keep a close eye on the strengths and
weaknesses of each platform, you are absolutely doomed.  Those cache
misses never showed up as a problem on the x86 platform where I do
most &lt;a href=&quot;http://radgametools.com/gramain.htm&quot;&gt;Granny&lt;/a&gt;
development, since the out-of-order core hid most of the memory
latency.  The current generation of Intel and AMD chips also have &lt;a
href=&quot;http://www.realultimatepower.net/index4.htm&quot;&gt;ninja&lt;/a&gt;
predictive prefetch hardware, which Microsoft chose not to include in
the PPC-based Xenon cores.  The &lt;a
href=&quot;http://www.us.playstation.com/PS3/&quot;&gt;PS3&lt;/a&gt; does have a basic
predictive prefetcher, but it's not nearly as intelligent as a modern
out-of-order core.

&lt;/p&gt;

&lt;p&gt;

Now I just have to figure out how to do something sensible with the &lt;a
href=&quot;http://en.wikipedia.org/wiki/Cell_microprocessor#Synergistic_Processing_Elements_.28SPE.29&quot;&gt;SPUs&lt;/a&gt;
on the PS3...

&lt;/p&gt;
</description>
  </item>
  <item>
    <title>RSS and Macs</title>
    <link>http://onepartcode.com/main/2006/05/03#rss_and_macs</link>
    <description>
&lt;div class=&quot;flowright&quot;&gt;
&lt;img width=&quot;150&quot; height=&quot;150&quot; src=&quot;/images/rss-hq.png&quot; alt=&quot;RSS Icon&quot;/&gt;
&lt;/div&gt;

&lt;p&gt;
By request, I've enabled the &lt;a href=&quot;http://www.blosxom.com/&quot;&gt;Bloxsom&lt;/a&gt; RSS
feed doohickey.  It's always slightly startling to be reminded that on occasion
people actually read this stuff.  Makes me want to go back and erase a bunch of
entries... 
&lt;/p&gt;

&lt;p&gt;
For instance, I wrote a &lt;a
href=&quot;http://onepartcode.com/main/misc/ipod_betrayal.html&quot;&gt;snark about iPods&lt;/a&gt;
a year and change ago.  I still believe all of those words are true, but I no
longer care.  I have an iPod, I love working on the Intel iMac at the office,
and if I wasn't fairly sure that it would melt a hole in my lap, I'd be raiding
Wyatt's college fund to buy a Macbook.  I've been replaced by a pod person.
Give me shiny white plastic!
&lt;/p&gt;

&lt;p&gt;
I should just delete the post.  I don't think current me should be held
responsible for the words of past me.
&lt;/p&gt;</description>
  </item>
  </channel>

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script><script type="text/javascript">_uacct = "UA-1960424-1";urchinTracker();</script>
</rss>