Skip to content

[Feat] [NPU] attention: Bundle INT8 CSA KV operators for Ascend A3 - #1108

Open
AndyLi429 wants to merge 2 commits into
sgl-project:mainfrom
AndyLi429:codex/dsv41-a3-int8-csa
Open

AndyLi429 wants to merge 2 commits into
sgl-project:mainfrom
AndyLi429:codex/dsv41-a3-int8-csa

Conversation

@AndyLi429

Copy link
Copy Markdown
Contributor

Summary

Add an opt-in CANN 9.2.0 operator bundle for signed INT8 CSA KV records on Ascend A3. The SGLang integration is tracked in sgl-project/sglang#53499.

  • Build KvCompressEpilog, MixedQuantSparseFlashMlaMetadata, and MixedQuantSparseFlashMla for arch22 from the pinned CANN source. Stage the bundle in a separate vendor directory and isolate its Torch namespace and JIT extension names.
  • Expose int8_csa_write, int8_csa_metadata, int8_csa_attention, and check_int8_csa_support from sgl_kernel_npu.operators.attention.
  • Let callers reserve page zero on writes while keeping fixed tensor shapes. Normalize the optional attention sink at the operator boundary.

Enable the bundle by adding ops_transformer_int8_csa to the existing A3 wheel's third-party profiles.

Validation

  • Three wrapper tests passed for reserved-page writes, empty writes, and metadata/attention dispatch.
  • The public startup probe passed on Ascend910_9362 with CANN 9.2.0 B052 and Torch/torch_npu 2.13.0.
  • Native C1 and C2 write, metadata, and attention smoke passed with 64 Q heads. Both paths returned 1024 INT32 metadata entries. Maximum absolute attention errors against an FP64 reference over the written quantized pages were 0.00646 and 0.00783, respectively.
  • Native validation used a previously built A3 wheel with the pinned CANN vendor and the updated Python wrappers staged in an isolated directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant