FastAttention: Extend FlashAttention2 to NPUs and Low-resource GPUs