arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.01960cs.LGcs.AI
收藏

TiledAttention: 一种用于PyTorch的CUDA瓷砖SDPA内核

TiledAttention: a CUDA Tile SDPA Kernel for PyTorch

Helmholtz Centre for Environmental Research - UFZ(环境保护研究霍普夫研究所)

Taimur Khan

AI总结:

TiledAttention是一种基于SDPA的注意力机制,通过cuTile Python实现,提供可编辑的调度层面,实现高性能和可定制化的平衡。

摘要:

TiledAttention是一种针对NVIDIA GPU的SDPA前向操作符,采用cuTile Python(TileIR)实现并作为PyTorch可调用函数暴露。它比低级CUDA模板更易于修改,同时通过在线softmax和瓷砖$K,V$流式传输保留现实行为。算法上,TiledAttention遵循已建立的FlashAttention式在线softmax公式;我们的创新点在于cuTile/TileIR实现策略、调度层面的可修改性以及可重复的基准测试/性能分析工作流程。该方法在性能和直接编辑调度层面(如瓷砖形状、 staging、共享内存布局)上都表现良好,使无需模板重写即可快速、可重复地进行内核研究。我们使用可重复的Harness在NVIDIA DGX GB10节点上基准测试TiledAttention,并与PyTorch SDPA(自动调度)、显式解耦基线(torch_sdpa_math、标准急躁注意力)以及强制后端探针(FlashAttention2、EffecientAttention、CuDNN Attention)在序列长度、头维度和精度(FP16/BF16)上进行比较。虽然生产融合基线在整体上仍更强,但TiledAttention在标准急躁注意力路径上提供了显著的加速,并可在PyTorch工作流程中直接使用,提供了性能和可定制化的实用平衡。

英文摘要:

TiledAttention is a scaled dot-product attention (SDPA) forward operator for SDPA research on NVIDIA GPUs. Implemented in cuTile Python (TileIR) and exposed as a PyTorch-callable function, it is easier to modify than low-level CUDA templates while retaining realistic behavior via online softmax and tiled $K,V$ streaming. Algorithmically, TiledAttention follows the established FlashAttention-style online-softmax formulation; our novelty is the cuTile/TileIR implementation strategy, schedule-level modifiability, and reproducible benchmarking/profiling workflow. The approach is both performant and directly editable at the schedule level from Python (tile shapes, staging, shared-memory layout), enabling rapid, reproducible kernel research without template-heavy CUDA/CUTLASS rewrites. We benchmark TiledAttention on an NVIDIA DGX GB10 node with a reproducible harness and compare against PyTorch SDPA (auto-dispatch), explicit unfused baselines (torch_sdpa_math, standard eager attention), and forced backend probes (FlashAttention2, EffecientAttention, CuDNN Attention) across sequence length, head dimension, and precision (FP16/BF16). While production fused baselines remain stronger overall, TiledAttention delivers large speedups over standard eager attention paths and is available for direct use within PyTorch workflows, providing a practical balance between performance and customizability.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑