The huge demand for computation in artificial intelligence (AI) is driving unparalleled investments in hardware and software systems for AI. This leads to an explosion in the number of specialized hardware devices, which are now offered by major cloud vendors. By hiding the low-level complexity through a tensor-based interface, tensor computation runtimes (TCRs) such as PyTorch allow data scientists to efficiently exploit the exciting capabilities offered by the new hardware. In this paper, we explore how database management systems can ride the wave of innovation happening in the AI space. We design, build, and evaluate Tensor Query Processor (TQP): TQP transforms SQL queries into tensor programs and executes them on TCRs. TQP is able to run the full TPC-H benchmark by implementing novel algorithms for relational operators on the tensor routines. At the same time, TQP can support various hardware while only requiring a fraction of the usual development effort. Experiments show that TQP can improve query execution time by up to 10$\times$ over specialized CPU- and GPU-only systems. Finally, TQP can accelerate queries mixing ML predictions and SQL end-to-end, and deliver up to 9$\times$ speedup over CPU baselines.
翻译:人工智能(AI)对计算能力的巨大需求正推动着对AI软硬件系统前所未有的投资,进而导致专用硬件设备数量激增,目前各大云服务商均已提供此类设备。通过基于张量的接口隐藏底层复杂性,PyTorch等张量计算运行时(TCR)使数据科学家能够高效利用新硬件带来的卓越能力。本文探讨了数据库管理系统如何借助AI领域的创新浪潮。我们设计、构建并评估了张量查询处理器(TQP):TQP将SQL查询转化为张量程序,并在TCR上执行。通过为张量程序库中的关系运算符实现新颖算法,TQP能够完整运行TPC-H基准测试。同时,TQP仅需常规开发工作量的一小部分即可支持多种硬件。实验表明,与专用CPU和GPU系统相比,TQP可将查询执行时间提升高达10倍。此外,TQP能端到端加速混合机器学习预测与SQL的查询,相比CPU基线方案实现最高9倍加速。