PyTPU: Migration of Python Code for Heterogenous Acceleration with Automated Test Generation

Arghya Kundu,Uyen Trang Nguyen
DOI: https://doi.org/10.1109/BCD57833.2023.10466329
2023-12-14
Abstract:Software applications are increasingly built to take advantage of heterogeneous architectures as specialised hardware accelerators take centre stage in today’s computing environment. Tensor processing units (TPUs), the latest hardware addition, have demonstrated orders of magnitude improvement in computing efficiency over CPUs and GPUs for heterogeneous deep learning applications. However, despite the trend of incorporating heterogeneity and specialization in hardware, the creation of heterogeneous applications is confined to a handful of engineers. We propose a framework called PyTPU that takes Python code written in the PyTorch framework as input and automatically migrates it to its TPU compatible counterpart with test behaviour preservation and increased performance. First, PyTPU generates unit test cases to ensure test behavior compatibility. Second, using the abstract syntax tree and a manually curated exhaustive knowledge base, PyTPU migrates the original code to its TPU compatible version. Finally, PyTPU ensures the migrated code is readable and maintainable by adding necessary comments and conforming to PEP8 standard if needed. We evaluated PyTPU on four real-world Python applications with TPU v2 kernels. On average the migrated heterogeneous code is 19.103% faster than the original code while safeguarding test behavior preservation.
Computer Science,Engineering
What problem does this paper attempt to address?