How GPUs work and understand

Source: Internet
Author: User

The GPU looked a bit messy this week,

GPU English full name graphic processing Unit, Chinese translates to "graphics processor".

Because GPUs have high parallel structures (highly parallel structure), GPUs have a higher efficiency than CPUs in processing graphics data and complex algorithms. Figure 1 GPU VS CPU shows the structural differences between GPU and CPU, most of the CPU area is the controller and register, compared to the GPU has more Alu (arithmetic logic unit, logic unit) for
Data processing, rather than caching and flow control, is a structure that is suitable for parallel processing of dense data. When a CPU performs a compute task, it processes only one data at a time, there is no real parallelism, and the GPU has multiple processor cores, which can process multiple data in parallel at a time.


The GPU uses a streaming parallel computing model that allows independent parallel computation of each data, the so-called "independent Calculation of data", that is, the calculation of any element within the stream does not depend on other similar data, for example, the world position coordinates of a vertex, not dependent on the location of other vertices. The so-called "parallel computing" means that "multiple data can be used at the same time, multiple data parallel operations and a single data execution time is the same".


Figure 2 matrix addition on the GPU


Figure 3 GPU Rendering pipeline

Figure 3 above is a typical pipelined schematic of a programmable GPU, where a programmable vertex processor (Vertex Shader) handles vertex traffic (including position, color, illumination, etc.). Because vertex processing operations are performed on the geometric points of the space, the vertex shader is well suited for calculations of geometric operations classes for general purpose computations. The programmable fragment shader (Fragment Processor) is responsible for "painting" the correct color for each pixel after the geometry processing and conversion, and its ISA (System architecture) is similar to the DSP or SSE instruction set, consisting of the Folat4 SIMD execution units and registers. When processing, accept first remove 2 elements from memory, according to the position of the fragment vector addition, vector and color to be saved to the memory, can be used as the result output or in the next operation directly. The normally 4-cell vector is processed because the RGB three colors plus the alpha channel data is exactly 4. The fragment shader contains a TMU (Texture Mapping Unit) cell that accesses the video memory as a map, so it can be viewed as a read-only access interface.

Add: The following is written in the article I saw. First, record the

Pixel shaders are responsible for texture sampling and other advanced pixel-by-byte processing, and in the example Videofilter of the Nvidia SDK 9.5, the parallel computing power of pixel shaders is used to perform a variety of advanced image processing techniques for video. such as: Blur, sharpen, video mixing, and so on.
The relevant implementation steps are as follows:
(1) Create a video texture management object;
(2) Loading video files, DirectShow is responsible for the management of scheduling video data;
(3) associated DirectShow video data and Direct3D texture object;
(4) GPU initialization, associating CPU vertex data with GPU external variables, especially DirectShow processed frame data associated with texture data in the GPU;

      (5) vertex shaders perform texture coordinate transformations and other vertex-based parallel algorithms;
      (6) pixel shaders perform texture sampling and other pixel-level parallel algorithms.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.