Author Topic: What's inside a GPU  (Read 2042 times)

0 Members and 1 Guest are viewing this topic.

Offline c64Topic starter

  • Frequent Contributor
  • **
  • Posts: 302
  • Country: au
What's inside a GPU
« on: December 12, 2023, 02:29:18 am »
Is it just a lot of processors optimized for image manipulation (like drawing lines, moving pixels) which work in parallel?

Or is it done with custom logic  dedicated hardware?

Or is it combination of both?
« Last Edit: December 13, 2023, 01:29:03 am by c64 »
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11700
  • Country: my
  • reassessing directives...
Re: What's inside a GPU
« Reply #1 on: December 12, 2023, 03:49:16 am »
this kid probably can give you some startup, but then you need to be well versed in 3d processing / engine and what instructions are really needed to lay down on the silicone.. so you need to be a good ASICs/custom IC designer as well. here i google for you so i can get to know more as well... ymmv..


Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline Whales

  • Super Contributor
  • ***
  • Posts: 1972
  • Country: au
    • Halestrom
Re: What's inside a GPU
« Reply #2 on: December 12, 2023, 04:58:32 am »
Is it just a lot of processors optimized for image manipulation (like drawing lines, moving pixels) which work in parallel?

Or is it done with custom logic?

Or is it combination of both?

All of the above.

Moving large blocks of pixels: really wide memory buses

Drawing lines: even though GPUs are marketed as general purpose processing I believe they still have dedicated "rasteriser" silicon that's optimised for drawing textured polygons.  Lines are sort of a subset of this job (albeit most non-3D software draws lines on the CPU because it's simple and fast enough anyway).

Custom logic: Depends on what you mean by custom.  Some of it is fixed, other parts are programmable at runtime (ie shader processing).  Is it truly "custom" if they manufacture a million of them?


Notably GPUs are particular bad at:

1. Branching (if statements)

2. Latency

Instead they're optimised for throughput of lots of similar computations.  Each pixel of your image, in an ideal world, undergoes almost exactly the same processing.  In reality it's not perfectly homogeneous but it's much more so than typical CPU tasks & code.
« Last Edit: December 12, 2023, 05:02:43 am by Whales »
 
The following users thanked this post: c64

Offline Berni

  • Super Contributor
  • ***
  • Posts: 5002
  • Country: si
Re: What's inside a GPU
« Reply #3 on: December 12, 2023, 06:45:05 am »
What is inside a GPU changed quite a bit over the years.

At first we only had 2D capabilities and a "graphics card" was actually called a video adapter since it was just a dual port RAM with a VGA DAC on the other side of it, it could also be run trough a character ROM to create text. The fanciest graphics functionality back then was basically glorified DMA transfers to move blocks of data around.

The first actual graphics accelerated GPUs used in PCs were basically ASICs purpose built for doing the major operations of 3D rendering. These are so called "fixed function" GPUs where there are blocks dedicated for certain operations that get strung together to form the 3D rendering pipeline. So it might have a geometry transformation block that can apply transformation matrices to a pile of points (useful for implementing a moving camera in the scene), it might have a block for Z sorting vertecies, it might have a rasterization block that draws triangles between vertices, this might interact with a texture mapper block that pulls pixels from textures and filters them smooth...etc Back in this day 3D applications had to have their rendering code specifically designed to work with the functions available in the particular GPU.

Then as computers got faster and graphics tasks more demanding it became clear that a more flexible and universal solution was needed. So programmable shader pipelines were introduced. This is a new concept where instead of hard wiring the common functions we instead create a small processor core that is more DSP like (aka really really good at math on large amounts of data), this core executes machine code much like a CPU, but works with data in a very parallel way. These are called shader cores and we can program them to do whatever we want. The 3D application can choose a pipeline it wants and program it into the GPU. Modern cards have 1000s (some even >10000) of these shade cores, giving them an incredible amount of math performance. They are now flexible enough to even be used for non graphics tasks that involve a lot of data and math. Like DSP, simulations, cryptocurrency mining, AI ...etc

There are still some dedicated sections more optimized for certain tasks (also coming in multiple cores so that the GPU vendor can scale the GPU for higher performance models by just adding more cores). Notably in the new generations getting new types of cores like tensor cores (really good at integer math, useful for AI) or raytracing cores (does what it says on the tin)
 
The following users thanked this post: Someone, c64

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16890
  • Country: us
  • DavidH
Re: What's inside a GPU
« Reply #4 on: December 12, 2023, 10:11:10 am »
These days GPUs use an an array of SIMD (single instruction multiple data) processors with some hardware to optimize rasterization.  Interestingly enough, 2D operations like line drawing and blitting are slower than using dedicated hardware, at least last time I checked, but fast enough.  Older GPUs which had dedicated 2D hardware were faster for 2D operations.

GPUs use thread level parallelism instead of the instruction level parallelism found in CPUs to make best use of memory level parallelism.
 
The following users thanked this post: c64

Offline Dan123456

  • Regular Contributor
  • *
  • Posts: 199
  • Country: au
Re: What's inside a GPU
« Reply #5 on: December 12, 2023, 10:13:20 am »
Here is another amazing video. This dude built his own 8 bit computer on a breadboard!!!

His videos are long, but are super addictive, informative, interesting and well worth watching  :)

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf