YouTube2Text

[CS61C FA20] Lecture 23.3 - Pipelining III: Superscalar — Transcript

by CS 61C Departmental · 1,911 words · 341 segments · language en · Watch on YouTube

Full transcript

  1. 0:12Hi, welcome back to our pipelining
  2. 0:13module.
  3. 0:16We're almost done.
  4. 0:18We have learned how to design a pipeline
  5. 0:21processor. We actually learned the
  6. 0:23principles of designing a pipeline
  7. 0:24processor.
  8. 0:27You will get the true feeling for how to
  9. 0:30design one
  10. 0:31when doing a project and actually going
  11. 0:34through design of a pipeline and
  12. 0:37resolution of all the hazards.
  13. 0:39That's really fun, actually.
  14. 0:43But for now, we understood all the
  15. 0:46principles that we need to deal with in
  16. 0:48order to design a good processor.
  17. 0:53There is one more advanced concept that
  18. 0:55is out there. That's the concept of
  19. 0:56so-called superscalar processors.
  20. 1:00You might have heard about that. Many of
  21. 1:01the modern, very high-performance
  22. 1:04processors are of superscalar type.
  23. 1:08Before we get to we get to those, let's
  24. 1:11see how can we increase processor
  25. 1:15performance further from what we
  26. 1:18um know so far.
  27. 1:21So, we have designed a five-stage
  28. 1:23pipeline. And what is kind of
  29. 1:24interesting, this five-stage pipeline is
  30. 1:27the industry workhorse nowadays.
  31. 1:29Probably 80% of processors that are out
  32. 1:32there, all around us, are five-stage
  33. 1:34pipelines.
  34. 1:36But they don't have the highest possible
  35. 1:38performance. Uh
  36. 1:40there are many designs
  37. 1:43that um
  38. 1:45are
  39. 1:46different. They're higher performance.
  40. 1:49And when I say majority of of processors
  41. 1:51out there are five-stage pipelines,
  42. 1:53you'll find them in all kinds of
  43. 1:55applications. cars, and
  44. 1:58um various appliances, and so on.
  45. 2:01They're really common. They're like
  46. 2:03that. They're in They're these invisible
  47. 2:04computers that are all over us, all
  48. 2:06around us. But, those that we'll find in
  49. 2:09laptops or in desktops or even in cell
  50. 2:11phones,
  51. 2:13there
  52. 2:14are usually a few higher performance
  53. 2:18processors, and a lot of these
  54. 2:20five-stage pipelines as well.
  55. 2:23So, how do we crank up the performance
  56. 2:25of a processor?
  57. 2:26We have a few options. One, we can try
  58. 2:28to crank up the clock frequency.
  59. 2:31But, the clock frequency is limited by
  60. 2:33two things. Um how fast transistors will
  61. 2:36switch, and that is set by the
  62. 2:37technology.
  63. 2:39And uh the other one is the the power
  64. 2:42dissipation. We have mentioned that
  65. 2:44before. Um
  66. 2:45you know, cranking up the clock
  67. 2:47frequency was our primary
  68. 2:49means of adding performance in the '90s
  69. 2:52up to early 2000s, but then we hit the
  70. 2:55power ceiling, and
  71. 2:58we discovered or designers discovered
  72. 3:00that they can design processors that
  73. 3:01will
  74. 3:02run
  75. 3:03very fast at very high clock
  76. 3:05frequencies,
  77. 3:06but there was no practical means of
  78. 3:09cooling them.
  79. 3:11So, the clock frequency had to be held
  80. 3:14constant to allow for reasonable
  81. 3:16cooling.
  82. 3:18Then, the second option that's often
  83. 3:20works in concert with clock rate
  84. 3:24increases is the concept of deeper
  85. 3:27pipelining.
  86. 3:28Um so, we have seen our five-stage
  87. 3:30pipeline, but we can break up the
  88. 3:33execution into smaller and smaller
  89. 3:35chunks. So, people have built pipelines
  90. 3:38that are 10 stages deep or 15 stages
  91. 3:41deep. Uh Intel processors, I think, went
  92. 3:44up to 20 stages deep at some point.
  93. 3:48So, the idea here is to do let less work
  94. 3:52in each cycle to have less logic depth
  95. 3:54to go through less logic gates, so we
  96. 3:56can have a shorter clock cycle.
  97. 3:59And that enables us to either run at a
  98. 4:01higher frequency or if you're limited
  99. 4:04with power to drop the supply voltage
  100. 4:06and run at a same clock frequency but
  101. 4:09with lower power.
  102. 4:12However, the deeper the pipeline,
  103. 4:15the higher the chances that we are going
  104. 4:17to run into hazards, so our CPI is
  105. 4:20naturally going to
  106. 4:22get higher to be higher than one.
  107. 4:25So, what came as an alternative to that
  108. 4:29are so-called multi-issue or superscalar
  109. 4:31processors. Those are the ones that
  110. 4:34theoretically can have CPI that is much
  111. 4:37less than one.
  112. 4:39So, how do those work? In a superscalar
  113. 4:41processor, we have multiple issues. What
  114. 4:44does it mean? We have multiple execution
  115. 4:47units and everything else that helps
  116. 4:50feed those execution units.
  117. 4:52So, each execution unit is actually a
  118. 4:54pipeline on its own that is capable of
  119. 4:57executing either integer instructions or
  120. 5:00floating-point instructions, or we may
  121. 5:02have dedicated load and store
  122. 5:06pipelines.
  123. 5:08So, since we have multiple execution
  124. 5:10units,
  125. 5:11we can fetch multiple instructions per
  126. 5:13clock cycle
  127. 5:15and so-called issue them to different
  128. 5:18execution pipelines.
  129. 5:21Um so, this enables us to
  130. 5:25drop our CPI below one. So, we are going
  131. 5:29to be completing multiple instructions
  132. 5:32per clock cycle.
  133. 5:35Often people will use a concept IPC such
  134. 5:38that
  135. 5:39um it's easier to to understand things
  136. 5:41to compare things that are greater than
  137. 5:43one than one.
  138. 5:46For example, if you have a 4 GHz
  139. 5:49four-way multiple issue processor, it is
  140. 5:52capable of executing 16 billions of
  141. 5:55instructions per second
  142. 5:57uh with it it would have a peak CPI of
  143. 6:010.25
  144. 6:02and peak IPC would be one over that,
  145. 6:05which is four.
  146. 6:07Peak means that if there are no
  147. 6:10conflicts, uh there are no dependencies,
  148. 6:13no hazards, we can get to that peak
  149. 6:17CPI or IPC, but in practice, that number
  150. 6:20is not going to be so great.
  151. 6:26Often, these processor employ something
  152. 6:28is called out-of-order execution.
  153. 6:31So, in order to deal with the
  154. 6:33dependencies and hazards, there'll be a
  155. 6:35hardware unit that'll be picking and
  156. 6:38figuring out which instructions have
  157. 6:39dependencies and trying to execute them
  158. 6:43in an order where they don't depend on
  159. 6:44each other. And then there'll be a
  160. 6:46reorder unit um
  161. 6:48at the at the end of the pipeline that
  162. 6:50will put the results back in order
  163. 6:53um such that whoever run that program
  164. 6:56gets meaningful results.
  165. 6:59And that is all done perfectly.
  166. 7:02This we definitely are not going to
  167. 7:04cover in 61C, but
  168. 7:07CS 152 goes into a great depth of that.
  169. 7:11What we'll we will do is um a quick
  170. 7:14overview of what you will find in a
  171. 7:17superscalar processor. So, generally,
  172. 7:19there will be an instruction fetch and
  173. 7:21decode that will be fetching and
  174. 7:24decoding multiple instructions per
  175. 7:26cycle.
  176. 7:28And then it would go and issue them um
  177. 7:32in different execution pipelines.
  178. 7:36Um
  179. 7:37it will recognize what kind of an
  180. 7:38instruction it is and it would send it
  181. 7:41down the integer pipelines or floating
  182. 7:43point pipelines or load store pipelines.
  183. 7:47It would use some kind of a reservation
  184. 7:49station that would be there to reserve
  185. 7:53the resources the reserve to reserve
  186. 7:55this functional unit um for future use
  187. 7:58because they the the processor will try
  188. 8:01to keep them all filled as much as
  189. 8:03possible. And finally,
  190. 8:06the instructions will be committed or
  191. 8:08retired in order. So, they'll be
  192. 8:10arriving out of order but coming out of
  193. 8:12this commit unit in order.
  194. 8:17Here is an example of um
  195. 8:19an
  196. 8:20um
  197. 8:21out of order superscalar processor which
  198. 8:23is Intel i7, a relatively modern
  199. 8:27processor that um
  200. 8:28you'll find in laptops like the one that
  201. 8:31I'm using now for this presentation.
  202. 8:35It is what is shown here is the CPI
  203. 8:40for um
  204. 8:41number of benchmarks here. And these are
  205. 8:43different kinds of benchmarks. You don't
  206. 8:45really need to know to do uh
  207. 8:47need need to know which kinds are those
  208. 8:49but this has something to do with some
  209. 8:51quantum mechanics simulations. H.264
  210. 8:55is uh video compression. Um
  211. 8:58Bzip is a zip um
  212. 9:01type um of a program that is compressing
  213. 9:04some files.
  214. 9:05Um you'll find a Go game and then GCC
  215. 9:09that is compiling some kind of a target
  216. 9:11code.
  217. 9:12And then they measure what is the CPI
  218. 9:16that um
  219. 9:19is achieved for these benchmarks. And
  220. 9:21what you'll find out here is that uh
  221. 9:24these CPIs
  222. 9:26in most cases will drop below one. So,
  223. 9:29there will be less than one
  224. 9:32and in some cases maybe more than one.
  225. 9:37There is another interesting thing to
  226. 9:38notice on this graph. There are
  227. 9:41There is a ideal CPI that is sitting
  228. 9:43around 0.25 down here.
  229. 9:49And then there is realistic CPI that
  230. 9:52rarely gets below 0.5. So, the the ideal
  231. 9:56CPI is 0.25 or about a quarter, and
  232. 9:59realistic one is 0.44 and so on. This
  233. 10:02realistic CPI is due to real CPI is due
  234. 10:06to stalls,
  235. 10:08mis-speculation, and handling hazards.
  236. 10:13By the way, how is this CPI number
  237. 10:15actually achieved or or measured? Um
  238. 10:19it's not something magic. It's just the
  239. 10:21reverse of our iron law of processor
  240. 10:23performance. So, what we have there in
  241. 10:26there we had our CPI, which stands for
  242. 10:28cycles per instruction.
  243. 10:30And the CPI
  244. 10:34can be evaluated by knowing all the
  245. 10:36other elements of this equation. So, we
  246. 10:39can time the program,
  247. 10:41how long does it take us to execute the
  248. 10:43program, then we can
  249. 10:45count the number of instructions that
  250. 10:46that benchmark has, and finally
  251. 10:50we can look up
  252. 10:51how long would
  253. 10:53does it take to execute a cycle
  254. 10:56as the frequency of a processor. That
  255. 10:58give us gives us the number of cycles
  256. 11:00per instruction,
  257. 11:01and that is straight time to execute a
  258. 11:04program divided by instructions per
  259. 11:07program times the time
  260. 11:09um
  261. 11:10per cycle.
  262. 11:14So, that's it. This is the way how these
  263. 11:17CPI numbers, average CPI numbers, have
  264. 11:20been
  265. 11:22measured for i7 or many other
  266. 11:26processors.
  267. 11:30Few notes about the design of ISA and
  268. 11:33which ISAs are good for for pipelining.
  269. 11:36So, RISC-V is a
  270. 11:38a type of a RISC
  271. 11:40ISA that is designed with pipelining in
  272. 11:43mind. And there are several features
  273. 11:46that you will recognize that are in
  274. 11:47there
  275. 11:49that are very helpful for designing a
  276. 11:51pipeline.
  277. 11:52For example,
  278. 11:54in our version, 32-bit version, all um
  279. 11:59instructions and registers are 32-bits.
  280. 12:02But in every case, in every
  281. 12:05variant of RISC-V, all instructions are
  282. 12:0732-bits.
  283. 12:10So, all these instructions are easy
  284. 12:14to decode in one cycle.
  285. 12:18Compare that to x86,
  286. 12:21their instructions can be
  287. 12:24one or
  288. 12:26anything up to 15 bytes. So, decoding is
  289. 12:31really complicated there. So, you know,
  290. 12:32take a look at one instruction, you may
  291. 12:34be able to decode what is what is in
  292. 12:37there, what are you supposed to do, but
  293. 12:39more likely you have to go and
  294. 12:42oh, give me a few more bytes. Oh, can I
  295. 12:44decode? Not yet.
  296. 12:47A few more bytes and finally after a 15
  297. 12:49of them, the most complex instructions
  298. 12:51can be decoded.
  299. 12:54RISC-V has a small number, six different
  300. 12:57instruction formats. They're very easy
  301. 13:00to decode and read registers in one
  302. 13:03step. So, in one stage, we can do both.
  303. 13:07Many more complex ISAs require us to do
  304. 13:09that in multiple steps.
  305. 13:12Um load-store addressing can be done in
  306. 13:16third stage by using the ALU and access
  307. 13:20the memory in the fourth stage. And then
  308. 13:22memory operands are all all aligned and
  309. 13:24take only one cycle.
  310. 13:26Um that is something that is very
  311. 13:29convenient.
  312. 13:31And we have taken advantage of all of
  313. 13:32this when designing our pipeline.
  314. 13:37And that's it. So,
  315. 13:40we
  316. 13:41we have done it. We got our pipeline. We
  317. 13:43got our working processor that is
  318. 13:45capable of executing all RV32I
  319. 13:49instructions.
  320. 13:51First in one cycle and then we figured
  321. 13:54out how how to pipeline it.
  322. 13:56We identified these five
  323. 13:59phases of execution that we associated
  324. 14:01with five stages of a pipeline.
  325. 14:04And we have designed this controller
  326. 14:06first for a single
  327. 14:07stage pipeline, but then we have
  328. 14:10outlined the principles for a single
  329. 14:11stage execution, I'm sorry. And then we
  330. 14:14have I identify how we need to modify it
  331. 14:18to support
  332. 14:19resolution of hazards in a pipeline.
  333. 14:24Pipelining improves the performance
  334. 14:27and opens an avenue to building
  335. 14:30something that is really really
  336. 14:32powerful.
  337. 14:34We're going to wrap up this module now.
  338. 14:38In the next module, we are going to
  339. 14:40continue building better and better
  340. 14:42computer.
  341. 14:45See you after a bit of a longer break.

About this transcript

This page contains the full transcript of [CS61C FA20] Lecture 23.3 - Pipelining III: Superscalar by CS 61C Departmental, generated from the public captions YouTube serves with the video. The transcript has 1,911 words across 341 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.