home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / arch / 10603 < prev    next >
Encoding:
Internet Message Format  |  1992-11-10  |  4.0 KB

  1. Xref: sparky comp.arch:10603 comp.lang.forth:3476
  2. Path: sparky!uunet!news.tek.com!psgrain!charnel!rat!usc!elroy.jpl.nasa.gov!ames!sun-barr!male.EBay.Sun.COM!jethro.Corp.Sun.COM!exodus.Eng.Sun.COM!rbbb.Eng.Sun.COM!chased
  3. From: chased@rbbb.Eng.Sun.COM (David Chase)
  4. Newsgroups: comp.arch,comp.lang.forth
  5. Subject: Re: What's RIGHT with stack machines
  6. Date: 10 Nov 1992 22:39:42 GMT
  7. Organization: Sun Microsystems, Mt. View, Ca.
  8. Lines: 68
  9. Message-ID: <lg0eheINNs7l@exodus.Eng.Sun.COM>
  10. References: <Bx5AIr.EAy.2@cs.cmu.edu> <1992Nov4.103008.2641@Informatik.TU-Muenchen.DE> <MIKE.92Nov9004026@guam.vlsivie.tuwien.ac.at> <id.D6UU.5Z@ferranti.com>
  11. NNTP-Posting-Host: rbbb
  12.  
  13. >In article <MIKE.92Nov9004026@guam.vlsivie.tuwien.ac.at> mike@vlsivie.tuwien.ac.at (Michael Gschwind) writes:
  14. >> Once again, with technology of 10 years ago, they were nice,
  15. >> but it does pay to allocate registers and do scheduling, AND WE HAVE
  16. >> THE TECHNOLOGY NOW to do it.
  17.  
  18. In article <id.D6UU.5Z@ferranti.com> peter@ferranti.com (peter da silva) writes:
  19.  
  20. >If you can afford to compile your code for each new processor, yes. Otherwise
  21. >you have to assume that most code will use the scheduling that was best for
  22. >the first generation of the chip. Outside of engineering-class workstations
  23. >(a vanishingly small proportion of the total end-user micro market: PCs and
  24. >game machines clobber it by orders of magnitude) this is the normal case,
  25. >and in embedded systems (almost all the rest of the market) it's highly cost-
  26. >effective to minimize code size: ROMS are slow and expensive.
  27.  
  28. >I predict that before too long all high performance commodity micros will do
  29. >scheduling at runtime.
  30.  
  31. I don't think the situation is as clear-cut as you describe it.
  32.  
  33. There are certain scheduling techniques that tend to work well no
  34. matter where you use them -- as long as you have enough registers, it
  35. doesn't hurt to stick a few instructions between a load into a
  36. register and the subsequent use of that register.  On superscalar
  37. machines, it is generally a bad idea to do too many of exactly the
  38. same thing in a big lump (i.e., ld, ld, ld or fadd, fadd, fadd), and
  39. if you have the option of mixing things up a bit, you should.
  40. Increasing the size of basic blocks (through code replication,
  41. typically) is another trick for helping most machines, since branches
  42. often stall pipelines.
  43.  
  44. These are general rules, and they won't yield optimum performance, but
  45. you must trade them off against the costs of generating
  46. implementation-specific code.  Those costs include
  47.  
  48.   (1) less sharing of text and libraries
  49.   (2) lots of cache flushing and
  50.   (3) scheduling and register allocation are not necessarily cheap.
  51.  
  52. Also, good scheduling and pipelining will require more information in
  53. the "binary" than is traditionally stored there.  For starters, you'll
  54. need dependence information.  Debugging your compilers (and your buggy
  55. applications) will be a real party in this sort of a world, because
  56. different loop schedules (based on buggy dependence information) may or
  57. may not exhibit the bug on different implementations of the same
  58. architecture.
  59.  
  60. Other techniques that do appear to be highly implementation dependent
  61. (such as compiler-directed data prefetching) can instead be
  62. parameterized by a per-loop constant (that is, the prefetch distance
  63. is often loop-invariant, but the best prefetch distance varies from
  64. processor to processor).
  65.  
  66. I'm not saying it isn't possible, but I think it will be fairly hard,
  67. and I suspect that the wins will not be as large as you hope.
  68. Obviously, people working at Sun worry about this, seeing as how
  69. there's at least 3 different chips that we might want our code to run
  70. on (SS2, SS10, SPARC Classic), and they all have somewhat different
  71. scheduling characteristics.  
  72.  
  73. On the other hand, if what you are optimizing is ROM usage,
  74. high-performance commodity micros might just run little byte-code
  75. interpreters.  Of course, one trick to making your interpreted code
  76. run faster is to compile little fragments, which is sort of a
  77. generalization of scheduling at run-time.
  78.  
  79. David Chase
  80. Sun
  81.