home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / arch / 8455 < prev    next >
Encoding:
Internet Message Format  |  1992-07-30  |  8.1 KB

  1. Xref: sparky comp.arch:8455 comp.lang.misc:2709
  2. Path: sparky!uunet!gatech!purdue!mentor.cc.purdue.edu!pop.stat.purdue.edu!hrubin
  3. From: hrubin@pop.stat.purdue.edu (Herman Rubin)
  4. Newsgroups: comp.arch,comp.lang.misc
  5. Subject: Re: CISC Microcode (was Re: RISC Mainframe)
  6. Message-ID: <55535@mentor.cc.purdue.edu>
  7. Date: 30 Jul 92 13:16:51 GMT
  8. References: <id.RKUR.GFF@ferranti.com> <55294@mentor.cc.purdue.edu> <id.GQWR.83D@ferranti.com>
  9. Sender: news@mentor.cc.purdue.edu
  10. Followup-To: comp.arch
  11. Organization: Purdue University Statistics Department
  12. Lines: 142
  13.  
  14. In article <id.GQWR.83D@ferranti.com> peter@ferranti.com (Peter da Silva) writes:
  15. >In article <55294@mentor.cc.purdue.edu> hrubin@pop.stat.purdue.edu (Herman Rubin) writes:
  16. >> In article <id.RKUR.GFF@ferranti.com> peter@ferranti.com (Peter da Silva) writes:
  17. >> >I'm glad you noticed it. We're agreed then that these idiot savants generate
  18. >> >code that is as fast as a human can write, if not the same sort of code. 
  19. >
  20. >> This is not always the case.  It is quite possible that a simple idea which
  21. >> a human can see is not within the category of those known to the compiler.
  22. >> No compiler can change the algorithm to one that it does not know about.
  23. >> I can, and do.
  24.  
  25. >Yes, I quite agree, different problem spaces demand different algorithms for
  26. >solution. However, and this is the key point, it is (in 1992) extremely rare
  27. >that you encounter a constraint on the problem space due to the hardware that
  28. >has any significant effect on the choice of algorithm. Things like 64K segment
  29. >limits, massively parallel hardware, or the absence of a FPU... yes. Things
  30. >like the presence or absence of autoincrement addressing... no. It's been many
  31. >years that microoptimisation for the instruction set has been cost-effective
  32. >outside of tight loops.
  33.  
  34. Try designing algorithms for massivel parallel, or even vector, machines.
  35. The massively parallel SIMD machines really scream for VVVCISC, as any
  36. conditional operation is a major bottleneck.  The conditioning in hardware
  37. can be very cheap, as now each processor does it independently.
  38.  
  39. Things like the use of fixed-point operations on floating, the speed of 
  40. conversion, the use of bits, and like operations; packing and unpacking
  41. of floats; and quite a few others, are still important.  With a decent
  42. way of writing machine instructions, I consider a couple of hundred 
  43. instructions, certainly not what I would call a tight loop, as reasonable.
  44.  
  45. I do not know how important autoincrement addressing is, but vector machines
  46. use a special case of it to great advantage.
  47.  
  48. >> >Because allowing the compiler to find machine-specific optimisations is more
  49. >> >cost effective than doing it myself. Because the code I write runs on Sparcs,
  50. >> >68000s, 80386s, 80286s, VAXen, and 68020s. Because next month it might be
  51. >> >running on MIPS or 88000. Next year it might be running on Supersparc or Alpha.
  52. >> >Because optimising when you don't need to is a waste of resources.
  53.  
  54. >> This means that the language should be expanded to include the alternatives.
  55.  
  56. >Why? So I can write the same code half a dozen times? Whether I do so by
  57. >coding a loop in five different assembly dialects or by coding a bunch of
  58. >alternatives in Herman Rubin's Perfect Language it's still a waste of time.
  59.  
  60. There is not, was not, and never will be a "perfect language."  The superfast
  61. sub-imbecile in the compiler, and even assembler instruction reordered, and
  62. try out lots of alternatives, including investigating of many branches.  The
  63. HLL gurus claim that their language will make it unnecessary for programmers
  64. ever to use machine codes.  My proposal is for far less; let the programmer
  65. set up translations, some of which will be for quite considerable use, and
  66. the machine operations may or may not be invoked.  
  67.  
  68. And example, which may or may not use machine code, would be to find
  69. the integer closest to a floating-point number.  Now this, and other
  70. such "standard" situations, could be put in a dictionary of alternatives.
  71. Quite some time ago, for simulation, I saw that producing vectors of 
  72. random variables, instead of separate calls, would greatly speed up
  73. things.  I have not seen this in wide use on the standard libraries.
  74.  
  75. For a very simple operation, which can be extremely nasty, consider that of
  76. using a random bit to put a sign on a random number.  In fact, consider the
  77. operation of putting the sign of x on y, or reversing the sign of y if x is
  78. negative.  This is a fast operation on some machines, and a slow operation
  79. on others, and if it is slow, the algorithm in which it is used should be
  80. changed to avoid this problem, if at all possible.
  81.  
  82. >> >> >I expect any good programmer to code for the abstract machine defined for
  83. >> >> >the language. Remember, software longa, hardware brevis.
  84.  
  85. >> >> This might be reasonable if we had a language produced by people who have
  86. >> >> some respect for the capabilities of humans.
  87.  
  88. >> >We do. We have dozens of them.
  89.  
  90. >> Name one in which recognizes the various things I have previously published
  91. >> in a syntax intended for fast use by a human being.
  92.  
  93. >The various things you're looking for are in the "tight loop" category, and
  94. >the effort of coding them in assembler is negligable compared to the cost of
  95. >coding the rest of the program in a language designed for microoptimisation
  96. >rather than expression of an algorithm.
  97.  
  98. >C++ with embedded assembly and inline expansion.
  99. >Forth.
  100. >C with inline assembler.
  101. >Turbo Pascal.
  102. >Dec Fortran 77.
  103. >Most modern Lisp dialects.
  104.  
  105. I have been mainly using C with inline assembler.  But its headaches are
  106. massive.  And my complaint that the great bulk of assembler languages are
  107. not designed for human use definitely holds.  At least one Unix manual had
  108. the explict statement that the assembler was essentially for compiler
  109. maintainers ONLY.
  110.  
  111. Forth, and in fact all stack machines, are overly restrictive.  "Superinlining,"
  112. which essentially uses code expansion, not subroutine conversion, is what 
  113. should be done.  Even if memory <-> register is as fast as claimed, it still
  114. involved lots of moving.  An inlined procedure, to be good, must take the
  115. arguments where it finds them, and put the results where they are wanted,
  116. not using any standard memory or register locations.
  117.  
  118. >> Lisp seems to have a
  119. >> fairly reasonable collection of primitives, but a human being should not 
  120. >> be REQUIRED to use clumsy prenex notation.
  121.  
  122. >Oddly, many human beings prefer it. HP has managed to remain the last
  123. >successful US calculator manufacturer by using a similar notation.
  124.  
  125. I do not believe that many human beings would like to have to type
  126. plus(x,y) for x+y, minus(x,y) [or is it minus(y,x)?] for x-y, etc.
  127. Nor should they have to type iplus for integers, fplus for floats,
  128. etc.
  129.  
  130. HP uses stack notation, not prenex.  For manual operation, this minimizes
  131. work, and even in a computer, this is the actual function or subroutine 
  132. procedure, even if it is not written that way.  I am not aware of any
  133. calling sequences where the call is issued first, and then the arguments
  134. are obtained, or some arguments are issued, and then the instruction, and
  135. then other arguments.  The prenex form is easier for the parser.  I have
  136. seen the structure of a microcomputer assembler, and it uses the opcode
  137. to branch to the parsing of the remaining part of the instruction.  This
  138. is easy for the assembler only.
  139.  
  140. And even the HP uses registers, which are really memory, to handle arguments,
  141. instead of having to manipulate a stack.  The current registers, not the
  142. registers on the early machines, are really a specialized high-speed memory,
  143. not where the computations are done.  Too few machine designers have realized
  144. this and included registers in the addressible memory, so that registers 
  145. themselves could be indexed and addressed as variable locations.
  146.  
  147. Now I have no problems with the assembler, optimizer, etc., using things in
  148. this manner.  But I would like to write things my way, and you would like to
  149. write things your way, and I see no reason why we cannot be accommodated.
  150. What we need is a versatile macro processor to translate between.  
  151. -- 
  152. Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
  153. Phone: (317)494-6054
  154. hrubin@pop.stat.purdue.edu (Internet, bitnet)  
  155. {purdue,pur-ee}!pop.stat!hrubin(UUCP)
  156.