Fast Machine Learning for Science Conference 2024
Purdue University
10/16/2024
An open platform for in-situ high-speed computer vision with hls4ml
Background and prerequisite work
2
Credit: Dr. Josh Agar
An open platform for in-situ high-speed computer vision
3
hls4ml 4 FG wrapper
hls4ml 4 FG wrapper
© euresys
Tutorials
4
Not one… but TWO tutorials to get you started:
PR & hls4ml Demo
5
Already released
In the works:
6
An open platform for in-situ high-speed computer vision with hls4ml
Existing applications
Future work
Conclusion
Thanks!
Acknowledgements
7
Supported by US DOE Grant DE-FG02-86ER53222, DE-SC0022234, and US DOE ASCR under the “Real-time Data Reduction Codesign at the Extreme Edge for Science” Project (DE-FOA-0002501).
Ryan F. Forelli1,2,3, Nhan Tran1,3 Josh C. Agar4 Yumou Wei5, Chris Hansen5, Jeffrey Levesque5,
Michael Cyros6 Eric Janssen6 Paulo Possa6 Benoît Trémérie6
1Fermi National Accelerator Laboratory, Batavia, IL
2Lehigh University, Bethlehem, PA
3Northwestern University, Evanston, IL
4Drexel University, Philadelphia, PA
5Columbia University, New York City, NY
6Euresys S.A., Seraing, Belgium
Advisor: Professor Seda Ogrenci
Appendix A
Design verification|firmware
128
32
CNN
sine[10:0]
cosine[10:0]
Host PC
32
32
9
Pipelining exposure/readout and inference
10
Exposure/readout pipelined with inference
Additional challenges and inefficiencies
0
1
2
3
4
5
6
7
0
1
2
3
4
5
6
7
Expected image
Received image
Fusion Project|Constraints & Optimization
12
Optimization | Beneficiary |
Quantization aware training (32b → 7b) | Resources |
Pruning | Resources |
Strategy optimized by layer | Resources, Latency |
Reuse factor optimized by layer (see right) | Resources, Latency |
Dataflow pipelining (see appendix) | Latency |
Batched input streaming | Latency |
Target period, clock unc., & Vivado version scanned | Timing |
ReLUs merged | Latency |
Synthesis & routing strategies scanned | Timing |
Physical optimization looping | Timing |
Inference latency: 7.7us
Total latency: 17.6us
Throughput: 100kfps
Fusion|Implementation Results
Fusion|Conv2D Parallelization
17
17
32
32
conv_0_0
conv_0_1
relu_0_0
relu_0_1
Rearrange
Split
450:450
to
480:420
pool_0_0
pool_0_1
32x17x1
Recombine
30x15x16
30x15x16
30x15x16
30x15x16
32x17x1
30x16x16
30x14x16
15x15x16
15x8x16
15x7x16
+---------------------------+------------------------+------+------+------+------+----------+
| | | Latency | Interval | Pipeline |
| Instance | Module | min | max | min | max | Type |
+---------------------------+------------------------+------+------+------+------+----------+
|conv_2d_cl_1_U0 |conv_2d_cl_1 | 434| 434| 434| 434| none |
|conv_2d_cl_2_U0 |conv_2d_cl_2 | 909| 909| 909| 909| none |
|dense_2_U0 |dense_2 | 61| 62| 61| 62| none |
|relu_U0 |relu | 2| 2| 1| 1| function |
|dense_U0 |dense | 103| 103| 103| 103| none |
|dense_1_U0 |dense_1 | 88| 89| 88| 89| none |
|conv_2d_cl_U0 |conv_2d_cl | 1034| 1034| 1034| 1034| none |
|relu_1_U0 |relu_1 | 2| 2| 1| 1| function |
|relu_2_U0 |relu_2 | 20| 20| 20| 20| none |
|pooling2d_avg_cl_par_6_U0 |pooling2d_avg_cl_par_6 | 521| 521| 521| 521| none |
|pooling2d_avg_cl_par_5_U0 |pooling2d_avg_cl_par_5 | 521| 521| 521| 521| none |
|pooling2d_avg_cl_par_4_U0 |pooling2d_avg_cl_par_4 | 521| 521| 521| 521| none |
|pooling2d_avg_cl_par_3_U0 |pooling2d_avg_cl_par_3 | 521| 521| 521| 521| none |
|pooling2d_avg_cl_par_2_U0 |pooling2d_avg_cl_par_2 | 521| 521| 521| 521| none |
|pooling2d_avg_cl_par_1_U0 |pooling2d_avg_cl_par_1 | 521| 521| 521| 521| none |
|pooling2d_avg_cl_par_U0 |pooling2d_avg_cl_par | 521| 521| 521| 521| none |
|pooling2d_avg_cl_par_7_U0 |pooling2d_avg_cl_par_7 | 521| 521| 521| 521| none |
|pooling2d_cl_U0 |pooling2d_cl | 21| 21| 21| 21| none |
|relu_4_U0 |relu_4 | 904| 904| 904| 904| none |
|relu_3_U0 |relu_3 | 173| 173| 173| 173| none |
|pooling2d_cl_2_U0 |pooling2d_cl_2 | 905| 905| 905| 905| none |
|pooling2d_cl_1_U0 |pooling2d_cl_1 | 174| 174| 174| 174| none |
|myproject_Loop_INPUT_U0 |myproject_Loop_INPUT | 258| 258| 258| 258| none |
|myproject_Loop_POOL_U0 |myproject_Loop_POOL_s | 1026| 1026| 1026| 1026| none |
+---------------------------+------------------------+------+------+------+------+----------+