# AI Compiler Resources

## Knowledge

- [PyTorch 官方：torch.compile 详解](https://pytorch.org/docs/stable/torch.compiler.html)
  PyTorch 官方文档，涵盖编译入口、mode 选择、backend 切换。用于：从命令行学基础的 torch.compile 使用。

- [PyTorch 2.0 技术白皮书（arXiv:2304.04487）](https://arxiv.org/abs/2304.04487)
  Meta 团队发表的 torch.compile 设计论文。Dynamo、Inductor、Triton backend 的分层设计写得最清楚。用于：理解整个编译栈的架构动机。

- [Triton 官方文档](https://triton-lang.org/)
  OpenAI 开源的 GPU kernel 语言。torch.compile 的默认 GPU backend。用于：理解 Triton 的 block-level 编程模型和自动优化能力。

- [Apache TVM 官方文档](https://tvm.apache.org/docs/)
  TVM 全栈深度学习编译器。包含 Relay IR、AutoTVM、AutoScheduler 等内容。用于：理解 TVM 的 IR 层次和 auto-tuning 机制。

- [PyTorch 博客：torch.compile 性能调优实践（2024）](https://pytorch.org/blog/torch-compile-tuning/)
  使用 mode=max-autotune、CUDA Graphs、dynamic shapes 的实战建议。用于：榨取 torch.compile 现有方案的最佳吞吐。

## Wisdom (Communities)

- [PyTorch 论坛 — torch.compile 板块](https://discuss.pytorch.org/c/pytorch-2-0/24)
  用户讨论 torch.compile 的具体问题（graph break、NaN、memory 等）。用于：排查实战中的坑。

- [TVM Discuss 论坛](https://discuss.tvm.apache.org/)
  TVM 社区答疑。用于：确认 TVM + PyTorch 训练的最新集成状态。

- [r/MachineLearning](https://reddit.com/r/MachineLearning)
  ML 编译器和训练加速话题偶尔有高质量讨论。用于：跟踪社区对 Triton vs TVM 的观点演变。

## Gaps

- TVM 用于 PyTorch 训练的官方 benchmark 很少（多数面向推理）。需要通过 TVM Discuss 和自测来验证。
- TensorRT 的推理加速效果有大量数据，但与 torch.compile 训练的比较缺少 head-to-head benchmark。