Afaik, gpu cores a very stripped down cpu cores that do basic math, but what sort of math can cpus do that gpus can’t

I’m talking, cpu core vs Tensor/Cuda cores.

  • corruptboomerang@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    I mean if you’re creative enough, probably nothing.

    This is kinda like asking what can I do on a lathe that I can’t do on a mill. It’s more what’s better suited to be done on one or the other.

    CPUs are more generalised; they have a deep and complex instruction set and feature list. While GPUs are shallower and far more specialised, but do tasks that parallellalise more readily… Like calculating a metric shitload of triangles.

    You can see CPUs used to ‘push pixels’ in older computers since that’s all they had.

    • Wfing@alien.topB
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Follow up question, what allowed CPUs before the advent of eGPU/dGPU’s to output video, or what prevents them from doing so now?

      • GomaEspumaRegional@alien.topB
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        Frame Buffers have been a thing since the 60s at least ;-)

        Basically it is a piece of memory that contains the color information for a set of pixels. The simplest would be a black and white frame buffer, there the color of each pixel is defined by it being 1 (black) or 0 (white).

        Let’s assume that you want to deal with a monitor that it is 1024x1024 pixels in resolution, so you need 1024x1024 (~1Mbit) bits of information to store the color of each pixel.

        So in the simplest case, you had a CPU writing the 1Mbit BW image that it just generated (by whatever means) into the region of memory that the video hardware is aware of. Then the display generator would go ahead and read each of the pixels and generate the color based on the bit information it reads.

        Rinse and repeat this process around 30 times per second and you can display video.

        If you want to display color, you increase the number of bits per pixel to whatever color depth you want. And the process is basically the same, except the display generator is a bit more complex as to generate the proper shade of color by mixing Red/Gree/Blue/etc values.

        That is the most basic frame buffer, unaccelerated meaning that the CPU does most of the work in generating the image data to be displayed.

        So assuming you had a CPU that was incredibly fast, you could technically do just about the same that a modern GPU can do. It just would need to be thousands of times faster than the fastest modern CPU to match a modern GPU. ;-)

        Hope this makes sense.

      • monocasa@alien.topB
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        Video cards that didn’t have a GPU, but instead were just a RAMDAC or “scan out” engine.

      • KTTalksTech@alien.topB
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        You’ve probably seen this in older games already, hardware vs software rendering. Software rendering just asks your CPU to perform the same calculations your GPU would normally take care of. It still works today but games have such astronomically high performance requirements that most don’t even give you the option.

  • Chaseydog@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    I think it’s more about the efficiency of doing the math than the ability to perform the math.

  • PolishTar@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    CPUs and GPUs are both Turing complete, so from a computation perspective, they can technically do the same things. However each is optimized for a different set of metrics, so it may be wise to target a particular workload to one over the other.

    The CPU is optimized for minimum latency, aka maximum single threaded performance. This is really important for a lot of workloads.

    GPUs are optimized for maximum throughput and are willing to suffer higher latency to achieve it. There are many architectural differences as a result of this goal, for example: GPUs don’t have branch prediction, they also don’t have out of order processing, and also have much smaller caches per computational unit. All of these saves a ton of transistors, which can be used to add more cores.

    • tomytronics@alien.topB
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      So no point in making Linux or Windows that can run 100% within GPU and leaving a very minimal CPU to handle data transfer between drives, keyboard, etc and GPU.

      I’d like to see someone with a 4090 GPU running Windows and a Motorola 68000 as the CPU to handle drives.

  • Ph11p@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    CPUs are general purpose processor that do the general calculations and data. If a PC is handling AI algorithms, they are often done in the CPU. CPUs handle the more complex large file handling. CPUs handle the general interactions in a game. CPUs have fewer but massive complex processor cores optimized for large complex logic work.

    GPUs are their own specialist computers optimized for complex graphics and physics vector calculations from hundreds of thousands of really tiny simple files. CPUs handle the general interactions in a game. GPUs handle the complex lighting, light rays, fragmentation physics and image 3D rendering. CUDA and Tensor Cores of a GPU are thousands of puny simple processors optimized for tiny random floating point calculations.

  • MrMobster@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    The most important thing about GPU cores is that they are parallel in nature. A lot of GPUs out there use 1024-bit arithmetic units that can process 32 numbers at the same time. That is, if you do something like a + b, both a and b are “vectors” consisting of 32 numbers. Since a GPU is built to process large amount of data simultaneously, for example shading all pixels in a triangle, this is optimal design that has good balance between cost, performance, and power consumption.

    But the parallel design of GPU units also means that they will have problems if you want more execution granularity. For example in common control logic like “if condition is true do x, otherwise do y”, especially if both x and y are complex things. Remember that GPUs really want to do the same thing for 32 items at a time, if you don’t have that many things to work with, their efficiency will suffer. So a lot of common problem solutions that are formulated with “one value at a time” approach in mind won’t translate directly to a GPU. For example, sorting. On a CPU it’s easy to compare numbers and put them in sorted order. On a GPU you want to compare and order hundreds or even thousands of numbers simultaneously to get good performance, and it’s much more difficult to design a program that will do it.

    If you are talking about math specifically, well, it depends on the GPU. Modern GPUs are very well optimised for many operations and have native instructions to compute trigonometric functions (sin, cos), exponential functions and logarithms, as well as do complex bit manipulation. They also natively support a range of data values such as 32- and 16-bit floating point values. But 64-bit floating point value (double) support is usually lacking (either low performance or missing entirely).

  • JazzyCake@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    I don’t think thinking of them as “stripped down CPU cores” is accurate. They are very different beasts these days, with GPUs executing multiple threads in lockstep, not having a stack etc.

    As far as “math”. GPUs can do pretty much everything in the sense they are turing complete, but at the same time if you’re asking instruction-wise, GPUs won’t have all the extra super-specific stuff that the x64 instruction set has for example. You’d need to write more stuff yourself.

    I’m not sure exactly at what level you’re asking the question.

  • chx_@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    what sort of math can cpus do that gpus can’t

    that’s really restricting the problem space. Obviously (?) math wise it’s the same thing: both of them can flip bits and arrange this bit flipping in ways useful for mathematics.

    But CPUs are not just math. They always had I/O, almost always had interrupts, for many decades now they had protection rings and virtualization is now really common (Intel/AMD released support in 2005/2006). These are all supported in the instruction set.

  • jokerfriend6@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Basic GPU handles algorithms for graphics and outputs to a display. Latest GPUs have specialized instructions to handle mathematical algorithms for parallelization so the Host OS hits certain routines it executes those on the GPU getting usually 8 - 32X speedup on execution over the CPU for mathematical routines.

  • logibutt@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Not so much GPUs themselves but GPU shader compilers really struggle on some code with a lot of branching and loops, operating on strings.

  • concrete-druid@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    I think it’s more about the instruction set. CPUs are designed to be general purpose and can handle any processing required. GPUs have a specialized instruction set but are highly parallel which is useful for those specialized workloads.

  • Hagtzel@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    GPUs are not good with branching, as in taking different paths based on previous calculations.

  • floofandmemes@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    A CPU core has a variety of arithmetic and logic circuits making it good for general purpose compute, whereas a GPU core (CUDA or Stream processor) has a much more limited set of logic units, which allows each one to be much smaller physically. This is why a GPU can fit thousands of cores while standard desktop CPUs are rarely more than 12.

  • zhantoo@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    The eli5 is that one is like a very strong man, capable of carrying large objects or pulling a car.

    The other is like a man with a thousand arms. They might not be very strong, but they can carry a thousand plates.

    • RScrewed@alien.topB
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      I like this one the best, only problem with this analogy is there is no common ground between pulling a car and carrying plates in terms of goal achieved.

      How about a CPU can swing one 1000 pound hammer while a GPU can swing 1000 1 pound hammers?

  • rryland@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Think of it this way.

    A CPU is a big digger, its bucket can dig a large chunk of earth with one scoop. Heavy lifting.

    A GPU is a lot of small shovels, each digging a small amount of earth, but all at the same time.

    So a CPU can do a large task at once, a GPU can do a lot of smaller tasks at once.

    Which is great, the CPU is doing grunt work, the GPU is doing small calculations.

    Both the GPU and the CPU being perfectly tasked for their specific purpose.