Skip to content

Commit b1d17ac

Browse files
authored
rc 2.1.2 (#733)
* Introduced Python Bindings to the SDK * Added [documentation](./sdk/userspace/cython_bindings/README.md) for Python binding usage and setup * [Examples](./sdk/userspace/cython_bindings/) demonstrating Python-based FPGA control * Added link to instructions for DCV licensing setup. Credit to @morgnza for this update! * Added verbiage to DCV setup guide to show where to set virtual display resolution * Fix to Bandwidth Calculation
1 parent 82ddb6c commit b1d17ac

28 files changed

+1220
-66
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ waves.shm
2424
*.order
2525
*.symvers
2626
.vscode/
27-
27+
venv
28+
*_wrapper.c
29+
fpga_utils.c
2830
*~
2931
.\#*
3032
\#*

RELEASE_NOTES.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# F2 Developer Kit Release Notes
22

3+
## v2.1.2
4+
5+
* Introduced Python Bindings to the SDK
6+
* Added [documentation](./sdk/userspace/cython_bindings/README.md) for Python binding usage and setup
7+
* [Examples](./sdk/userspace/cython_bindings/) demonstrating Python-based FPGA control
8+
* Added link to instructions for DCV licensing setup. Credit to @morgnza for this update!
9+
* Added verbiage to DCV setup guide to show where to set virtual display resolution
10+
* Fix to Bandwidth Calculation
11+
312
## v2.1.1
413

514
* Added global register offset for the SDE IP. See [CL_SDE software examples](./hdk/cl/examples/cl_sde/software/src/README.md).

developer_resources/Amazon_DCV_Setup_Guide.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ graphical user interface (GUI) to visualize FPGA development in the cloud.
3131

3232
### Prerequisites
3333

34-
1. [Depenency Installation](https://docs.aws.amazon.com/dcv/latest/adminguide/setting-up-installing-linux-prereq.html#linux-prereq-gui)
35-
* :warning: DO NOT PERFORM STEP 3! Upgrading may impact the stability of development kit software!
36-
2. [Protocol Setup](https://docs.aws.amazon.com/dcv/latest/adminguide/setting-up-installing-linux-prereq.html#linux-prereq-wayland)
37-
3. [Driver Installation](https://docs.aws.amazon.com/dcv/latest/adminguide/setting-up-installing-linux-prereq.html#linux-prereq-nongpu)
34+
1. [Instance and IAM Configuration for DCV Licensing](https://docs.aws.amazon.com/dcv/latest/adminguide/setting-up-license.html#dcv-lic-req)
35+
2. [Depenency Installation](https://docs.aws.amazon.com/dcv/latest/adminguide/setting-up-installing-linux-prereq.html#linux-prereq-gui)
36+
- :warning: DO NOT PERFORM STEP 3! Upgrading may impact the stability of development kit software!
37+
3. [Protocol Setup](https://docs.aws.amazon.com/dcv/latest/adminguide/setting-up-installing-linux-prereq.html#linux-prereq-wayland)
38+
4. [Driver Installation and Setting Virtual Display Resolution](https://docs.aws.amazon.com/dcv/latest/adminguide/setting-up-installing-linux-prereq.html#linux-prereq-nongpu)
3839

3940
### Amazon DCV Server Installation
4041

docs-rtd/source/RELEASE-NOTES.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
F2 Developer Kit Release Notes
22
==============================
33

4+
.. _v212:
5+
6+
v2.1.2
7+
------
8+
9+
- Introduced Python Bindings to the SDK
10+
- Added `documentation <./sdk/userspace/cython-bindings/README.html>` for Python binding usage and setup
11+
- `Examples <https://github.com/aws/aws-fpga/blob/f2/sdk/userspace/cython_bindings>` demonstrating Python-based FPGA control
12+
- Added link to instructions for DCV licensing setup. Credit to @morgnza for this update!
13+
- Added verbiage to DCV setup guide to show where to set virtual display resolution
14+
- Fix to Bandwidth Calculation
15+
416
.. _v211:
517

618
v2.1.1

docs-rtd/source/developer-resources/Amazon-DCV-Setup-Guide.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,17 @@ Installing the Amazon DCV Server on an Amazon EC2 Instance
4949
Prerequisites
5050
~~~~~~~~~~~~~
5151

52-
1. `Depenency
52+
1. `Instance and IAM Configuration for DCV Licensing <https://docs.aws.amazon.com/dcv/latest/adminguide/setting-up-license.html#dcv-lic-req>`__
53+
2. `Depenency
5354
Installation <https://docs.aws.amazon.com/dcv/latest/adminguide/setting-up-installing-linux-prereq.html#linux-prereq-gui>`__
5455

5556
- ⚠️ DO NOT PERFORM STEP 3! Upgrading may impact the stability of
5657
development kit software!
5758

58-
2. `Protocol
59+
3. `Protocol
5960
Setup <https://docs.aws.amazon.com/dcv/latest/adminguide/setting-up-installing-linux-prereq.html#linux-prereq-wayland>`__
60-
3. `Driver
61-
Installation <https://docs.aws.amazon.com/dcv/latest/adminguide/setting-up-installing-linux-prereq.html#linux-prereq-nongpu>`__
61+
4. `Driver
62+
Installation and Setting Virtual Display Resolution <https://docs.aws.amazon.com/dcv/latest/adminguide/setting-up-installing-linux-prereq.html#linux-prereq-nongpu>`__
6263

6364
Amazon DCV Server Installation
6465
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -151,9 +152,6 @@ Checks <#post-installation-checks>`__ in the ``Password`` box and click
151152
At this point, you should see your session begin and a virtual desktop
152153
displayed after a brief delay.
153154

154-
Any popups about not having a license may be safely ignored. This is a
155-
known issue with DCV.
156-
157155
Now, open a terminal and run the following command:
158156
``source /etc/profile.d/default_module.sh``. You're now ready to use
159157
your GUI-enabled EC2 Instance.

docs-rtd/source/sdk/README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ Additional SDK Documentation
7474

7575
userspace/fpga_mgmt_examples/README
7676

77+
userspace/cython-bindings/README
78+
7779
userspace/fpga_mgmt_tools/README
7880
docs/F2-Software-Performance-Optimization-Guide
7981
docs/Load-Times
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
Python Bindings
2+
===============
3+
4+
These bindings exist to provide Python interfaces to the FPGA on AWS F2
5+
EC2 Instances, allowing developers to control and interact with FPGAs
6+
using Python instead of C code directly.
7+
8+
Cython Overview
9+
---------------
10+
11+
A typical Cython binding setup creates a bridge between Python and C
12+
code through a specific file structure: the ``.pxd`` file declares the
13+
external C functions and types (similar to a C header file), while the
14+
``.pyx`` file implements the actual Python-facing wrappers around these
15+
C functions, handling type conversions and memory management.
16+
17+
When compiled, Cython transforms the ``.pyx`` file into C code, which is
18+
then built into a shared object (``.so``) file that Python can import
19+
directly as a module, allowing Python code to seamlessly call C
20+
functions while maintaining Python's ease of use but with C's
21+
performance benefits.
22+
23+
Setup
24+
-----
25+
26+
How to Build Bindings
27+
~~~~~~~~~~~~~~~~~~~~~
28+
29+
.. code:: bash
30+
31+
git clone https://github.com/aws/aws-fpga.git
32+
cd aws-fpga
33+
source sdk_setup.sh
34+
35+
This process will generate the necessary ``*_wrapper.c`` files that
36+
enable Python-to-C communication.
37+
38+
Instructions to run examples
39+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40+
41+
Navigate to the ``aws-fpga/sdk/userspace/cython_bindings`` directory
42+
43+
.. code:: bash
44+
45+
sudo python3 fpga_mgmt_example.py
46+
sudo python3 fpga_clkgen_example.py
47+
sudo python3 fpga_pci_example.py
48+
49+
Troubleshooting
50+
---------------
51+
52+
- FPGA Unresponsive: Run Python scripts with sudo privileges
53+
- Library not found: Verify AWS FPGA SDK installation is complete and
54+
sourced
55+
- Invalid slot ID: Verify slot number is valid for instance type
56+
- AFI load timeout: Check AFI ID and instance permissions, and ensure
57+
sufficient time after async FPGA clears and loads
58+
- Debug: Enable verbose logging by setting logging.INFO in ``utils.py``
59+
- Supported Python Versions: Bindings can be used by all Python versions
60+
supported by Cython
61+
- How do I find my instance type during runtime: `Instance Meta Data
62+
Documentation <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html#instance-metadata-retrieval-examples>`__
63+
64+
FPGA Management Library Functions
65+
---------------------------------
66+
67+
These are the core functions that provide direct interaction with AWS F2
68+
FPGA instances. The primary functions include FPGA slot initialization,
69+
image loading/clearing, status checking, and metric gathering. These
70+
functions form the API layer between Python applications and the
71+
low-level FPGA hardware management, allowing developers to control FPGA
72+
resources without dealing directly with the hardware registers or
73+
low-level C interfaces.
74+
75+
- ``load_local_image(self, slot_id: int, afi_id: str) -> dict``
76+
- ``clear_local_image(self, slot_id: int) -> dict``
77+
- ``describe_local_image(self, slot_id: int, flags: uint32_t) -> dict``
78+
- ``strerror(error: int) -> str``
79+
- ``strerror_long(err: int) -> str``
80+
- ``get_status_name(status: int) -> str``
81+
- ``get_status(self, slot_id: int) -> dict``
82+
- ``set_cmd_timeout(self, value: uint32_t) -> None``
83+
- ``set_cmd_delay_msec(self, value: uint32_t) -> None``
84+
- ``get_vLED_status(self, slot_id: int) -> uint16_t``
85+
- ``set_vDIP(self, slot_id: int, value: uint16_t) -> None``
86+
- ``get_vDIP_status(self, slot_id: int) -> uint16_t``
87+
- ``clear_local_image_sync(self, slot_id: int, timeout: uint32_t, delay_msec: uint32_t) -> dict``
88+
- ``load_local_image_flags(self, slot_id: int, afi_id: str, flags: uint32_t) -> dict``
89+
- ``load_local_image_sync_flags(self, slot_id: int, afi_id: str, flags: uint32_t, timeout: uint32_t, delay_msec: uint32_t) -> dict``
90+
91+
FPGA Clock Generation Library Functions
92+
---------------------------------------
93+
94+
The Clock Generation Library provide essential clock management
95+
capabilities for AWS FPGA instances, allowing precise control over clock
96+
frequencies and configurations. The primary functions include retrieving
97+
current clock settings, applying predefined clock recipes, and
98+
dynamically adjusting frequencies across multiple clock domains (A, B,
99+
C, and HBM). These functions form the API layer between Python
100+
applications and the low-level clock management system, allowing
101+
developers to precisely control FPGA clock resources without directly
102+
manipulating hardware registers. More information on clock generation
103+
functions are available in the
104+
`Clock Recipes User Guide <../../../hdk/docs/Clock-Recipes-User-Guide.html>`__
105+
document.
106+
107+
- ``get_dynamic(self, slot_id: int) -> str``
108+
- ``set_recipe(self, slot_id: int, clk_a_recipe: uint32_t, clk_b_recipe: uint32_t, clk_c_recipe: uint32_t, clk_hbm_recipe: uint32_t, reset: uint32_t) -> None``
109+
- ``set_dynamic(self, slot_id: int, clk_a_freq: uint32_t, clk_b_freq: uint32_t, clk_c_freq: uint32_t, clk_hbm_freq: uint32_t, reset: uint32_t) -> None``
110+
111+
FPGA PCI Library Functions
112+
--------------------------
113+
114+
The FPGA PCI library provides a comprehensive set of functions for
115+
managing and interacting with the PCI bus on AWS FPGA instances. The
116+
library starts with initialization to set up the PCI management
117+
interface, and ``pci_attach()``/``pci_detach()`` to establish and
118+
terminate connections to specific PCI Base Address Registers (BARs).
119+
These functions form the basis for accessing PCI-mapped hardware
120+
resources.
121+
122+
- ``pci_attach(self, slot_id: int, pf_id: int, bar_id: int, flags: uint32_t) -> pci_bar_handle_t``
123+
- ``pci_detach(self, handle: pci_bar_handle_t) -> None``
124+
- ``pci_poke(self, handle: pci_bar_handle_t, offset: uint64_t, value: uint32_t) -> None``
125+
- ``pci_poke8(self, handle: pci_bar_handle_t, offset: uint64_t, value: uint8_t) -> None``
126+
- ``pci_poke64(self, handle: pci_bar_handle_t, offset: uint64_t, value: uint64_t) -> None``
127+
- ``pci_write_burst(self, handle: pci_bar_handle_t, offset: uint64_t, data: List[int], dword_len: uint64_t) -> None``
128+
- ``pci_peek(self, handle: pci_bar_handle_t, offset: uint64_t) -> uint32_t``
129+
- ``pci_peek8(self, handle: pci_bar_handle_t, offset: uint64_t) -> uint8_t``
130+
- ``pci_peek64(self, handle: pci_bar_handle_t, offset: uint64_t) -> uint64_t``
131+
- ``pci_get_slot_spec(self, slot_id: int) -> fpga_slot_spec``
132+
- ``pci_get_all_slot_specs(self, size: int) -> List[fpga_slot_spec]``
133+
- ``pci_get_resource_map(self, slot_id: int, pf_id: int) -> fpga_pci_resource_map``
134+
- ``pci_rescan_slot_app_pfs(self, slot_id: int) -> None``
135+
- ``pci_get_address(self, handle: pci_bar_handle_t, offset: uint64_t, dword_len: uint64_t) -> uintptr_t``
136+
- ``pci_memset(self, handle: pci_bar_handle_t, offset: uint64_t, value: uint32_t, dword_len: uint64_t) -> None``

0 commit comments

Comments
 (0)