News for hackers. Stuff that matters.
Re:Ada Outperforms Assembly: A Case Study by rbanffy on Friday May 27, 2011 @11:13AM (#2591716)
Programming a DSP, like driving an F1 car or flying a F-22, is supposed to be a very hard thing to do. Machines optimized for performance don't relate well to humans.

A smart compiler can remember and apply a number of optimizations far greater than I would be able to remember. The weirder the processor, the better. A really smart development tool could even benchmark variations to find the best one.

My 6502 assembly code was much better than what the Aztec C compiler could spit, but the 6502 was a sweet processor to program. DSPs (as GPUs, BTW) are anything but sweet.

And, BTW, I wouldn't try to hand tune assembly code with a modern x86 even if my life depended on it.

Re:Ada Outperforms Assembly: A Case Study by DarkShikari on Friday May 27, 2011 @01:19PM (#2592230)
And, BTW, I wouldn't try to hand tune assembly code with a modern x86 even if my life depended on it.

Writing fast modern x86 assembly is often way easier than for most any other CPU because instruction ordering generally doesn't matter much as a result of OOE (outside of Atom, at least). This basically lets you BS together a function without thinking too hard about anything other than the individual instructions.

It's trivial to beat the performance of typical C code by a factor of 10-20 in many situations, particularly in the case of DSP functions, as per the topic.

Some typical cases (measured in cycles):

  8x8 iDCT, 16-bit input to 8-bit output:
  add8x8_idct8_c: 779
  add8x8_idct8_sse2: 56

  6-tap interpolation filter, 8-bit input, 16-bit intermediate, 8-bit output:
  hpel_filter_c: 13093
  hpel_filter_ssse3: 1770

  Bilinear downscaling filter, 8-bit input, 8-bit output:
  lowres_init_c: 16308
  lowres_init_ssse3: 672

  4 SAD comparison operations on 16x16 8-bit pixel blocks, unaligned input:
  sad_x4_16x16_c: 1873
  sad_x4_16x16_sse2: 95

  Variance on 16x16 block, 8-bit input:
  var_16x16_c: 536
  var_16x16_sse2: 59
Re:Ada Outperforms Assembly: A Case Study by russell on Friday May 27, 2011 @12:45PM (#2592060)
Back in the days I did a lot of assembly programming for the CDC 6400/6600 computers. The instruction set was simple, but processor flow wasnt. IIRC there were 3 or so integer units and 1 floating point unit. If a result wasnt ready when an instruction needed it, the processing flow would stall until it was ready. So you needed to remember the instruction timings for each of the models, how many processing unit you were using, etc. to get maximum thruput. This is stuff that a compiler does easily, humans less so. Part of my team was writing hand tuned libraries and part was writing the compilers to produce optimal code. I got to see the trade-offs.

Rick James, now at Yahoo, was the king of assembly. He wrote a character move library that was faster than the character move hardware, $100K add-on. He kept getting poached from my projects, because, even at CDC, there weren't many as good as he was.

Then there is the productivity issue. The HLC programmer can produce 10x the number of instructions more than the assembly programmer.

Re:Ada Outperforms Assembly: A Case Study by rbanffy on Friday May 27, 2011 @12:50PM (#2592086)
I have the utmost respect for anyone who programs a computer that has two round monitors ;-)
Re:Ada Outperforms Assembly: A Case Study by bitwize on Friday May 27, 2011 @04:51PM (#2593019)
I have utmore respect for that person if his name is RICK JAMES.
Re:Ada Outperforms Assembly: A Case Study by rbanffy on Friday May 27, 2011 @05:15PM (#2593100)
Don't get me wrong. Rick James is, well, The Rick James.

But anyone who programmed CDC supercomputers gets some serious geek points for that.

Re:Ada Outperforms Assembly: A Case Study by blackguardx on Friday May 27, 2011 @02:04PM (#2592436)
I think it really depends on what filter or function you are implementing. For example, programming an FIR filter in assembly is easier to do on a DSP than on a conventional processor. It is true that DSPs are designed for speed, but they do that by making the architecture and instruction set match the problem space. So programming a DSP to do DSP isn't that bad.

To make a programming analogy, a DSP is like a domain specific language. It is more efficient and easier to use when used in that domain.