Skip to main content

Cain: Automatic Code Generation for Simultaneous Convolutional Kernels on Focal-plane Sensor-processors

  • Conference paper
  • First Online:
Languages and Compilers for Parallel Computing (LCPC 2020)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 13149))


Focal-plane Sensor-processors (FPSPs) are a camera technology that enable low power, high frame rate computation, making them suitable for edge computation. Unfortunately, these devices’ limited instruction sets and registers make developing complex algorithms difficult. In this work, we present Cain, an open-source compiler that targets SCAMP-5, a general-purpose FPSP – which generates code from multiple convolutional kernels. As an example, given the convolutional kernels for an MNIST digit recognition neural network, Cain produces code that is half as long, when compared to the other available compilers for SCAMP-5.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
EUR 32.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
USD 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others


  1. 1.

    Single-entry matrix. Not to be confused with identity matrix.

  2. 2.


  1. Abadi, M., et al.: Tensorflow: a system for large-scale machine learning. In: 12th USENIX Symposium on Operating Systems Design and Implementation OSDI 16, pp. 265–283 (2016)

    Google Scholar 

  2. Barthels, H., Psarras, C., Bientinesi, P.: Linnea: Automatic generation of efficient linear algebra programs (2019).

  3. Bose, L., Chen, J., Carey, S.J., Dudek, P., Mayol-Cuevas, W.: Visual odometry for pixel processor arrays. In: 2017 IEEE International Conference on Computer Vision (ICCV), pp. 4614–4622 (October 2017)

    Google Scholar 

  4. Bose, L., Chen, J., Carey, S.J., Dudek, P., Mayol-Cuevas, W.: A camera that CNNs: towards embedded neural networks on pixel processor arrays. In: Proceedings of the IEEE International Conference on Computer Vision (ICCV), pp. 1335–1344 (2019)

    Google Scholar 

  5. Carey, S.J., Barr, D.R.W., Wang, B., Lopich, A., Dudek, P.: Locating high speed multiple objects using a SCAMP-5 vision-chip. In: 2012 13th International Workshop on Cellular Nanoscale Networks and their Applications, pp. 1–2 (August 2012)

    Google Scholar 

  6. Carey, S.J., Lopich, A., Barr, D.R.W., Wang, B., Dudek, P.: A 100,000 fps vision sensor with embedded 535GOPS/W \(256\times 256\) SIMD processor array. In: 2013 Symposium on VLSI Circuits, pp. C182–C183 (2013)

    Google Scholar 

  7. Chandra, A., Chattopadhyay, S.: Design of hardware efficient FIR filter: a review of the state-of-the-art approaches. Eng. Sci. Technol. Int. J. 19(1), 212–226 (2016)

    Google Scholar 

  8. Chen, J.: scamp5 kernel api macro analog.hpp file reference (January 2020).

  9. Chen, Y.H., Krishna, T., Emer, J.S., Sze, V.: Eyeriss: an energy-efficient reconfigurable accelerator for deep convolutional neural networks. IEEE J. Solid-State Circuits 52(1), 127–138 (2016)

    Article  Google Scholar 

  10. Debrunner, T., Saeedi, S., Bose, L., Davison, A.J., Kelly, P.H.J.: Camera tracking on focal-plane sensor-processor arrays (2019)

    Google Scholar 

  11. Debrunner, T., Saeedi, S., Kelly, P.H.J.: AUKE: automatic kernel code generation for an analogue SIMD focal-plane sensor-processor array. ACM Trans. Archit. Code Optim. 15(4), 59:1–59:26 (2019)

    Google Scholar 

  12. Guillard, B.: CNNs-on-FPSPs (May 2019).

  13. LeCun, Y., Bottou, L., Bengio, Y., Haffner, P.: Gradient-based learning applied to document recognition. Proc. IEEE 86(11), 2278–2324 (1998)

    Article  Google Scholar 

  14. Martel, J.: Unconventional Processing with Unconventional Visual Sensing. Ph.D. thesis, Institut National des Sciences Appliquées de Lyon (2019)

    Google Scholar 

  15. Martel, J.N.P., Müller, L.K., Carey, S.J., Dudek, P., Wetzstein, G.: Neural sensors: learning pixel exposures for HDR imaging and video compressive sensing with programmable sensors. IEEE Trans. Pattern Anal. Mach. Intell. 42(7), 1642–1653 (2020)

    Article  Google Scholar 

  16. Murai, R., Saeedi, S., Kelly, P.H.J.: BIT-VO: visual odometry at 300 FPS using Binary features from the focal plane. In: IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS) (2020)

    Google Scholar 

  17. Saeedi, S., Bodin, B., Wagstaff, H., et al.: Navigating the landscape for real-time localization and mapping for robotics and virtual and augmented reality. Proc. IEEE 106(11), 2020–2039 (2018)

    Article  Google Scholar 

  18. Stow, E.: Automatic Code Generation for Simultaneous Convolutional Kernels on Cellular Processor Arrays. Master’s thesis, Imperial College London (2020).

  19. Stow, E., Murai, R.: ed741/cain: 3.0-experiments.1 (August 2020).

  20. Wong, M.Z., Guillard, B., Murai, R., Saeedi, S., Kelly, P.H.J.: AnalogNet: Convolutional Neural Network Inference on Analog Focal Plane Sensor Processors. arXiv preprint arXiv:2006.01765 (2020)

  21. XIMEA: xiB - PCI Express Cameras with high speed and resolution.

  22. Zarándy, Á.: Focal-Plane Sensor-Processor Chips. SpringerLink : Bücher, Springer, New York (2011).

Download references


We would like to thank Piotr Dudek, Stephen J. Carey, and Jianing Chen at the University of Manchester for kindly providing access to SCAMP-5, and their support in our work. This work was partially supported by the EPSRC, grant reference EP/P010040/1.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Edward Stow .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Stow, E., Murai, R., Saeedi, S., Kelly, P.H.J. (2022). Cain: Automatic Code Generation for Simultaneous Convolutional Kernels on Focal-plane Sensor-processors. In: Chapman, B., Moreira, J. (eds) Languages and Compilers for Parallel Computing. LCPC 2020. Lecture Notes in Computer Science(), vol 13149. Springer, Cham.

Download citation

  • DOI:

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-95952-4

  • Online ISBN: 978-3-030-95953-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics