home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / forth / 3685 < prev    next >
Encoding:
Text File  |  1992-12-27  |  6.2 KB  |  157 lines

  1. Newsgroups: comp.lang.forth
  2. Path: sparky!uunet!cs.utexas.edu!swrinde!emory!sol.ctr.columbia.edu!venezia!penev
  3. From: penev@venezia (Penio Penev)
  4. Subject: Re: Hardware ONLY issues
  5. References: <4192.UUL1.3#5129@willett.pgh.pa.us>
  6. Sender: nobody@ctr.columbia.edu
  7. Organization: Rockefeller University
  8. Date: Sun, 27 Dec 1992 21:38:21 GMT
  9. X-Newsreader: TIN [version 1.1 PL6]
  10. Message-ID: <1992Dec27.213821.29605@sol.ctr.columbia.edu>
  11. Reply-To: penev@venezia.rockefeller.edu
  12. X-Posted-From: venezia.rockefeller.edu
  13. NNTP-Posting-Host: sol.ctr.columbia.edu
  14. Lines: 141
  15.  
  16. ForthNet articles from GEnie (ForthNet@willett.pgh.pa.us) wrote:
  17. : Category 9,  Topic 2
  18. : Message 127       Sat Dec 26, 1992
  19. : ELLIOTT.C                    at 13:40 EST
  20. :  
  21. :  -----via CRS Premium Bulletin Board -
  22. :  USR Dual Standard 16.8K  (416) 629-7000
  23. :  Date: 12-22-92 (02:09)
  24. :    To: ALL
  25. :  From: MARCEL HENDRIX
  26. :  Subj: THREADING SPEED
  27. :  Penio Penev wrote about M. Anton Ertl's ``Threading speed''
  28. :    M. Anton Ertl's benchmark intrigued me too, but it was in a
  29. :  foreign language (C). However, your Forth version I can
  30. :  reproduce.  Here is what
  31. :  I found for the TMS320C30, a 32-bits, 33 MHz DSP chip from Texas
  32. :  Instruments. The output shown is produced from within my
  33. :  interactive target compiler for this chip (The tc is written in
  34. :  iForth, a 32-bit Forth for the '386. It runs under GO32 in
  35. :  protected mode on my PC).
  36. ..
  37. :  | code cdummy  next, end-code
  38. :  | : dummy ;
  39. :  | : dd    FOR dummy  NEXT ;
  40. :  | : cc    FOR cdummy NEXT ;
  41. :  | : tara  FOR NEXT ;
  42. :  | cr .( tara : ) timer-reset 10000000 tara .elapsed .(  Indigo: 1300 )
  43. :  | cr .( dd   : ) timer-reset 10000000 dd   .elapsed .(  Indigo: 3100 )
  44. :  | cr .( cc   : ) timer-reset 10000000 cc   .elapsed .(  Indigo: 2500 )
  45. :  tara : 3.630 seconds elapsed. Indigo: 1300
  46. :  dd   : 10.065 seconds elapsed. Indigo: 3100
  47. :  cc   : 10.065 seconds elapsed. Indigo: 2500  ok
  48. :  <TARGET> see cc
  49. :  $000005C7  ldi *ar0++(1),r0              08402001 .... MH> dpop,
  50. :  $000005C8  ldi $5CF,r2                   086205CF ....
  51. :  $000005C9  push r2                       0F220000 ....
  52. :  $000005CA  push r0                       0F200000 ....
  53. :  $000005CB  push r0                       0F200000 ....
  54. :  $000005CC  ldi r0,r7                     08070000 .... MH> loop count
  55. :  $000005CD  addi 1,r2                     02620001 ....
  56. :  $000005CE  bu r2                         68000002 ....
  57. :  $000005CF  bu $5D3                       6A000003 .... MH> LEAVE use
  58. :  $000005D0  callu $5B7                    7200FFE6 ....
  59. :  $000005D1  subi 1,r7                     18670001 .... MH> NEXT
  60. :  $000005D2  bne $5D0                      6A06FFFD ....
  61. :  $000005D3  subi 3,sp                     18740003 ....
  62. :  $000005D4  retsu                         78800000 .... ok
  63. :  <TARGET> words
  64. : 2
  65. :  tara              cc                dd                dummy
  66. :  cdummy            ok
  67. :  <TARGET> see cdummy
  68. :  $000005B7  retsu                         78800000 .... ok
  69. :  <TARGET> see dummy
  70. :  $000005B8  retsu                         78800000 .... ok
  71. :  <TARGET> close-log
  72. :  ---
  73. ..
  74. :    The long intro to FOR makes work a bit easier for the target
  75. :  compiler, and allows me to code  FOR ... LEAVE ... NEXT if I want
  76. :  to. You cannot nest FOR NEXT's.
  77.  
  78. The difinition of FOR NEXT I posted _can_ be nested. There is another
  79. definition, which cannot. Words can be invoked from it, but You do not
  80. have I in it.
  81.  
  82.  1 : FOR( ( - a)  TS V1 mov  Drop  V1 dec  begin ; IMMEDIATE
  83.  2 : )NEXT ( a)  V1 Z= until  V1 dec ;  IMMEDIATE
  84.  
  85. Measurements:
  86. : TARA()  FOR( )NEXT ; ok
  87. COUNTER 1000000000 TARA() TIMER 62000 ok
  88.  
  89. In dbx:
  90.  [RETRY, 0x10011ef4]    addiu   sp,sp,-4
  91.  [RETRY, 0x10011ef8]    move    v1,s0
  92.  [RETRY, 0x10011efc]    lw      s0,0(s8)
  93.  [RETRY, 0x10011f00]    addiu   s8,s8,4
  94.  [RETRY, 0x10011f04]    addiu   v1,v1,-1
  95.  [RETRY, 0x10011f08]    bne     v1,zero,0x10011f08
  96.  [RETRY, 0x10011f0c]    addiu   v1,v1,-1
  97. *[RETRY, 0x10011f10]    addiu   sp,sp,4
  98.  [RETRY, 0x10011f14]    jr      ra
  99.  [RETRY, 0x10011f18]    lw      ra,4(sp)
  100.  
  101. :    The constant 100,000,000 was changed to 10,000,000 because, as
  102. :  you can see, the code takes about three to four times as long to
  103. :  run as on your Indigo. It is possible to optimize CC above, by
  104. :  using bned instead of bne, but that won't give me 300% more
  105. :  speed(?) I really wonder how the R3000 does it. Branch
  106. :  prediction?
  107.  
  108. The R3000 can deliver one result in one clock if the pipe is kept
  109. full. It can utilize the branch delay slot (the instruction after the
  110. branch). I was rather surprised (pleasantly), when I realised, that
  111. the branch delay slot is enough to fill the pipe.  Two clocks/loop at
  112. 33 MHz means 17.5 loops/us = 17.5 Mloops/second.  The 1000M loops
  113. should be performed in 57.1 seconds in theaory. The agreement with
  114. experiment is very good, because I have at least 10 other open windos,
  115. one of which is a graphical clock, updated on a second basis. This
  116. means, that I can utilise ~ 92.1% of the power of my machine without
  117. sacrificing any convinience.
  118.  
  119. In my oppinion the R3000 has some way of processing two instructions
  120. in the early stages of the pipe (perhaps the first 2 of 5 total). I
  121. made the following test:
  122.  
  123. : TT   FOR(  [ begin  0 Z= until  nop ]  )NEXT ; ok
  124. COUNTER 100000000 TT TIMER 13000 ok
  125.  
  126. This is one branch, which is taken, and one which is not. The timing
  127. is ~ two times the original one, which means, that both branches
  128. execute in the same time. On the other hand in the Reference Manual
  129. clearly states, that the branch decision is made one clock after the
  130. calculation of the target address and the condition. This is one clock
  131. after the Instruction Fetch phase on the target instruction.
  132.  
  133. The R4000 has an 8 stage pipe, and there (IMHO) maintaining two early
  134. pipes is not possible (feasible). It has an instructions 'branch if
  135. condition likely'. 
  136.  
  137. Another consequence of this feature is that You can make
  138. call = jump and link, store, dec  = 3 clocks
  139. ret  = jump register, load,  inc  = 3 clocks
  140.                                   ----------
  141.                                     6 clocks
  142.  
  143. call unnestable     = jump and link, store = 2 clocks
  144. ret from unnestable = jump register, load  = 2 clocks
  145.                                            ----------
  146.                                              4 clocks
  147.  
  148. I like this processor.
  149.  
  150. -- Penio.
  151.