• 沒有找到結果。

Amdahl’s Law

在文檔中 Computer Architecture Formulas 1. (頁 81-84)

Amdahl’s Law

The performance gain that can be obtained by improving some portion of a com-puter can be calculated using Amdahl’s Law. Amdahl’s Law states that the perfor-mance improvement to be gained from using some faster mode of execution is limited by the fraction of the time the faster mode can be used.

Amdahl’s Law defines the speedup that can be gained by using a particular feature. What is speedup? Suppose that we can make an enhancement to a com-puter that will improve performance when it is used. Speedup is the ratio

Speedup ¼Performance for entire task using the enhancement when possible Performance for entire task without using the enhancement Alternatively,

Speedup ¼ Execution time for entire task without using the enhancement Execution time for entire task using the enhancement when possible

1.9 Quantitative Principles of Computer Design 49

Speedup tells us how much faster a task will run using the computer with the enhance-ment contrary to the original computer.

Amdahl’s Law gives us a quick way to find the speedup from some enhance-ment, which depends on two factors:

1. The fraction of the computation time in the original computer that can be con-verted to take advantage of the enhancement—For example, if 40 seconds of the execution time of a program that takes 100 seconds in total can use an enhancement, the fraction is 40/100. This value, which we call Fractionenhanced, is always less than or equal to 1.

2. The improvement gained by the enhanced execution mode, that is, how much faster the task would run if the enhanced mode were used for the entire pro-gram—This value is the time of the original mode over the time of the enhanced mode. If the enhanced mode takes, say, 4 seconds for a portion of the program, while it is 40 seconds in the original mode, the improvement is 40/4 or 10. We call this value, which is always greater than 1, Speedupenhanced.

The execution time using the original computer with the enhanced mode will be the time spent using the unenhanced portion of the computer plus the time spent using the enhancement:

Execution timenew¼ Execution timeold# ð1 " FractionenhancedÞ +Fractionenhanced

Speedupenhanced

" #

The overall speedup is the ratio of the execution times:

Speedupoverall¼Execution timeold

Execution timenew¼ 1

1 " Fractionenhanced

ð Þ +Fractionenhanced

Speedupenhanced

Example Suppose that we want to enhance the processor used for web serving. The new processor is 10 times faster on computation in the web serving application than the old processor. Assuming that the original processor is busy with computation 40% of the time and is waiting for I/O 60% of the time, what is the overall speedup gained by incorporating the enhancement?

Answer Fractionenhanced¼ 0:4; Speedupenhanced¼ 10; Speedupoverall¼ 1 0:6 +0:4

10

¼ 1 0:64 '1:56

Amdahl’s Law expresses the law of diminishing returns: The incremental improve-ment in speedup gained by an improveimprove-ment of just a portion of the computation diminishes as improvements are added. An important corollary of Amdahl’s Law is that if an enhancement is usable only for a fraction of a task, then we can’t speed up the task by more than the reciprocal of 1 minus that fraction.

50 Chapter One Fundamentals of Quantitative Design and Analysis

A common mistake in applying Amdahl’s Law is to confuse “fraction of time con-verted to use an enhancement” and “fraction of time after enhancement is in use.”

If, instead of measuring the time that we could use the enhancement in a compu-tation, we measure the time after the enhancement is in use, the results will be incorrect!

Amdahl’s Law can serve as a guide to how much an enhancement will improve performance and how to distribute resources to improve cost-performance. The goal, clearly, is to spend resources proportional to where time is spent. Amdahl’s Law is particularly useful for comparing the overall system performance of two alternatives, but it can also be applied to compare two processor design alterna-tives, as the following example shows.

Example A common transformation required in graphics processors is square root. Imple-mentations of floating-point (FP) square root vary significantly in performance, especially among processors designed for graphics. Suppose FP square root (FSQRT) is responsible for 20% of the execution time of a critical graphics bench-mark. One proposal is to enhance the FSQRT hardware and speed up this operation by a factor of 10. The other alternative is just to try to make all FP instructions in the graphics processor run faster by a factor of 1.6; FP instructions are responsible for half of the execution time for the application. The design team believes that they can make all FP instructions run 1.6 times faster with the same effort as required for the fast square root. Compare these two design alternatives.

Answer We can compare these two alternatives by comparing the speedups:

SpeedupFSQRT¼ 1

Improving the performance of the FP operations overall is slightly better because of the higher frequency.

Amdahl’s Law is applicable beyond performance. Let’s redo the reliability example from page 39 after improving the reliability of the power supply via redundancy from 200,000-hour to 830,000,000-hour MTTF, or 4150# better.

Example The calculation of the failure rates of the disk subsystem was Failure ratesystem¼ 10 # 1

1.9 Quantitative Principles of Computer Design 51

Therefore the fraction of the failure rate that could be improved is 5 per million hours out of 23 for the whole system, or 0.22.

Answer The reliability improvement would be

Improvementpower supply pair¼ 1 1 " 0:22

ð Þ +0:22

4150

¼ 1 0:78 ¼1:28

Despite an impressive 4150# improvement in reliability of one module, from the system’s perspective, the change has a measurable but small benefit.

In the preceding examples, we needed the fraction consumed by the new and improved version; often it is difficult to measure these times directly. In the next section, we will see another way of doing such comparisons based on the use of an equation that decomposes the CPU execution time into three separate components. If we know how an alternative affects these three components, we can determine its overall performance. Furthermore, it is often possible to build simulators that measure these components before the hardware is actually designed.

在文檔中 Computer Architecture Formulas 1. (頁 81-84)