Hey there! I’m Maeda, one of Hacarus’s FPGA interns. Just like the title says, I joined the course called Amazon EC2 F1 Instance.
In this report, I’ll explain what I learned point-by-point.
So, what’s an F1 Instance?
The F1 Instance is a compute instance with Field Programmable Gate Arrays, abbreviated as FPGA.
The F1 instance (Formula 1, includes Xilinx Virtex UltraScale+ VU9P) is an EC2 (Elastic Compute Cloud) equipped with FPGA.
In FPGA, users can program the logic functions that can be implemented in ASIC (Application Specific Integrated Circuits) as hardware on the FPGA.
Logic and wiring can be reconfigured freely to suit the application.
F1 Instance’s specific configuration is listed below:
- Intel Xeon E5-2686v4 (2.3GHz, compatible with Turbo mode)
- 1-8 FPGA (Xilinx Virtex UltraScale+ VU9P)
- NVMe-connected SSD max approximately up to 4TB
A developing environment for F1 Instance is listed below:
- AWS FPGA Developer Forum
- FPGA Developer AMI (Vivado, SDAccel) (Free of charge)
- Hardware Developer Kit
In recent years, FPGAs have been evaluated for their low power consumption and excellent parallel processing because they do not depend on a predetermined instruction sequence like the CPU (Central Processing Unit). There are other uses for edge computing like preprocessing when processing in cloud computing.
I think the biggest advantage of using an FPGA in an F1 instance is that hardware accelerators implemented in FPGA can be used in the cloud. By making good use of this, it is possible to speed up the processing on the cloud.
The Execution Process Used in F1 Instance
In this workshop, it was assumed that the functions implemented in the FPGA would be invoked from the software.
The general flow when using an existing FPGA image is:
- Deploy OS image called Amazon Machine Image (AMI) on F1 instance and start your OS.
- Invoke the API from the F1 instance OS and download the Amazon FPGA Image (AFI) to the FPGA on the F1 instance.
- Execute the application on the F1 instance OS and execute processing on the FPGA.
AFI is sold on the AWS Marketplace. If a product that matches your intended use is on the market, you may be able to use a hardware accelerator implemented in an FPGA without having to develop it yourself. However, because there are only a few things that have been released, the features you may want are not always available, and the cost is high. In this case, you have the option of designing and developing your own product.
FPGA-applied Hardware Accelerator Design and Creating an AFI
In the previous section, we explained how to load a created AFI image on an F1 instance.
Now, how do you create an AFI with the features you want to use?
I’ll explain the basics of development using Xilinx’s SDAccel or AWS HDK (Hardware Development Kit).
First, a kernel (.xo) is generated from code written in C / C ++, OpenCL, or RTL using the SDAccel compiler. From this kernel, SDAccel assembles the FPGA design, and then the logic (synthesis and placement and routing) is performed on the FPGA design to generate a binary (.xclbin). Amazon FPGA Image (AFI) is generated from the generated binary.
The xclbin file is converted to encrypted AFI and the generated AFI is securely stored by the AWS backend service. It is also possible to simulate the logic described by the functions provided by SDAccel. The figure below shows what an AFI image looks like.
The following arrangements are required to generate AFI:
- Verification of code by simulation
- Build FPGA binary (.xclbin) with SDAccel
- AWS CLI and S3 bucket setup
Once this is done, you can create an AFI image using the create_sdaccel_afi.sh script provided by AWS. The create_sdaccel_afi.sh script performs the following procedures:
- Create AFI encrypted FPGA binary (.xclbin).
- Generate a file containing the generated AFI Amazon FPGA Image ID (AFI ID) and Amazon Global FPGA Image ID (AGFI ID).
- Create an AWS FPGA binary file (.awsxclbin). Use this file to decide which AFI to load into the FPGA.
The Amazon Global FPGA Image ID (AGFI ID) is an ID that is uniquely determined within the F1 instance. Since this ID is fixed globally, it isn’t necessary to change the AGFI ID for each region when copying and using AFI or AMI.
Amazon FPGA Image ID (AFI ID) is an ID used to manage AFI with AWS CLI and SDI API. The ID varies from region to region.
SDAccel also provides a function to simulate the described logic, so you are able to confirm whether your implementation is correct at an appropriate stage.
To sum up
In this workshop, we experienced how to run an existing AFI image on an F1 instance.
Lucky for us, F1 instances do not require the initial investment of buying an FPGA board and instead, provides the ability to share an AFI image which may make it easier to obtain FPGA implementations for typical applications in the future- which I think is an excellent feature of the F1. You can also use this instance when you want to process a large amount of data at high speed using parallel operations, which is also suitable for processing on a GPU.
Definitely looking forward to how the F1 Instance (which first appeared in April 2017) will hold for the community and future!
- F1 Instance AWS Official Page
- Xilinx Official F1 Instance and SDAccel Description Page