Pyls: Enabling Python Hardware Synthesis with Dynamic Polymorphism via LCRS Encoding
Python dominates AI development and is the most widely used dynamic programming language, but synthesizing its polymorphic functions into hardware remains challenging. Existing HLS solutions support only static subsets of Python, forcing CPU offload with costly communication overhead.
We present Pyls, the first framework that synthesizes dynamically polymorphic Python into monolithic hardware via Left-Child Right-Sibling (LCRS) encoding. Key to our approach is representing all Python objects as LCRS trees, enabling uniform hardware handling of dynamic types. Pyls automatically converts objects to fixed-width formats, generates XLS IR designs, and implements a tree memory architecture for efficient runtime type resolution. On FPGA platforms, Pyls demonstrates speedups of $5.19\times$ and $3.98\times$ over two ASIC CPUs, $303.29\times$ over a soft-core processor, and $282.66\times$ over a heterogeneous SoC design.