William Edwards, Coder

Apr 07

I’m giving a Mill CPU talk in Växjö, Sweden 2014-04-25

There are perhaps a few seats available to interested members of the public if you’re in or near Växjö at the end of the month :)

Announcing a presentation at 13.00h, Friday, April 25 at: 

Linnéuniversitetet (Linnaeus University) 
Vejdes Plats 6, Linnéuniversitetet 
Building B, Room 3021 
352 52 Växjö Sweden 

The new Mill CPU architecture 

A presentation by Will Edwards (Mill Computing) 

The new Mill CPU architecture brings DSP-like efficiency and performance to general purpose computing. Offering a 10x power/performance gain over conventional out-of-order superscalar architectures, the Mill family of CPUs scales from phones to supercomputers. 

The Mill is an extremely wide-issue VLIW design, able to issue up to 33 operations per cycle. The Mill is inherently a vector machine and can vectorize and pipeline almost all loops. The Mill is a belt machine (as distinct from a stack or register machine) and has a fine grained 
security model that facilitates microkernels without performance penalties. 

This talk will give a high-level introduction to the Mill programming model, with an opportunity for the audience to ask more detailed 
questions in areas of interest.

Mar 25

Mill Security Talk now online

The Mill CPU’s Security talk is now online:

Mar 12

Russia’s Salami Tactics in Crimea

Well worth a re-watch all the way through :)

Snowden was right about encryption - so what can programmers do about it?

Right now, the NSA - and China, France, Britain, Russia and doubtless all others - hoover up and store every byte.  And they go fishing.

We need to move back to a world where they have to break into your computer - something they’ll only do if they target you personally, not generally - to spy on you.

And we can do that by encrypting everything.  Everything.

Encrypted data cannot be compressed and is therefore much harder to store.  And if they do invest in storing it anyway, forward privacy can hopefully keep much of it private in the future too.

How to encrypt everything?  Normal websites won’t adopt TLS unless forced to; browsers should show very nasty banners on HTTP connections, perhaps?  Big brands won’t want that floating over them.

Browsers should only use encrypted comms to do DNS lookup too.  So much is in the hands of the browsers.

CDNs should rewrite everything to be TLS.

Also, the *ahem* porn industry ought to adopt TLS outright.  They don’t want their customers scared away, right?

BitTorrent has traditionally used encryption to prevent ISPs from traffic shaping.  But BitTorrent encryption is obfuscation at best, and the ciphers picked were picked to minimise CPU.  These days, we have more CPU.  BitTorrent needs strong encryption.

How else can big swathes of the internet be encrypted quickly?

Mar 05

Table-based Template Translation in C++

This is a great technique I devised for simplifying the optimization of translation functions.  Its broadly applicable to performance-critical code beyond software graphics.  I’d love to know if there’s a proper name for this pattern, and if anyone else has ever used it and for what?

At UIQ (a Symbian smartphone UI maker) we needed really fast bitmap blitting performance in the Symbian software graphics library and we just weren’t getting it.

If two bitmaps are the same format, you can just memcpy (or blend or whatever) pixels from one to the other.

If two bitmaps are different formats, you have to translate the source bitmap’s pixels to the destination bitmap’s format.

However, the Symbian libraries themselves were shooting us in the foot.  There were some special-cased blits for same-format source and destinations, and a hand-coded special-case for 16-bit colour with a separate 8-bit alpha mask bitmap into a 24-bit destination with 32-bit alignment, and that was it.

All other conversions went via two virtual method calls… one to convert from source to a 32-bit RGBA universal internal format, and the other to convert to destination format.

Who would use virtual inheritance per-pixel for critical-path colour conversion on a constrained device?  I know their name ;)

Read More

Feb 24

Flame Graphs!

A long time ago now I made a novel little sampling profiler for Python:

Well, I was just looking through the excellent slides about Linux and Solaris performance, and stumbled across Flame Graphs

There are fundamental differences, particularly on the x axis, but still.. :)

Feb 17

obiwan type-checker for Python 1.0.1 released!

Obiwan actually has a very small - but very active - community :)

So I’ve put it on pypi.  Its my first Python package but it works.  Here, perhaps, it might be more accessible to more people.

You can use lambdas as checkers e.g.:

template = {
   'month': lambda x: x in ["jan","feb","mar",...],

You can specify options for dictionaries such as strict keys (extra unspecified keys not allowed) and subtype.

Subtype is cool - you can specify that a dictionary template should inherit the specification of any number of parent templates!

You can also specify that a duck inherits its attributes from any number of parent ducks too.

Feb 10

Introduction to the Mill CPU Programming Model

Introduction is now published!

It was well received on Hacker News and Proggit.  Increasingly, there are a body of commentators who are watching all the talks and putting it all together, so there are lots of programmers jumping in to straighten out misapprehensions and misunderstandings :)

A video of the Execution talk is now online:

This is not the final edited video; there’ll be a proper posting to the Mill forums real soon with slides and everything too soon.

Feb 04

Reports of Corewar death have been greaty exaggerated

I got mail:

       ORG      START
       DIV.AB #   126, $     1     
       MUL.AB #   126, #   398     
       ADD.AB #  1266, $    -1     
START  SNE.AB #     0, $    93     
       MOV.X  $    92, $    92     
       SNE.AB #     0, $    91     
       MOV.X  >     5, $    90     
       MOV.B  $    89, $    15     
       MOD.AB #    88, $    14     
       DIV.AB #    88, $    87     
       SNE.AB #    87, $    12     
       JMP.B  $   -11, $    21     
       MOV.AB #    48, $    85     
       SEQ.AB #    48, $    84     
       SNE.AB #    24, $    83     
       MOV.X  >     7, $    79     
       SEQ.AB #    36, $    81     
       SNE.AB #    12, $    80     
       MOV.X  $    76, $    76     
       MOV.I  $    75, $    76     
       MOD.AB #     2, $    75     
       SEQ.AB #     0, $    74     
       SPL.B  @   -21, $     0     
       ADD.AB #     1, $   -22     
       DIV.AB #     2, $    70     
       MOV.I  $    72, $    70     
       MOD.AB #     6, $    69     
       SNE.AB #     1, $    68     
       ADD.AB #   120, $   -27     
       DJN.B  $   -16, $    68     
       SUB.AB #  1001, $   -29     
       DJN.B  $   -28, #    87     
       JMP.B  # -3206, $  3204     
       DAT.F  $ -2122, $ -2676     
       DAT.F  $  3907, $  -284     
       DAT.F  $  2972, $ -1801     
       DAT.F  $ -2676, $ -1790     
       DAT.F  $ -3018, $ -3182     
       DAT.F  $ -3536, $  -296     
       DAT.F  $ -2298, $ -1807

It was, naturally, a Corewar program that needed to be executed to be read:


Watch corewar.co.uk for more details, coming soon!

How modern CPUs work

This is an excellent explanation that everyone should read: http://www.lighterra.com/papers/modernmicroprocessors/; of course, it hasn’t been updated with the ground-breaking Mill CPU architecture yet ;)

And don’t forget that today (Feb 5th 16:15 PST; so that’s like 1:15am in my part of Europe) is the 6th talk in the Mill series!

Jan 30

Why the new Mill CPU is just so fast!

I’m just so excited about the next Mill CPU talk.  It’s streaming live (Mac and Linux users: I’ve heard VLC can play asx) on Feb 5th and its going to tell us why the Mill is so damn fast!

Some things can be vectorised.  The Mill is a vector machine, and can vectorise a whole of stuff like while loops that, traditionally, haven’t been vectorisable.  The Mill can vectorise normal general-purpose code, and no processor has ever been able to do that before.

It gets better; some instructions can be issued in parallel to others (Instruction Level Parallelism (ILP)).  This is what out-of-order CPUs like your phones and laptops and servers are doing.

The conventional wisdom is that normal general-purpose code only has an ILP of 2 or so, though.  The highest-end out-of-order conventional CPUs can cope with a heroic 3 or 4 IPL, but normal code rarely gives them more than 2.

And the Mill is able to issue up to 33 ops / cycle, so what to fill up all those idle pipelines with?

This is what this next talk will describe: the Mill is able to execute operations that depend on the result of previous operations in the same cycle as those previous operations!  The Mill can execute up to 6 chained dependent operations in a single cycle :D

They call it Mach 3.  You want your next chip to run at Mach 3, right?

Jan 23

Senior Devs are The Problem

David Sobeski explains how Microsoft torpedoed 3rd party devs so often that they became irrelevant.  He starts by describing how good Microsoft were at compatibility, and then talks about how everything changed.  Joel Spolsky was completely right.

So if you keep rewriting your developer APIs, you end up ensuring that no developer will touch you with a bargepole.  Its easy to imagine that as the rise of Microsoft was Billg time and the fall was Balmar that its about leadership from the top.  But I find the argument that it was the Microsoft devs themselves quite compelling: Rick LaPlante says:

I spent 19 years in the developer division, starting with the C5.1 compiler through the .NETification of the developer experience. David is not far off. …  It wasn’t really management that said “lets go break everything”, it was mid to senior level engineers/architects that disregarded everything we’d built in the past.

At Symbian/UIQ I poured far too much of my soul into trying to get UIQ to evolve not rewrite; I went from architect to product management to try and get the clout needed to level the keel.  Now its not like UIQ were ever more than an also-run, but the pain of infighting and the pressure to rewrite because the devs say there is no other way is always too great :(

Remember the hate that Jamie Zawinski got for saying that you shouldn’t break working code?  And I got hate mail when I joined in with that.  Well, now its happening for David Sobeski too :(

Devs need to wake up and understand change is bad, however uncool and uninteresting that makes their day jobs.

Jan 19

NSA roots in the American Revolution?

The President started his surveillance speech by talking about spies in the American War of Independence, trying to frame domestic spying as a patriotic tradition:

At the dawn of our Republic, a small, secret surveillance committee borne out of the “The Sons of Liberty” was established in Boston. And the group’s members included Paul Revere. At night, they would patrol the streets, reporting back any signs that the British were preparing raids against America’s early Patriots.

Well, if we brits had had NSA-like spying capabilities then, we’d have been able to round up those pesky terrorists pronto!

America would still be British, basically.  Domestic surveillance is sobering, eh? ;)

Jan 10

Goodbye Giving

Sadly, I’ve just banged the giving.code project on the head.

A lot of people offered to fix the website, which was kind of not where I wanted the enthusiasm channelled.

A few good projects turned up on the site, but programmers didn’t flock to fix them.

I did get a few good leads myself personally out of it and did find some small but meaningful projects helping people.  But nothing big.

And from 1000 feet, it was an moribund backwater that petered out, evaporated.

I’ve been mulling if I should try again with it, stir people up again and so on carefully.  I’ve decided no, not right now.  Perhaps again in the future, and in a different way.  I just don’t know what different way.

Jan 09

We are Huxleying ourselves into the full Orwell. -


Try as I might, I can’t shake the feeling that 2014 is the year we lose the Web. The W3C push for DRM in all browsers is going to ensure that all interfaces built in HTML5 (which will be pretty much everything) will be opaque to users, and it will be illegal to report on security flaws in them…