home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / arch / 9080 < prev    next >
Encoding:
Internet Message Format  |  1992-08-29  |  5.4 KB

  1. Path: sparky!uunet!stanford.edu!bcm!rice!cliffc
  2. From: cliffc@rice.edu (Cliff Click)
  3. Newsgroups: comp.arch
  4. Subject: trapping speculative ops (LONG)
  5. Message-ID: <CLIFFC.92Aug28085924@antigone.rice.edu>
  6. Date: 28 Aug 1992 14:59:24 GMT
  7. References: <BtEzrK.Jso.2@cs.cmu.edu> <GLEW.92Aug25180333@pdx007.intel.com>
  8.     <BtLD9x.IBA@mentor.cc.purdue.edu>
  9.     <1992Aug28.013846.11326@athena.mit.edu>
  10. Sender: news@rice.edu (News)
  11. Organization: Center for Research on Parallel Computations
  12. Lines: 142
  13. In-Reply-To: jfc@athena.mit.edu's message of 28 Aug 1992 01:38:46 GMT
  14.  
  15.  
  16. Since noone complained about my digest-reply format, I'll repeat it again.
  17.  
  18. Also, here is a challange to the hardware jocks out there:
  19.  
  20. Am I blowing smoke?  i.e. does your main pipeline(s) simplify enough when 
  21. you trap at the "start" of an instruction instead of the middle to justify
  22. carrying around all those extra trap bits?  
  23.  
  24. I think that speculative loads would help C-like programs some (lots of loads
  25. and branches).
  26.  
  27. I know that prefetch can help scientific codes running machines with distant
  28. memories (the compiler can often predict address traces for hundreds of 
  29. cycles). 
  30.  
  31. Here goes...
  32. ---------------------
  33. <John Carr>
  34. | [... add conditional operations to avoid branches... ]
  35.  
  36. <Cliff Click>
  37. Sounds good, but orthogonal.
  38. The goal was to be able to hoist potentially trapping operations above a
  39. guard test.
  40.  
  41. <John Carr>
  42. | [... Keep the trap flags invisible... ]
  43.  
  44. <Cliff Click>
  45. Keeping the trap flags hidden removes the compiler's option to hoist
  46. possibly trapping operations above a guard test.
  47.  
  48. ---------------------
  49. <Stanley T.H. Chow>
  50. | But if the prefetch was not speculative, it would be nice to have the load
  51. | go forward. For page fault, it doesn't make much difference, but a TLB 
  52. | miss could well have been hidden. 
  53.  
  54. <Cliff Click>
  55. Ok, let TLB's progress until it's not convenient anymore.  i.e. if the TLB
  56. miss can handled without going to the OS, do it.  Otherwise set the 
  57. appropiate "fail" bits in the saved trap-state register and return from the
  58. TLB handler.  If the register is not used (speculative prefetch) there's no
  59. big loss.  If the register IS used, a more full-bodied trap handler can do
  60. the fixup (which might require growing the stack/process space, or a
  61. segmentation fault or a page fault).
  62.  
  63. <Stanley T.H. Chow>
  64. | Conceivabily, one may want control over the cache behaviour as well.
  65.  
  66. <Cliff Click>
  67. Cache behavior needs to be controlled for good memory performance for many
  68. scientific programs, irregardless of the trapping behavior.  Perhaps you 
  69. could marry your favorite cache control technique with the discussed trap
  70. behavior.
  71.  
  72. ---------------------
  73. <David Chase>
  74. | First, speculative division is probably not an interesting case.
  75.  
  76. <Cliff Click>
  77. It was used as the canonical trapping example.
  78. I'll stick to the load/store trap issue from here on.
  79.  
  80. <David Chase>
  81. | As far as loads and stores go, I am similarly mystified by the insistence 
  82. | that each and every trap from the source program be preserved in 
  83. | "very-optimized" code.
  84.  
  85. <Cliff Click>
  86. How else do you handle page faults?  TLB faults?
  87. In your "very-optimized" code wild stores and loads can proceed until your
  88. code and data rot enough to die.  I prefer wild stores and loads to stop 
  89. the process at once.
  90.  
  91. The page 0 hack is a clever technique for hoisting past a NULL test.
  92. But it prevents the hardware from detecting a common bug (reading from a
  93. NULL pointer).
  94.  
  95. If you need "performance at all costs" then by all means do it.
  96.  
  97. <David Chase>
  98. | If the OS could be convinced to just not report illegal loads
  99. | (emulating them as returning zero or NaN, for instance) then loads
  100. | could be hoisted much more frequently.  
  101.  
  102. <Cliff Click>
  103. The OS will still handle page faults when the load is issued, instead of
  104. when the load results are required (if at all).
  105.  
  106. <David Chase>
  107. | Note that the hardware support for what I described above is pretty
  108. | damn cheap.  Note that no changes are needed to the architecture.  
  109.  
  110. <Cliff Click>
  111. "No change" is exceptionally cheap :-).
  112.  
  113. ---------------------
  114. <Bob Alverson>
  115. | Let's see.  You'll also probably want special loads and stores that 
  116. | preserve those trap bits.  
  117.  
  118. <Cliff Click>
  119. Why?
  120.  
  121. <Bob Alverson>
  122. | Speaking of context switch, make sure you can restore the poison on *all* 
  123. | the registers or have some that you know aren't poisoned (like the one 
  124. | holding the stack pointer).
  125.  
  126. <Cliff Click>
  127. All the trap bits can be read/written via a special control register.
  128.  
  129. <Bob Alverson>
  130. | Oh, and those folks with conditional moves or conditional operations may 
  131. | want to have the poison only conditional "tasted," to keep jackpot cases 
  132. | from obfuscating compiler transformation decisions.
  133.  
  134. <Cliff Click>
  135. Sounds like conditionals on your conditionals.
  136. Ask a hardware jock if this is cost effective.
  137.  
  138. <Bob Alverson>
  139. | You might also want a register to register move that propagates poison, 
  140. | so the register allocator can shuffle values around with wild abandon.
  141.  
  142. <Cliff Click>
  143. Sounds kinky :-).  I'm sure the compiler can deal with it, but do the
  144. hardware jocks want to?
  145.  
  146. ---------Authors----------
  147. Bob Alverson    bob@tera.com
  148. John Carr       jfc@athena.mit.edu
  149. David Chase     chased@rbbb.Eng.Sun.COM
  150. Stanley Chow    schow@BNR.CA
  151. Cliff Click     cliffc@cs.rice.edu
  152. --------------------------
  153. --
  154. The Sparc ABI had the most brain-damaged calling convention I've ever seen.
  155. It's probably better now but reminiscing gives me something to complain about.
  156. Cliff Click (cliffc@cs.rice.edu)  |  Disclaimer:  My lawyer made me say it.
  157.