Tác giả giữ toàn bộ bản quyền (All Rights Reserved) — không phải giấy phép mở. Bạn vẫn xem và học miễn phí trên OpenER; muốn tái sử dụng cần xin phép tác giả.
[MUSIC PLAYING] INSTRUCTOR: Hello, welcome back to 61C, module on the measurement and improvement of performance through pipelining.
So we get some understanding that there are different views of performance, and one of the main ways how we measure the performance is the time that it takes to execute the program.
But there are generally very many parameters that affect that execution time.
They are very difficult to detangle from each other, so we need to break them down somehow.
There is something that we call the iron law of processor performance that tells us how long does it take to execute a program based on some of the basic parameters of the machine and the program that is being executed.
So let's take a look at that.
In this diagram, we have time that is the take structure of the program simply expanded or this fraction got multiplied and divided by the number of instructions and the number of cycles.
So time takes you the program is equal to the number of instructions in the program, the number of cycles per instruction, and time to execute one cycle.
So this is now a lot easier to break down and understand the fundamental causes or fundamental parameters that affect each of these.
Different programs may have different number of instructions.
One of the fundamental architectural parameters is the number of cycles that it takes to complete an instruction, and finally, often pure processor speed is associated with a time to execute one cycle or the frequency at which processor runs.
But none of these parameters can be analyzed alone. They all have to be put together to understand that how long does it take to perform a task.
So let's get into that. Let's analyze each one of these three basic components.
A number of instructions per program number of cycles per instruction and time to complete the cycle to see what affects them and how can they get put together in the end.
So first one, how many does it — how many instructions does it take to execute the program? Well, it really depends on what kind of a task are we trying to complete here.
How is that task coded up?
For example, if we are trying to perform image compression, it is very different than trying a task of trying to play a game of go.
Each of these tasks can be implemented by using different algorithms, and these algorithms can have vastly different number of instructions that they need to be executed.
For example, things that we have learned in 61A, whether it depends as of open or open square matter a lot here.
Then the number of instructions for a program will greatly depend on the programming language.
Some higher level programming languages will have a very compact description of a task but may blow up to very many assembly instructions.
It will be much more efficient perhaps to code up this task in assembly, but we have seen that already coding up things in assembly is tedious and not everybody is willing to do that, especially not for every task that you would like to code up.
That is tightly combined with the compiler, compiler performance, and compiler effort.
Some compilers are going to generate assembly level code that has less instructions but some other compilers may generate more instructions.
And finally, it really depends on the ISA. Some ISAs, like most of the risks, will require more assembly level instructions than sys type processors.
But this cannot be looked in isolation.
The next metric that is really important is the second component of our iron law, which is the average number of clock cycles that it takes to execute one instruction.
So in some architectures, in our architecture, we always used one cycle to execute one instruction, but in some architectures, that number or in some implementations of the same, so I say that number may vary.
So the number of clock cycles per instruction depends on the ISA, but within the ISA, we can have different processes of — implementations that have different CPI average, CPI numbers.
And if you look at different performance measurements, you'll find out that different processors from Intel have different CPIs among them.
Higher class ones versus lower class ones, and then different implementations of the x86 architecture. May have different CPIs between AMD and Intel.
In our case, we always used one cycle to execute every instruction so far, but that will change.
In some cases, there will be more complex instructions at a higher level language or in the assembly language in higher language like string copy in C. It's going to take way more than one cycle to copy a string.
Finally, we are going to soon see so-called super scalar processors, where that average cycle per instruction is much less than 1, meaning that we are be simultaneously executing multiple instructions in one cycle.
Finally, a third component of our general law is the time for each cycle or how long does it take to complete the cycle or 1 over the frequency of a processor.
This is determined by the microarchitecture.
How many logic gates are in our critical path, but it is not just about counting the number of logic gates, it is relating the delay of each logic gates to a technology.
An inverter in one technology will be a lot faster than an inverter in a different technology.
We generally use CMOS, so inverters in 5 nanometer technologies are faster than the inverters in 28 nanometer technologies and much faster than inverters than say 90 nanometer CMOS technologies.
When we say 5 nanometers or 90 nanometers, we refer to the minimum features of that technology how short generally our gate or a wire can be in a particular technology.
And then finally, within the same technology, we may have different classes of implementations that have different power budgets.
For example, we will encounter desktop processors that run at clock frequencies that are higher than 4 gigahertz but they burn in excess of 100 watts, and so they can run that excess of 4 gigahertz.
On the other hand, those processors that will find in our cell phones will be running at 2 and 1/2 gigahertz, but they're going to have a lot lower power and that is going to be largely due to the fact that they are often running at a lower supply voltage.
Lower supply voltage, as we'll see in the next segment, saves us energy but makes things run slower.
Okay, let's take a look at the speed trade off example that puts together these three components of the iron law.
So this tries to illustrate that just buying a processor based on clock frequency may not always matter. You may not get the best machine for the task.
So for example, we have one task that we'd like to implement here, which is the image compression, and that image compression on two processors, because they may be in different implemented things different ISAs or may be described in a different framework can have different number of instructions that are needed to execute to complete the task
to compress the image. So for example, in processor A, we may need just 1 million instructions, and processor B may need 50% more. May need 1.5 million instructions.
Now, when we look at the average CPI, processor B may be better because it takes only one cycle to execute an instruction on the average.
On the other hand, processor B takes 2 and 1/2 cycles to execute an instruction.
And finally, the clock rate of processor A may be better, it may run a 2 and 1/2 gigahertz, processor B may run a 2 gigahertz.
So what is the total execution time?
Well, when we multiply all of these together, we'll find out the processor B completes the task faster than the processor A, although it is worse in two of its performance metrics.
It takes more instructions to complete the task and it runs at a slower clock rate.
But it's CPI, it's significantly better, and it helps it overcome the other disadvantages.
So keep that in mind whenever trying to buy, for example, a processor.
We are going to make a quick break here and come back and discuss the energy efficiency, because it also affects their performance, so see you in a bit.
Đăng nhập để đánh giá học liệu này.
Đăng nhập để bình luận — chưa ai bình luận về học liệu này.
Không có khóa học liên quan.