TVM: An Automated End-to-End Optimizing Compiler for Deep Learning

TVM can process graph-level and operator-level optimization.

graph-level optimization

As for the graph-level optimization, it can do operator fusion, constant folding, static memory pre-allocation, and data transformate pass.

operator fusion

Now I want emphasis operator fusion, It split the operator into 4 type:

  • injective (one on one map, e.g., add)
  • reduction
  • complex out fusable(can fuse element-wise op to output)
  • opaque(can't be fused, e.g., sort)

TVM will fuse as much as possible.

These optimization methods are very common.

Operator-level Optimization

TVM seperate schedule and compute. So it can detribute different devices. There are 3 schedule primitives in TVM, Special Memory Scope, Tensorizaiton, Latency Hiding.

  • Special Memory Scope, to utilize maxmium the shaped memory in GPU.
  • Tensorization, spliting a bigger data into micro-data to fully utiize the vectorization.
  • Latency Hiding. Overlaping the computation and transition. On CPU, it is achieving by using multi-threading or hardward prefetching. GPU relys on repid context switching of many wraps of threads.

Automating Optimization

How to find the optimal parameter is very important. It proposed a ML-based cost model, which is a gradient tree boosting model based on XGboost, to predict these prameters by giving the loop pragram in the kernel, which include the memory access count, and the resue ratio of each memory buffer, as well as one-hot encoding of loop annotation such as "vectorize", "unroll" and "parallel". As shown in the following graph, the collected data can be train the model again. So the TVM matainer will updated this model periodicly.

Consequently, TVM lowers the threshold for writing a relavely high-performance kernel. I think there are 2 points deserved us to learn more, which are the schedule primitive and the prediction model.

相关推荐
拆房老料几秒前
【第四部分:Agentic 智能体设计模式】15.为什么 Agent 也需要设计模式
人工智能·设计模式·ai·ai-native
Yan卌2 分钟前
探析全球虫害治理前沿 —— 美国 PestWorld 展会简述
大数据·运维·人工智能
HR研习社2 分钟前
绚星AI实战训练场:不只是培训平台里的一个功能
人工智能·ai陪练·企业ai陪练·企业培训平台
InternLM4 分钟前
拓宽AI物理实验版图:上海AI实验室推出“书生SCP-Lab”,端砚自主实验能力再跃升
人工智能·ai·大模型·书生大模型·ai科研
中达瑞和-高光谱·多光谱4 分钟前
以“光谱指纹”穿透塑料分选瓶颈——中达瑞和的塑料精准分选能力
人工智能·数码相机·计算机视觉
tianbin9116 分钟前
企业级AI落地,API中转站选型的核心指标有哪些?
人工智能
李福春15 分钟前
FDE进化36记-第10记-模型为什么必须可解释、可验证、可监控?
人工智能·深度学习·机器学习·shap·深圳同盟·腾讯云架构师技术同盟·evidently
腾讯数据架构师16 分钟前
一套 AI 平台怎么给多个组织隔离使用?CubeStudio 多租户隔离实操(ENABLE_MULTI_TENANT / org 组织 / 三级可见范围)
人工智能·深度学习·机器学习·云原生
驭渊的小故事18 分钟前
软件工程概念篇:需求、开发模型与测试模型全解析
人工智能·代理模式
蓝星空200020 分钟前
如何将 PDF 转换为 .md 格式的 Markdown 文件?无需上传,3 步完成
人工智能·pdf·编辑器