Skip to content

附:主流编译器

XLA (XLA: Accelerated Linear Algebra)

  • 主要维度:依赖拓扑 + 数据布局 + 跨层优化
  • 核心融合技术
    • HLO Fusion (Vertical/Horizontal)
    • Layout Assignment
    • Buffer Assignment
  • 适用场景:TensorFlow, JAX 训练/推理
  • 链接XLA Documentation

TVM (Tensor Virtual Machine)

  • 主要维度:全维度覆盖
  • 核心融合技术
    • Tensor Expression Fusion
    • Auto-scheduling (AutoTVM/Ansor)
    • Multi-level Tiling
  • 适用场景:跨硬件部署
  • 链接TVM GitHub

TensorRT

  • 主要维度:硬件适配 + 模式融合
  • 核心融合技术
    • Layer Fusion
    • INT8 Calibration
    • Kernel Auto-tuning
  • 适用场景:NVIDIA GPU 推理
  • 链接TensorRT Documentation

Triton

  • 主要维度:内存层次 + 并行性
  • 核心融合技术
    • Block-level Programming
    • Tile-based Fusion
    • Auto-tuning
  • 适用场景:GPU 自定义 kernel 开发
  • 链接Triton GitHub

MLIR (Multi-Level Intermediate Representation)

  • 主要维度:多级抽象 + 跨层优化
  • 核心融合技术
    • Linalg Fusion
    • Affine Loop Fusion
    • Progressive Lowering
  • 适用场景:编译器基础设施
  • 链接MLIR GitHub

TorchInductor

  • 主要维度:依赖拓扑 + 动态性
  • 核心融合技术
    • Graph Pattern Matching
    • Triton Codegen
    • Dynamic Shape Support
  • 适用场景:PyTorch 2.0 推理/训练
  • 链接PyTorch 2.0 Inductor

CANN (Compute Architecture for Neural Networks)

  • 主要维度:硬件适配 + 内存层次
  • 核心融合技术
    • TBE (Tensor Boost Engine): 基于 TVM 改良的 DSL 编译器
    • UB Automatic Tiling: 针对 Unified Buffer 的自动切分
    • Fractal Format Support: 原生支持 NC1HWC0/ZnZ 布局
  • 适用场景:Huawei Ascend NPU 训练/推理
  • 链接Ascend CANN Documentation

参考资料

  1. MLIR Documentation
  2. Linalg Dialect
  3. Affine Dialect
  4. GPU Dialect
  5. IREE Compiler
  6. FlashAttention: Fast and Memory-Efficient Exact Attention
  7. Megatron-LM: Training Multi-Billion Parameter Language Models
  8. Ascend CANN

Released under the CC BY-NC-ND 4.0 License.