Easy-to-understand explanation of the characteristics of CPU, GPU, and FPGA

1. CPU vs GPU

  You can simply understand the CPU as a knowledgeable professor who is proficient in everything; while the GPU is a bunch of elementary school students who can only do simple arithmetic operations. But no matter how powerful the professor is, he cannot calculate 500 additions and subtractions in one second. Therefore, for simple and repeated calculations, a single professor is no match for a large number of schoolchildren. In the matter of simple arithmetic operations, 500 elementary school students (concurrently) can easily beat the professor.
insert image description here
  It can be seen that the biggest difference between CPU and GPU lies in the architecture. The CPU is suitable for a wide range of application scenarios (knowledgeable), and can execute arbitrary programs; while the GPU is designed for multi-tasking and has strong concurrent capabilities.
  Specifically, it is multi-core. A general CPU has 2 cores, 4 cores, 8 cores, etc.; while a GPU may have hundreds or thousands of cores. The GPU
insert image description here
  structure is similar to the CPU, including a control unit (control unit), an arithmetic logic unit ( ALU), cache (cache) and dynamic random access memory (DRAM) and other components. The difference is that the control unit, ALU, and cache design of the GPU are relatively simple and large in number, which makes the GPU good at handling a large number of simple tasks (such as rendering images). It can be seen that the internal cache and control part of the CPU occupy a large
  part On-chip area, so the computing unit accounts for a small proportion. The GPU only has a very simple control unit, and most of the rest is occupied by the computing unit, so the number of cores of the CPU is limited, while the GPU can easily pile up thousands of cores. It's just that the ability of each core in the CPU is like a professor, and the ability of each core in the GPU is like a primary school student.
  Why do GPUs need so many cores?
  Think about how a picture on the computer is represented? It is nothing more than pixels on the screen:
insert image description here
  we need to calculate for each pixel, and it is the same operation, just like the elementary school students in the example just calculated and added.
  For a screen, there are generally millions of pixels. If we want to serially perform calculations for each pixel, the efficiency is too low. Therefore, each core in the GPU can be used to perform calculations for the corresponding pixels. Since there are many cores in a GPU, parallel computing can greatly increase the speed. In addition to the relatively large number of cores of the GPU, the way the GPU works is also strange.
  How the GPU works:
  For the CPU, different cores can execute different machine instructions. CoreA can run the word thread while coreB can run the browser thread. This is the so-called Multiple Instruction Multiple Data, MIMD (Multiple Instruction, Multiple Data)
  and the GPU is different. These cores on the GPU must run the same machine instructions uniformly, but can operate different data. This is like these elementary school students must perform addition calculations at a certain moment. The difference lies in some Primary school students may need to calculate 1+1, some need to calculate 2+6, etc. The only change is the number of operands, which is the so-called single instruction multiple data, SIMD (Single Instruction, Multiple Data). Therefore, we can see
  GPU The way the CPU works is quite different.
  In addition to this way of working, the instruction set of the GPU is very simple, unlike a complex processor such as a CPU. If you look at the CPU programming manual, you will find that the CPU is responsible for a lot of things, such as interrupt handling, memory management, IO, and so on. These do not exist for the GPU. It can be seen that the positioning of the GPU is very simple, that is, pure computing. The GPU is by no means used to replace the CPU. The CPU just entrusts it with some things that the GPU is very good at. A supporting role to share the CPU work.

  What are GPUs good at?
  Computing scenarios that are more suitable for GPUs are as follows: simple calculations and repeated calculations, so if your computing scenarios are similar to the image rendering here, it is reasonable to use GPUs. Therefore, for graphics and image calculations, weather forecasts, and neural networks,
  the problem that GPUs stump CPUs is that when it is delivered a lot of trivial work, although it can handle it, it will waste too much precious time; overqualified, just like Michelin The chef was sent to the night market to fry chicken cutlets, which delayed the business of the high-end restaurant. In contrast, the control unit and ALU of the GPU are simple in design, have a small cache space, have a large number of cores and relatively high throughput, and are suitable for fast processing of simple calculations. In addition to rendering images, the GPU requires intensive data The field of computing has also emerged. For example, in big data analysis, machine learning, and the development of AI artificial intelligence, GPU has become an important contributor to the advancement of computer science.

2. FPGA

  What are FPGAs?
  FPGA (Field Programmable Gate Array), which is a field programmable gate array, can describe a circuit design through hardware description language (Verilog or VHDL), synthesize and layout through supporting EDA tools, and burn it into FPGA to realize the design
  . All FPGAs or eFPGAs contain a large number of programmable logic cells and programmable routing cells. Logic cells implement small pieces of digital logic, and wiring connects these logic cells to form larger digital circuits.
insert image description here

  The basic principle of FPGA: According to the combinational logic and sequential logic of the gate circuit, the use of the look-up table (Look-Up-Table, referred to as LUT) to achieve fast data calculation.
  Programmable Logic Unit:
  Digital circuits can be subdivided into combinational logic and sequential logic. The part of the FPGA that implements combinational logic is the look-up table (LUT), and the timing logic relies on registers. Several LUTs and registers are connected to each other to form a logical cluster. The structure of logic clusters defined by different FPGA companies is also different. The logic cluster structure has two major advantages. First, the interconnection speed in the logic cluster should be fast, which can increase the speed of the FPGA. Second, the application of the logic cluster can simplify the complexity of layout and wiring, and shorten the synthesis time.
insert image description here

  Programmable wiring unit:
  Unlike custom circuits, FPGA wiring resources are prefabricated, so prefabricated wiring resources can connect most logic units (clusters). For user-designed projects, a series of switches are controlled to meet the interconnection between specific units. This also makes wiring resources occupy most of the FPGA area, and if there are too many control switches in a complex wiring network, the operating frequency of the FPGA will be greatly reduced. If the routing resources are reduced, the difficulty of the EDA software algorithm will be increased, and the circuit layout and routing will fail.
  Therefore, how to design the logic cluster and the routing resources that match it to achieve a balance between speed and area, and also take into account the difficulty of EDA software algorithms, execution time, and memory usage. This is the core of each FPGA manufacturer's core.

The difficulty of the CPU is its hardware structure, but the software instruction set is not the main difficulty of the manufacturer. The hardware structure principle of FPGA is not the main technical barrier, but the core algorithm of its EDA software is the result of long-term accumulation of each company

insert image description here

  CPU vs GPU vs FPGA:
insert image description here

Guess you like

Origin blog.csdn.net/wangzongyu/article/details/131062986