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

  1. Xref: sparky comp.arch:10545 comp.lang.forth:3465
  2. Newsgroups: comp.arch,comp.lang.forth
  3. Path: sparky!uunet!think.com!yale.edu!ira.uka.de!math.fu-berlin.de!informatik.tu-muenchen.de!pazsan
  4. From: pazsan@Informatik.TU-Muenchen.DE (Bernd Paysan)
  5. Subject: Re: What's RIGHT with stack machines
  6. References: <Bx5AIr.EAy.2@cs.cmu.edu> <1992Nov4.103008.2641@Informatik.TU-Muenchen.DE> <MIKE.92Nov9004026@guam.vlsivie.tuwien.ac.at>
  7. Originator: pazsan@hphalle5f.informatik.tu-muenchen.de
  8. Sender: news@Informatik.TU-Muenchen.DE (USENET Newssystem)
  9. Organization: Technische Universitaet Muenchen, Germany
  10. Date: Mon, 9 Nov 1992 15:53:48 GMT
  11. Message-ID: <1992Nov9.155348.6079@Informatik.TU-Muenchen.DE>
  12. Lines: 83
  13.  
  14.  
  15. In article <MIKE.92Nov9004026@guam.vlsivie.tuwien.ac.at>, mike@vlsivie.tuwien.ac.at (Michael Gschwind) writes:
  16. |> In article <1992Nov4.103008.2641@Informatik.TU-Muenchen.DE> pazsan@Informatik.TU-Muenchen.DE (Bernd Paysan) writes:
  17. |>    Thanks to your interresting report. I have little to add.
  18. |> 
  19. |>    Code size and performance: reduced code size for equal operations means less bus
  20. |>    bandwidth is requested. As busses (and DRAMs) are today the von Neumann's
  21. |>    bottlenecks, stack CPUs reduces costs for main memory and second level caches and
  22. |>    may increase performance, if the costs are equal.
  23. |> 
  24. |> Yes, but you pay a heavy price. Stack machines basically compute
  25. |> expressions of the type 
  26. |> ((((...) op A) op B) op C) 
  27. |> so each operation depends on the previous (if nothing else, since all 
  28. |> ops operate on the stack, there is the stack pointer dependency), so
  29. |> super scalar or even deep pipelining  are totally out of the question.
  30. |> I used to like stack machines, they are beautiful, simple, allow easy
  31. |> compilers, BUT THEY JUST DID NOT SCALE - neither in modern design
  32. |> technologies nor when it comes to compilers.
  33. |> 
  34. Expressions like ((((...) op A) op B) op C) are quite typical for high level
  35. languages. I rarely see scaleable instructions in the source output of good C
  36. compilers, and if there are any, they are branches or load/stores. And these sort
  37. of instruction is scaleable in stack processors, too. And you can scale stack
  38. operations and arithmetic operations. And then we have the same amout of more
  39. than 70% collision free execution of 2 instructions at one time (even more: one
  40. or two stack ops, if they can be combined, one arithmetic, one load/store and a
  41. call or branch). Stack processors are certainly scaleable. Certainly you must
  42. have a sort of pipelining, then.
  43.  
  44. |>    Compiler complexity: Tanenbaum had a compiler project, that did much optimizing
  45. |>    on the intermediate stack machine code. I think you have little to do to convert
  46. |>    this code for a stack machine, whereas you have a lot of work to allocate
  47. |>    registers and schedule instructions, as you have to do on "conventional" RISC
  48. |>    processors.
  49. |> 
  50. |> Yes, for simple arithmetic expressions, they allow way cool
  51. |> optimizations. But what do you do when you get to things like CSE? DUP
  52. |> DUP SWAP SWAP ROT? Hardly efficient! 2 memory accesses for DUP, 4 for
  53. |> swap, 6 for ROT. You simply have to shuffle intermediate results too
  54. |> much. Or save them in memory - definitely more expensive than a
  55. |> register. Once again, with technology of 10 years ago, they were nice,
  56. |> but it does pay to allocate registers and do scheduling, AND WE HAVE
  57. |> THE TECHNOLOGY NOW to do it.
  58. |> 
  59. On modern stack machines like the SC32 you need NO memory acces for DUP, even if
  60. something is spilled, you may have one (less than 1%), and certainly NO memory
  61. access for SWAP and ROT. The typical situation (all over my system) is to have
  62. about one stack operation to one arithmetic or load/store operation. Call it one
  63. address machine, I call it combining stack ops and alu ops in one opcode. Even
  64. the first Forth processor (Novix 4000) did that. For highest performance you may
  65. pipeline stack and alu operation.
  66.  
  67. |>    Spill&Fill: did anyone thought about automatic spill&fill-buffers? (if the
  68. |>    available stack cells decreases to a certain level, a number of stack items are
  69. |>    load (4 or 8 would be great), and if it increases over a certain level, the same
  70. |>    amount of stack items is spilled (have a hysterese of about 8 stack entries).
  71. |> 
  72. |> I figure implementation of this is just to hairy - on the same real
  73. |> estate, you can put 16 extra registers ;) 
  74. |> 
  75. Really? It's not the same. Think: If you have 3-address opcodes, you waste 5*3=15
  76. bits for addressing these registers, where one of 8 (3 bits) would be enough in
  77. many cases. The implementation of a stack in hardware is quite simple and you
  78. have no need for direct addressing these 16 extra "registers" for spill and fill
  79. (sequencial addressing is enough).
  80.  
  81. |> mike
  82. |> --
  83. |> 
  84. |> Michael Gschwind, Dept. of VLSI-Design, Vienna University of Technology
  85. "Technology" sounds good, but TU=Technische Universitaet, it's a university of
  86. technics :-) (or would you translate "Elektro-Technik" into "Technology of
  87. electricity"?-)
  88. |> mike@vlsivie.tuwien.ac.at    1-2-3-4 kick the lawsuits out the door 
  89. |> (currently somewhere in         5-6-7-8 innovate don't litigate         
  90. |> the Bay Area, back sometime     9-A-B-C interfaces should be free
  91. |> at the end of this year)    D-E-F-O look and feel has got to go!
  92. |>      
  93.  
  94. -- 
  95. Bernd Paysan
  96. "Late answers are wrong answers!"
  97.