How deepseek-ai/deepgemm-ascend works
DeepGEMM Ascend is a Python-accessible C++/Ascend kernel library for low-precision matrix operations and inference workloads. The principal workflow is Python caller → registered C++ API → operation-specific kernel/JIT runtime → Ascend execution. Its distinct capabilities include dense and grouped GEMM, attention logits, MegaMoE, Mega mHC/MegaGate, scaling-factor layout transforms, ACLNN reference operations, and experimental model kernels. The README documents these capabilities; unsampled kernel internals and optional integrations are represented conservatively where call paths are not shown.
Main entry points: python_api.cpp C++ extension · jit.hpp JIT runtime · gemm.hpp GEMM APIs · attention.hpp Attention logits
Components 19
Python interface
- C++ extension
csrc/python_api.cpp - Python package
deep_gemm/__init__.py
Compute APIs
- GEMM APIs
csrc/apis/gemm.hpp - Einsum APIs
csrc/apis/einsum.hpp - Attention logits
csrc/apis/attention.hpp - ACLNN references
csrc/apis/aclnn.hpp
JIT runtime
- JIT runtime
csrc/jit/jit.hpp - Kernel selection
csrc/jit_kernels/heuristics.hpp - GEMM kernels
csrc/jit_kernels
Inference features
- MegaMoE
csrc/apis/mega_moe.hpp - Mega mHC
csrc/apis/mega_mhc.hpp - MegaGate
csrc/apis/mega_gate.hpp - Experimental kernels
csrc/experimental - HC prenorm
deep_gemm/tilelang_ops/hc_prenorm.py
Layouts and references
- Layout transforms
csrc/apis/layout.hpp - Tensor layout utilities
csrc/utils/layout.hpp - Runtime controls
csrc/apis/runtime.hpp - Collective buffers
csrc/backends/hccl.hpp
Other components
- Python caller
Connections 24
- Python caller → Python package: calls
README.md - Python package → C++ extension: imports
deep_gemm/__init__.py - C++ extension → GEMM APIs: registers
csrc/python_api.cpp - C++ extension → Einsum APIs: registers
csrc/python_api.cpp - C++ extension → Attention logits: registers
csrc/python_api.cpp - C++ extension → ACLNN references: registers
csrc/python_api.cpp - C++ extension → MegaMoE: registers
csrc/python_api.cpp - C++ extension → Mega mHC: registers
csrc/python_api.cpp - C++ extension → MegaGate: registers
csrc/python_api.cpp - C++ extension → Experimental kernels: registers
csrc/python_api.cpp - C++ extension → Runtime controls: registers
csrc/python_api.cpp - GEMM APIs → GEMM kernels: dispatches
csrc/apis/gemm.hpp - GEMM APIs → Kernel selection: selects
- Einsum APIs → GEMM APIs: uses
csrc/apis/einsum.hpp - Attention logits → JIT runtime: launches
- GEMM APIs → JIT runtime: compiles
- MegaMoE → Collective buffers: uses buffers
csrc/apis/mega_moe.hpp - MegaMoE → JIT runtime: compiles
csrc/apis/mega_moe.hpp - Mega mHC → JIT runtime: compiles
- MegaGate → JIT runtime: compiles
- Experimental kernels → JIT runtime: compiles
csrc/experimental/v41f_qkv_lora.hpp - Layout transforms → Tensor layout utilities: uses
- Attention logits → Tensor layout utilities: validates
csrc/apis/attention.hpp - HC prenorm → Python caller: called by