Deep learning (DL) compilers rely on cost models and auto-tuning to optimize tensor programs for target hardware. However, existing approaches depend on large offline datasets, incurring high collection costs and offering suboptimal transferability across platforms. In this paper, we introduce TCL, a novel efficient and transferable compiler framework for fast tensor program optimization across diverse hardware platforms to address these challenges. Specifically, TCL is built on three core enablers: (1) the RDU Sampler, a data-efficient active learning strategy that selects only 10% of tensor programs by jointly optimizing Representativeness, Diversity, and Uncertainty, substantially reducing data collection costs while maintaining near-original model accuracy; (2) a new Mamba-based cost model that efficiently captures long-range schedule dependencies while achieving a favorable trade-off between prediction accuracy and computational cost through reduced parameterization and lightweight sequence modeling; and (3) a continuous knowledge distillation framework that effectively and progressively transfers knowledge across multiple hardware platforms while avoiding the parameter explosion and data dependency issues typically caused by traditional multi-task learning. Extensive experiments validate the effectiveness of each individual enabler and the holistic TCL framework. When optimizing a range of mainstream DL models on both CPU and GPU platforms, TCL achieves, on average, 16.8x and 12.48x faster tuning time, and 1.20x and 1.13x lower inference latency, respectively, compared to Tenset-MLP.
翻译:深度学习编译器依赖代价模型和自动调优来为目标硬件优化张量程序。然而现有方法依赖大规模离线数据集,导致高昂的数据收集成本且跨平台迁移能力欠佳。本文提出TCL——一种面向不同硬件平台实现快速张量程序优化的高效可迁移编译器框架。具体而言,TCL包含三大核心组件:(1) RDU采样器——一种数据高效主动学习策略,通过联合优化代表性、多样性与不确定性仅选取10%的张量程序,在保持近原始模型精度的同时显著降低数据收集成本;(2) 基于Mamba的新型代价模型——通过参数精简与轻量化序列建模,在高效捕获长程调度依赖关系的同时,实现预测精度与计算成本之间的优化平衡;(3) 连续知识蒸馏框架——在避免传统多任务学习导致的参数爆炸与数据依赖问题的前提下,跨多硬件平台实现高效渐进式知识迁移。大量实验验证了各组件及TCL整体框架的有效性。在CPU和GPU平台上优化主流深度学习模型时,与Tenset-MLP相比,TCL平均调优速度分别提升16.8倍和12.48倍,推理延迟分别降低1.20倍和1.13倍。