Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ print(f'Final state shape: {final_state.shape}') # [2, 32, 128, 128]
See [USAGE.md](USAGE.md) for detailed usage examples and notes.
See [the standalone kernel inventory](docs/KERNEL_VALUE.md) for the public
kernel boundary and the overlap assessment against FlashInfer and cuDNN.
The optional [cuDNN hybrid-attention runtime](docs/HYBRID_CUDNN_RUNTIME.md)
documents packed index pooling, memory-bounded DSA selection, and CP layout
ownership without precision downgrades.

## Benchmarks

Expand Down
13 changes: 13 additions & 0 deletions REPO_LAYOUT.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ cuLA/
β”‚ β”œβ”€β”€ distributed/ # Optional cuDNN KDA Kimi CP runtime
β”‚ β”‚ β”œβ”€β”€ plan.py # CPU-only packed-THD boundary planning
β”‚ β”‚ └── kda.py # Collectives and distributed autograd
β”‚ β”œβ”€β”€ hybrid/ # Layout-aware cuDNN hybrid-attention runtime
β”‚ β”‚ β”œβ”€β”€ index_pool.py # Differentiable CSA index pooling
β”‚ β”‚ β”œβ”€β”€ dsa.py # Bounded packed-THD DSA block selection
β”‚ β”‚ └── plan.py # CP block ownership and seam-halo plans
β”‚ β”‚
β”‚ β”œβ”€β”€ lightning/ # [non-KDA] Lightning Attention public wrappers
β”‚ β”‚
Expand Down Expand Up @@ -48,6 +52,13 @@ cuLA/
β”‚ └── experimental/ # [non-KDA] unwired prototypes
β”‚
β”œβ”€β”€ benchmarks/ # Accuracy and performance runners
β”‚ └── large_cp_emulation/ # Logical CP-on-fewer-GPUs simulation layer
β”‚ β”œβ”€β”€ topology.py # Logical/physical rank separation
β”‚ β”œβ”€β”€ transport.py # Native-CP protocol cost emulation
β”‚ β”œβ”€β”€ workload.py # Packed-THD workload descriptions
β”‚ β”œβ”€β”€ bench_components.py # DSA and ring microbenchmarks
β”‚ β”œβ”€β”€ bench_kda.py # KDA logical-CP E2E
β”‚ └── bench_hybrid.py # KDA + DSA serial/overlap E2E
β”œβ”€β”€ tests/ # CPU registry tests and architecture-marked GPU tests
β”œβ”€β”€ docs/ # Pipeline and backend-dispatch design notes
β”œβ”€β”€ scripts/build_wheel.sh
Expand All @@ -61,6 +72,8 @@ cuLA/
|-----------|----------|-------------|
| `cula/kernels/` | Python | Framework-independent public surface and static kernel inventory. Imports are lazy and do not compile kernels. |
| `cula/kda/` | Python / CuTeDSL | KDA prefill/decode wrappers and the pure-CuTeDSL SM100 modular composition. `kda_prefill` calls FlashKDA directly without a native fallback. See [`cula/kda/README.md`](cula/kda/README.md). |
| `cula/hybrid/` | Python | Optional cuDNN-backed composition layer for packed index pooling, bounded DSA selection, and CP layout planning. See [`docs/HYBRID_CUDNN_RUNTIME.md`](docs/HYBRID_CUDNN_RUNTIME.md). |
| `benchmarks/large_cp_emulation/` | Python | Benchmark-only logical-CP layer built on the native `cula.distributed` and `cula.hybrid` APIs; it never participates in production imports. |
| `cula/ops/kda/` | Python (CuTeDSL) | CuTeDSL KDA kernels organized into SM100 modular kernels, SM90 FlashKDA K1+K2 and intracard CP, decode, and experimental code. |
| `cula/ops/lightning/` Β· `cula/ops/experimental/` | Python (CuTeDSL) | `[non-KDA]` Lightning/linear-attention kernels and prototypes. Lightning prefill dispatches to the SM90 or SM100 backend from Q's device capability. |
| `cula/ops/{inv,ptx}.py` Β· `cula/ops/sm100/ptx.py` | Python | Shared low-level helpers used across operators. |
15 changes: 15 additions & 0 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ This document provides usage notes and examples for cuLA kernels.

---

## cuDNN hybrid index pooling and DSA selection

The optional hybrid runtime preserves packed THD layouts between cuDNN index
pooling and DSA selection. It owns static metadata and bounded scratch, while
cuDNN owns the fused kernels and precision contract. Install it with:

```bash
pip install 'cuda-linear-attention[cudnn-hybrid]'
```

See [`docs/HYBRID_CUDNN_RUNTIME.md`](docs/HYBRID_CUDNN_RUNTIME.md) for the API,
128K heterogeneous/CP4 measurements, and current implementation boundary.

---

## cuDNN KDA Kimi context parallelism

The optional distributed runtime executes cuDNN KDA over contiguous packed-THD
Expand Down
18 changes: 18 additions & 0 deletions benchmarks/bench_hybrid_cp_emulation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2025-2026 Ant Group Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
# ruff: noqa: E402, I001

"""Compatibility entry point for large-CP component emulation."""

from __future__ import annotations

import pathlib
import sys

sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent.parent))

from benchmarks.large_cp_emulation.bench_components import main


if __name__ == "__main__":
main()
18 changes: 18 additions & 0 deletions benchmarks/bench_hybrid_kda_dsa_e2e.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2025-2026 Ant Group Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
# ruff: noqa: E402, I001

"""Compatibility entry point for the large-CP hybrid emulator."""

from __future__ import annotations

import pathlib
import sys

sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent.parent))

from benchmarks.large_cp_emulation.bench_hybrid import main


if __name__ == "__main__":
main()
Loading
Loading