오픈 소스 컴파일러 도구로 AMD XDNA NPU 프로그래밍하기: FlashAttention 사례 연구
Programming AMD XDNA NPUs with Open-source Compiler Tools: A FlashAttention Case Study
한국어 초록
AMD XDNA와 같은 공간(spatial) NPU는 연산 타일을 작은 로컬 메모리 옆에 배치하고, 타일 간 데이터 이동은 소프트웨어에 맡긴다. 이러한 장치에 다단계 워크로드를 매핑하는 일은 대체로 중간 텐서를 어디에 둘지의 문제다. FlashAttention에 대해 오픈 소스 IRON 및 MLIR-AIR 플로우로 이러한 선택을 내리며 얻은 교훈을 보고한다. XDNA 1과 XDNA 2에서 네 가지 참조 설계를 비교한다: 하나는 각 연산자를 따로 실행하고, 둘은 칩 위에서 연산자 간 스트리밍을 하며, 하나는 세 어텐션 단계를 모두 단일 커널로 융합한다. 융합 커널은 $\boldsymbol{QK}^{\mathsf T}$ 점수를 연산 타일 로컬 메모리에 보관하고 cascade interconnect를 통해 부분 결과를 축약하므로, 점수가 공유 MemTile 메모리로 돌아가지 않는다. XDNA 2에서 완전한 end-to-end 실행 기준 3.62 TFLOP/s에 도달하며, IRON 설계의 2배이고, 2K 토큰 이상에서 동일 칩의 통합 GPU 대비 5.3~7.2배의 에너지 효율을 보인다. BERT부터 DeepSeek까지 12가지 대규모 언어 모델(LLM) 구성을 최대 128K 토큰까지 다룬다. 각 메모리 수준에서의 Roofline 분석이 이 결과를 설명하고 언제 멈출지를 보여 준다. XDNA 1은 ridge point가 더 낮아, 칩 위 스트리밍만으로 이미 compute-bound 영역에 도달한다: XDNA 2에서 처리량을 두 배로 만드는 동일한 융합은 XDNA 1에서는 거의 낭비에 가깝다. 매핑의 operational intensity를 각 수준의 ridge point와 비교하면 코드를 작성하기 전에 어떤 경우에 해당하는지 예측할 수 있다. 매핑이 해당 ridge point를 넘을 때까지 융합하고, 그다음 멈춘다. 참조 설계를 유지 관리되는 오픈 소스로 공개한다.
원문 초록
Spatial NPUs such as AMD XDNA place compute tiles beside small local memories and leave data movement between them to software. Mapping a multi-stage workload onto such a device is largely a question of where the intermediate tensors live. We report what we learned making those choices for FlashAttention with the open-source IRON and MLIR-AIR flows. We compare four reference designs on XDNA 1 and XDNA 2: one runs each operator separately, two stream between operators on chip, and one fuses all three attention stages into a single kernel. The fused kernel holds the $\boldsymbol{QK}^{\mathsf T}$ scores in compute-tile local memory and reduces partial results over the cascade interconnect, so the scores never return to shared MemTile memory. On XDNA 2, it reaches 3.62 TFLOP/s over complete end-to-end execution, twice the IRON design, with 5.3 to 7.2 times the energy efficiency of the integrated GPU on the same chip at 2K tokens and above. It covers twelve LLM configurations, from BERT to DeepSeek, up to 128K tokens. Roofline analysis at each memory level explains this result and shows when to stop. XDNA 1 has lower ridge points, so streaming on chip already reaches the compute-bound regime: the same fusion that doubles throughput on XDNA 2 is nearly wasted on XDNA 1. Comparing a mapping's operational intensity against each level's ridge point predicts which case applies before writing any code. Fuse until the mapping clears that ridge point, then stop. We release the reference designs as maintained open source.
제출 이력
확인된 버전만 표시합니다. 전체 제출 이력은 arXiv 원문에서 확인하세요.
- arXiv:2609.21264v1제출 시각 미확인
함께 살펴볼 논문
공통 태그를 근거로 연결했습니다. 실제 인용 관계나 논문의 우수성을 뜻하지 않습니다.
공통 태그로 연결된 공개 논문이 아직 없습니다.
토론
이 논문과 연결된 포럼 글이 아직 없습니다.