home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / compiler / 2065 < prev    next >
Encoding:
Text File  |  1992-12-23  |  5.2 KB  |  110 lines

  1. Newsgroups: comp.compilers
  2. Path: sparky!uunet!world!iecc!compilers-sender
  3. From: jeff@dsp.sps.mot.com (Jeff Enderwick)
  4. Subject: Re: compilers for DSP processors
  5. Reply-To: jeff@dsp.sps.mot.com (Jeff Enderwick)
  6. Organization: Motorola DSP Compilers
  7. Date: Tue, 22 Dec 1992 16:53:43 GMT
  8. Approved: compilers@iecc.cambridge.ma.us
  9. Message-ID: <92-12-097@comp.compilers>
  10. Keywords: DSP
  11. References: <92-12-094@comp.compilers>
  12. Sender: compilers-sender@iecc.cambridge.ma.us
  13. Lines: 95
  14.  
  15. > [dismal report on the state of DSP compilers.]
  16. > - Do you agree on the above ? (the quality of DSP compilers)
  17.  
  18. Well, sort of. I would say that generalizing to a "performance hit factor"
  19. should really be avoided. Sometimes compilers match hand code, but not
  20. often. Sometimes they're worse than 5x. The trouble with DSP compilers
  21. stems from language, architecture, and the nature of how DSPs are used.
  22.  
  23. DSPs are, in almost every case extremely cost sensitive. The huge majority
  24. of DSPs sold use a fractional data type, because the dynamic range added
  25. by floating point doesn't nearly offset the cost of storing exponents in
  26. memory! With compiled code being slower than hand code, the cost of the
  27. end product goes way up. Let's say, for example that I use a compiler when
  28. designing a cellular phone. If the performance is 1.22x hand code, then I
  29. would need to go from a 27MHz part to a 33MHz part, significantly raising
  30. the cost of every phone that I produce. I guess my point is that 99.9% of
  31. DSP applications are *so* cost sensitive that *no* performance hit is
  32. acceptable.
  33.  
  34. Why is there a performance hit, as we all know that compiled code is
  35. faster than hand code? Well, two reasons: popular programming languages
  36. such as C don't always map well onto DSP architectures, and DSP
  37. architectures aren't typically amenable to compiler optimization.  DSP
  38. architectures often have features whose use isn't generally expressible in
  39. languages such as C. Their use requires insight into the algorithm being
  40. performed. Language extensions are possible, but so far there hasn't been
  41. any consensus, and all DSPs don't have the same bag of tricks.  Remember:
  42. if you aren't 100% as fast as hand code the compiler will not be used for
  43. the time-critical sections.
  44.  
  45. DSP architects tend to use whatever tricks they can to get maximum
  46. performance over a relatively small set of DSP algorithms, general
  47. performance be damned. Instruction sets tend to be highly non-orthogonal.
  48. Unless you've done CPU microcode or programmed a DSP, you probably have
  49. not seen anything like these chips. For example, register selection and
  50. scheduling can interact in such a way that whether two operations can be
  51. scheduled to fire at the same time depends upon the register selections
  52. made for the two operations. I'm not talking about false
  53. data-dependencies, but rather that
  54.  
  55.     fmpy    d5,d6,d2    fsub.x    d7,d1
  56.  
  57. is allowed, but 
  58.     
  59.     fmpy    d3,d6,d2    fsub.x    d7,d1
  60.  
  61. isn't because (d3,d6) isn't among the list of allowed *operand pairs* for
  62. a parallel multiply and subtract. This is an example from the our high
  63. end, "compiler friendly" DSP. It only gets tougher when you move down the
  64. cost ladder.
  65.  
  66. So why bother with compilers at all? Cost and time to market. Some DSP
  67. systems are composed of a "normal" microprocessor and a DSP. If you make
  68. it easy to program the DSP in a high level language, then you make it
  69. easier to do without the microprocessor. Note that the hard real-time part
  70. of the application will, in general, still be hand coded. Compilers help
  71. significantly on the time to market front. The better the compiler, the
  72. greater the portion of the application that can be coded in C. It is
  73. faster to code in a high level language than in assembly.
  74.  
  75. >             - non-procedural languages as e.g. Silage are better ?
  76.  
  77. I'm unfamiliar with Silage. Where can I find info?
  78.  
  79. >             - no or not enough use of the low-overhead-loop facility of a
  80. >               processor as the "DO" for Motorola and the "RPT" for Texas
  81. >        Instruments processors ?
  82.  
  83. Do loops are actually pretty easy. We'll even compute the loop count at
  84. run time and use a do if it's feasible (of course we must also check the
  85. computed value, since a zero operand makes do loop 4 billion times!).
  86.  
  87. >             - no use of special addressing ? (e.g. in circular buffers)
  88.  
  89. You really need to extend the language if you're going to get at the meat
  90. of the problem. See above. 
  91.  
  92. >I also know of three code generation approaches that would generate more
  93. >optimal code : - The GABRIEL (PTOLEMY) system of prof. Lee at Berkeley
  94.  
  95. I believe that these systems are basically library goop-together schemes
  96. rather than traditional compilers. From what I understand (and I'm *no*
  97. expert) hand written code fragments are glued together based upon a
  98. graphical representation of DSP operators and data paths. The problem is
  99. that you can't program generally. Maybe tightly coupling a C compiler with
  100. one of these systems is really the way to go. I think that when these
  101. people speak of "global scheduling" they mean scheduling very tiny jobs
  102. over multiple DSPs, rather than moving machine instructions from basic
  103. block to basic block.
  104.  
  105.     Jeff Enderwick
  106.     jeff@dsp.sps.mot.com
  107. -- 
  108. Send compilers articles to compilers@iecc.cambridge.ma.us or
  109. {ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.
  110.