一句话:通过提前记录完整 GPU 栈执行并在运行时重放,实现仅 50 KB 的可移植客户端 ML GPU 栈。
移动与嵌入式设备上部署 GPU 加速计算面临现代 GPU 栈过于复杂、难以部署且存在安全风险的问题。本文提出 GPUReplay(GR):在开发阶段提前记录完整 GPU 栈上的执行,运行时在新输入上重放这些执行;并解决重放可行性、可靠性与实用性等挑战。所得重放器可直接替换原 GPU 栈,具有 50 KB 可执行文件、长时间重放不偏离、可运行于通用 OS、TEE 与裸机、启动速度提升最多两个数量级等特点。实验表明其兼容多种集成 GPU 硬件、GPU API 和 ML 框架,并在 33 个神经网络实现上支持推理或训练。
GPUReplay (GR) is a novel way for deploying GPU-accelerated computation on mobile and embedded devices. It addresses high complexity of a modern GPU stack for deployment ease and security. The idea is to record GPU executions on the full GPU stack ahead of time and replay the executions on new input at run time. We address key challenges towards making GR feasible, sound, and practical to use. The resultant replayer is a drop-in replacement of the original GPU stack. It is tiny (50 KB of executable), robust (replaying long executions without divergence), portable (running in a commodity OS, in TEE, and baremetal), and quick to launch (speeding up startup by up to two orders of magnitude). We show that GPUReplay works with a variety of integrated GPU hardware, GPU APIs, ML frameworks, and 33 neural network (NN) implementations for inference or training. The code is available at https://github.com/bakhi/GPUReplay.