32
融入Python生态的Zynq软硬件设计框架 陆佳华 Xilinx教育与创新生态 高级经理 [email protected] Python Productivity for Zynq

Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

  • Upload
    others

  • View
    22

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

融入Python生态的Zynq软硬件设计框架

陆佳华 Xilinx教育与创新生态 高级经理[email protected]

Python Productivity for Zynq

Page 2: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

Python is increasingly the Language of Choice

https://spectrum.ieee.org/at-work/innovation/the-2018-top-programming-languages

Top Programming Languages,IEEE Spectrum, July’17

Python is the fastest growing language: driven by data science, AI, ML and academia

Top Programming Languages,IEEE Spectrum, July’18

Python is listed as anembedded language

for the first time

https://stackoverflow.blog/2017/09/06/incredible-growth-python/

Projected

https://stackoverflow.blog/2017/09/06/incredible-growth-python/

To date

Page 3: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

PYNQ Python Productivity for Zynq

Targeting the data centerartificial intelligence,

machine learning,data science

New users are not hardware designers,or embedded systems designers

HardwareEngineers

Embedded softwareEngineers

Domain Experts

Enable more people to program Xilinxprocessing platforms, more productively

Page 4: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

The Goal is Proliferation

Modern projects have many, more software engineers

How do we get them to use Xilinx devices?

How can we let them experience Xilinx advantages?

We must speak to them in their ‘language'

They do not use CAD tools

HardwareEngineers

Emb. softwareEngineers

Domain Experts, Software engineers

Is a framework for creating platforms that software engineers can use to experience the benefits of Xilinx silicon

PYNQ enables rapid development for FPGA designers and embedded s/w engineers also

Page 5: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

Productivity Languages & Hardware OverlaysZynq / Zynq UltraScale+

Users:

Apps Programmers:

Device driver writers:

Kernel developers:

Programmers(embedded):

Embedded Applications

Programmers

Python

Overlays

C/C++

Small group of experts create APSoC overlays and C API/driversMany more users build applications in C/Python

Page 6: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

IPython Notebooks to Jupyter Notebooks

Jupyter … Julia, Python, R

Default engine of data science

Taught to 1,000+ Berkeleystudents every semester

2+ million notebookson GitHub

Jupyter notebooks Visualization

TerminalCode editorJupyter Notebooks to JupyterLab IDE

Next-gen browser IDE

Includes Jupyter Notebooks

2017 ACM Software System Award

Page 7: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

JupyterLab runs on Zynq and Zynq UltraScale+

Runs natively on ARM A9and ARM A53 processors

Performant on Zynq 32-bit ARM A9 at 650 MHz, 512MB DRAM, no GPU

Page 8: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

PYNQ: Python productivity for Zynq

Jupyter notebooks/lab,browser-based interface

PYNQ enables Jupyteron Zynq and ZU+

Ubuntu-based Linux

Jupyter web server

IPython kernel

PS: ARM A53s

Overlays/designs

PL: ZU+ Fabric

Hardware drivers wrappedin Python libraries

Optimized for developer productivity All the Linux libraries and drivers you expect

Pre-built SD image

Ubuntu/Debian ecosystem & community

110,000,000 Google hits

Page 9: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

is a Framework

APIs

Drivers

Bitstreams

AppsJupyter/IPython

Linux kernel

Python

FPGA

Overlay

xdevcfg sysgpio uio

numpy opencvscikit-learnmatplotlib

devmem

dma

GPIOPL Interrupt

axi_intc

PYNQ notebooks

PYNQ libs

XLNK

xlnk

libsds.soMMIO

PYNQ IPs

PYNQ overlays

User designs

Page 10: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

PYNQ’s Ubuntu-based Linux

Kernel, Bootloader

Ubuntu Root File System

PYNQ’sUbuntu-based Linux

PythonPackages

Dev Tools

PYNQ uses the PetaLinux build flow and board support package:• Access to all Xilinx kernel patches• Works with any Xilinx supported board• Configured with additional drivers for PS-PL interfaces

Ubuntu/Debian

Packages

PackageManager/

Repository

PYNQ uses Ubuntu’s:• Root file system (RFS)• Package manager (apt-get)• Repositories

PYNQ bundles :• Development tools

• Cross-compilers• Latest Python packages

Page 11: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

Ubuntu-based Linux versus embedded Linux

Embedded Linux

Ubuntu-based Linux

Optimized for deployment efficiencySelective Linux libraries and drivers

Commonly delivered in flash memory on board

PetaLinux ecosystem:

143,000 Google hits

Optimized for developer productivity All the Linux libraries and drivers you expect

Pre-built SD card image

Ubuntu/Debian ecosystem & community

145,000,000 Google hits

3 orders of magnitude difference

Page 12: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

PYNQ provides Linux drivers for PS-PL i/fs …

1

1

2

5

3

34

2 4

5

wrapped in Python libraries

Page 13: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

The key of productivity is the Unified API

APIs

Drivers

IP cores

AppsJupyter/IPython

Linux kernel

pynq

FPGA

Overlay

numpy opencvscikit-learnmatplotlib

pynqmicroblaze

axi_gpio video

audio

dma

logictools

MMIO GPIO XLNKPL Interrupt

AXI-HPAXI-Lite

PYNQ notebooks

Page 14: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

Loading a design into Zynq using PYNQ

from pynq import Overlayresizer = Overlay(‘./resizer.bit’)

PYNQ automatically configures many design parametersbased on data parsed from hybrid library

1

2

3

4

5

Page 15: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

Software-style packaging & distribution of designsEnabled by new hybrid libraries

xDNN, A. Sirasao et al OpenCV, K. Denolf et alIIoT, C. Fritsch et alQNN, M. Blott et al

Download a design from GitHub with a single Python command:

pip install git+https://github.com/Xilinx/pynqDL.git

Page 16: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

Next steps: scaling across platforms and domains

AvnetUltra96

Page 17: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

How Python helps, really a lot..

Page 18: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

Ecosystem Advantage: there’s a Library for that…

CPython is written in C … and most popular C/C++ frameworks have Python libraries

Standard Python comes with comprehensive libraries for common operations (web, regex, os, etc)In addition to this ‘batteries included’ strategy, there is a massive external ecosystem …

Page 19: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

Base Python libraries used for all Use Case

A Matlab™ likeframework for numerical computing.

2D plotting library for static and interactive data visualizations

Data wrangling for easy-to-use data ingestion, transformation, and export functions

Acquire, Transform,Organize,Display

Page 20: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

What is NumPy

˃ NumPy is the fundamental package for scientific computing with Python. It contains among other things:

a powerful N-dimensional array objectsophisticated (broadcasting) functionstools for integrating C/C++ and Fortran codeuseful linear algebra, Fourier transform

˃ NumPy can also be used as:An efficient multi-dimensional container of generic data.Arbitrary data-types can be defined.This allows NumPy to seamlessly and speedily integrate with a wide variety of databases.

Page 21: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

How Numpy interacts with Programmable Logic?

Contiguous Array in DDR MemoryShared Object Physical memoryPhysical memory

Array, Matrix

Virtual memory

Xlnk

Hard Real TimeOffload CPU and OSDedicated “Accelerator”

PL

AXI

HP

Page 22: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

Provide a Numpy Array (or Arrays) with collected dataOr Pandas structure

Your Job is doneCustomer can take from it

Page 23: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

Connect other Python Libraries -

Quick Prototyping

Embedded Acceleration

OVERLAYS

RTL Acceleration

Page 24: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

BIG DATA tools for BIG DATA devices

• State-of-the-art BIG DATA analysis

• State-of-the-art BIG DATA interactive visualization

• Opportunities: ML and SDR

• Cognitive radio, etc

BIG DATA IDEBIG DATA device

JupyterLab

MathWorks

Jupyterlab

RFSoCopportunities

Page 25: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

Edge-to-cloud co-design

Common JupyterLab tooling at edge and cloud

PYNQ enables ML expertsand radio engineersto focus on their ‘value-add’

Edge-to-cloud co-design trade-offs:• Maximize on-chip processing• Minimize edge-to-cloud data exchange• Exploit scalability of cloud processing• Aggregate intelligence between and across multiple edge nodes• Co-optimize the above for best system performance

Page 26: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx>> 27

Page 27: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

New PYNQ-Z2 Board available now

• New PYNQ reference platform

• New stereo audio with on-board codec

• New Raspberry Pi connector

• Open source design

• Z2 manufactured in Taiwan by TUL

• Distributed globally by Premier Farnell

• Also Newegg in US

• Academic discounts & donations

available$119 to everyone in US

Page 28: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

PYNQ on other Boards

Page 29: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

Efficient porting PYNQ to any Zynq-based platform

PetaLinux build tools/BSP

Available for any Xilinx-supported board;Instructions for building for custom boards available1

PYNQ Software Core(board independent)

Pre-built images availableExpected to take less than 1 day to port 2

Target-specific PYNQcomponents

Board-specific portingCommon interfaces available for re-use3

Page 30: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

http://www.pynq.io

Page 31: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

© Copyright 2019 Xilinx

New open source HLS book

Reply “pp4fpgas” in wechat consolehttp://kastner.ucsd.edu/hlsbook/

Page 32: Pynq 融入 Python 生态的 Zynq 软硬件框架€¦ · • New Raspberry Pi connector • Open source design • Z2 manufactured in Taiwan by TUL • Distributed globally by Premier

Adaptable.Intelligent.

赛 灵 思 技 术 日XILINX TECHNOLOGY DAY