[Attentions][Fix] Rename block sparse attention - #571
Conversation
There was a problem hiding this comment.
Code Review
This pull request renames the block_sparse_attention module and its associated classes, functions, and files to ada_block_sparse_attention across the codebase. It also introduces a new attentions build option in build.sh. The feedback suggests improving the build script by introducing an ONLY_BUILD_ATTENTIONS_MODULE variable to maintain consistency with other existing 'only build' options, enhancing readability and maintainability.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Description
Rename
aclnnBlockSparseAttentiontoaclnnAdaBlockSparseAttentionas specified in MindIE-SD.Add an option to build only the
attentionsmodule.Motivation
Operator name
aclnnBlockSparseAttentioninsgl-kernel-npuconflicts with CANN version >= 9.0.0; using block sparse attention backend insglangwith a pre-build package may lead to runtime error.Environment:
How to reproduce
sglang generate --model-path Wan-AI/Wan2.2-T2V-A14B-Diffusers --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." --height 720 --width 1280 --tp-size 4 --sp-degree 2 --num-gpus 8 --num-frames 81 --num-inference-steps 40 --port 30088 --dit-cpu-offload False --attention-backend "block_sparse_attn" --attention-backend-config "sparsity=0.9,skip_first_steps=0"Logs:
The line "The inputLayout attrs only support TND/BNSD." indicates using operator from CANN and can be found here:
https://gitcode.com/cann/ops-transformer/blob/9.0.0/attention/block_sparse_attention/op_host/block_sparse_attention_tiling.cpp line 180.