Why Use an FPGA Instead of a GPU or CPU?

Previously, FPGAs (Field Programmable Gate Arrays) were used mainly in electronics engineering and very little in software engineering. However, now they have become serious alternatives to GPUs and CPUs.

Whenever you’re planning to compute something, you usually write down some software for your CPU or GPU, an instruction based architecture. On the other hand, you can create a special circuit for the particular computation rather than writing instructions for the general purpose circuit such as GPU or CPU. After designing the circuit, you need a way to implement the design, allowing you to compute flawlessly. One of the best ways to do so is using FPGA.

With the configuration, you can transform the FPGA into any circuit you want as long as it fits perfectly. It’s quite different compared to the instruction-based hardware popularly used by most programmers such as GPUs and CPUs. Therefore while FPGA is configured by specifying a particular hardware circuit, the CPUs and GPUs are configured using software.

Why Is FPGA More Preferable To CPUs And GPUs?

  1. Low Latency

If you are programming something like a high-frequency trading engine using an algorithm or the autopilot of a jet fighter you need low latency. It refers to the time between an input and response, and it needs to be as short as possible. Here, FPGAs stand out than the rest. That’s because using it, you can get the lowest latency possible at most 1 microsecond.

Note that, with the CPU, you can hope for a latency of at least 50 microseconds. With FPGA, the latency is more deterministic. There are a few reasons why the low latency can be achieved and specialized with FPGAs. First, they don’t rely on the generic operating system. Additionally, the communication doesn’t necessarily have to pass through generic business such as USB.

  1. Connectivity

Whenever you are using an FPGA, you can hook it up to any data source whether a sensor or a network interface directly to the pins found on the chip. It’s quite a notable difference when it comes to the CPUs and GPUs where you need to go through standardized buses such as PCIe or USB as well as rely on the operating system to deliver the required data to the specific application.

Note that, with the direct connection offered by the FPGA, you can also enjoy a low latency and a very high bandwidth. The latter will be needed in various applications such as radio-astronomy and much more. Here, there are many specialized sensors available in the field ready to generate huge amounts of data. With these applications, there is a lot of data that needs to be trimmed before being send, allowing it to be more manageable.

  1. Engineering Cost

Before we turn to energy efficiency, there is a disadvantage of FPGAs that people need to know about. First, they are harder to program compared to the GPUs and CPUs (the instruction-based architectures). The hardware circuits were previously described with HDL (hardware description language) including Verilog and VHDL. On the other hand, software is programmed using many of the programming languages available such as Python, Java or C.

In theory, the HDL and the various programming languages can be used to create any computation since both are considered to be Turing complete. However, there are vast differences when it comes to the engineering details. For instance, there has been an upcoming and popular method of programming FPGAs using simple programming languages such as C++ or Open CL, thus it allows a higher level of abstraction.

Regardless, when using these simple programming languages, programming the FPGA will still be harder than programming using the instruction based options such as the CPUs and GPUs. Some of the difficulties when it comes with programming the Xilinix FPGA will arise from the long compilation times. Take an instance when you are using the OpenCL compiler from Intel. Here, you will take about 4 to 12 hours when compiling a single program for FPGA.

It’s mainly because of the place and route phase, which is where the custom circuit that you need to be mapped with the available FPGA resources using the shortest paths available. It’s actually a very complex optimization issue and needs a lot of computation. There is an emulator available from Intel so you can take your time to test for the correctness without wasting a lot of time. However, if you need to optimize performance, you need to go through the rough compile phases.

  1. Energy Efficiency

A few notable users, including Intel have praised the energy efficiency aspect of using FPGAs compared to the instruction based systems. It might not be a clear cut advantage at the moment, especially when you are working with floating point computations. However, there are a few situations where FPGAs have proven to be more energy efficient compared to the GPUs and CPUs.

First, FPGAs have shown a lot of energy efficiency especially with fixed precision and logic compared to floating point computations. Take an example of the crypto-currency mining where FPGAs have become quite beneficial. Actually, many people mine bitcoins using FPGAs before they started moving to Application Specific Integrated Circuits (ASICs).

The latter are special integrated circuits that have been created to meet one purpose. They are actually more energy efficient but they need a huge investment upfront for the many chips produced or the design to be effective. Remember, FPGAs don’t really need to use a host computer to run effectively. That’s because they actually have their own output and input. That means you will save a considerable amount of money rather than buying a host.

It’s something that’s quite different from GPUs where you can’t operate independently unless you are using a host system such as NVLink or PCIe. There might be one exception here especially if you are using the NVidia Jetson but that’s just it. In conclusion, FPGAs have more advantages and benefits to offer compared to the instruction based architectures such as GPUs and CPUs.

Published by Kidal Delonix (1200 Posts)

Kidal Delonix is a contributor to Mr. Hoffman's blog. The views and opinions are entirely his/her own and may not reflect Mr Hoffman's views.

Leave a Reply