tileops 0.0.1.dev1__tar.gz → 0.0.1.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. tileops-0.0.1.dev2/PKG-INFO +147 -0
  2. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/pyproject.toml +2 -1
  3. tileops-0.0.1.dev2/tileops.egg-info/PKG-INFO +147 -0
  4. tileops-0.0.1.dev1/PKG-INFO +0 -26
  5. tileops-0.0.1.dev1/tileops.egg-info/PKG-INFO +0 -26
  6. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/LICENSE +0 -0
  7. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/README.md +0 -0
  8. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/setup.cfg +0 -0
  9. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/setup.py +0 -0
  10. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/tests/test_bitnet.py +0 -0
  11. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/tests/test_blocksparse_attention.py +0 -0
  12. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/tests/test_gqa.py +0 -0
  13. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/tests/test_gqa_decode.py +0 -0
  14. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/tests/test_linear_attn_fused_chunk.py +0 -0
  15. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/tests/test_linear_attn_fused_recurrent.py +0 -0
  16. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/tests/test_mamba_chunk_scan.py +0 -0
  17. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/tests/test_mamba_chunk_state.py +0 -0
  18. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/tests/test_mha.py +0 -0
  19. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/tests/test_mha_decode.py +0 -0
  20. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/tests/test_mla.py +0 -0
  21. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/tests/test_sparse_mla.py +0 -0
  22. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/tileops.egg-info/SOURCES.txt +0 -0
  23. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/tileops.egg-info/dependency_links.txt +0 -0
  24. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/tileops.egg-info/requires.txt +0 -0
  25. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/tileops.egg-info/top_level.txt +0 -0
  26. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/top/__init__.py +0 -0
  27. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/top/kernel/__init__.py +0 -0
  28. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/top/kernel/bitnet.py +0 -0
  29. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/top/kernel/blocksparse_attention.py +0 -0
  30. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/top/kernel/gqa.py +0 -0
  31. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/top/kernel/linear_attention/__init__.py +0 -0
  32. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/top/kernel/linear_attention/linear_attn.py +0 -0
  33. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/top/kernel/mamba_chunk_scan.py +0 -0
  34. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/top/kernel/mamba_chunk_state.py +0 -0
  35. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/top/kernel/mha.py +0 -0
  36. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/top/kernel/mla.py +0 -0
  37. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/top/kernel/sparse_mla.py +0 -0
  38. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/top/utils/__init__.py +0 -0
  39. {tileops-0.0.1.dev1 → tileops-0.0.1.dev2}/top/utils/utils.py +0 -0
@@ -0,0 +1,147 @@
1
+ Metadata-Version: 2.4
2
+ Name: tileops
3
+ Version: 0.0.1.dev2
4
+ Summary: TileOPs kernels for efficient inference
5
+ Author: Tile-AI
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.8
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: torch>=2.1.0
11
+ Requires-Dist: numpy>=1.23.5
12
+ Requires-Dist: einops>=0.6.0
13
+ Requires-Dist: Cython
14
+ Requires-Dist: tqdm>=4.62.3
15
+ Requires-Dist: typing_extensions>=4.10.0
16
+ Requires-Dist: cloudpickle
17
+ Requires-Dist: ml_dtypes
18
+ Requires-Dist: psutil
19
+ Requires-Dist: tilelang>=0.1.6.post1
20
+ Provides-Extra: dev
21
+ Requires-Dist: yapf==0.40.2; extra == "dev"
22
+ Requires-Dist: toml==0.10.2; extra == "dev"
23
+ Requires-Dist: tomli==2.0.1; extra == "dev"
24
+ Requires-Dist: ruff==0.6.5; extra == "dev"
25
+ Requires-Dist: codespell==2.3.0; extra == "dev"
26
+ Requires-Dist: clang-format==15.0.7; extra == "dev"
27
+ Dynamic: license-file
28
+
29
+ # TileOPs (TOP)
30
+
31
+ **TileOPs (TOP)** is a high-performance machine learning operator collections built on top of [TileLang](https://github.com/tile-ai/tilelang). It offers efficient, modular, and composable implementations optimized for AI workloads.
32
+
33
+ Note: TileOPs is still under rapid development.
34
+
35
+ ---
36
+
37
+ ![DeepSeek-V3.2-Exp DeepSeek Sparse Attention (DSA) performance on H800 SXM](https://raw.githubusercontent.com/tile-ai/TileOPs/main/docs/figures/sparse_mla_perf.png)
38
+ *DeepSeek-V3.2-Exp DeepSeek Sparse Attention (DSA) performance on H800 SXM*
39
+
40
+ ## 📦 Installation
41
+
42
+ ### Requirements
43
+
44
+ - Python 3.8+
45
+ - PyTorch >= 2.1
46
+ - GLIBCXX_3.4.32
47
+ - [TileLang](https://github.com/tile-ai/tilelang)
48
+
49
+ ### Method 1: Install with Pip
50
+
51
+ ```bash
52
+ pip install tileops
53
+ ```
54
+
55
+ ### Method 2: Install from source (editable mode for development)
56
+
57
+ ```bash
58
+ git clone https://github.com/tile-ai/TileOPs
59
+ cd TileOPs
60
+ pip install -e '.[dev]' -v # remove -e option if you don't want to install in editable mode, -v for verbose output
61
+ ```
62
+
63
+ ## 🚀 Quick Usage
64
+
65
+ ### Sparse MLA
66
+
67
+ ```python
68
+ import torch
69
+ from top import SparseMLAKernel
70
+
71
+ batch_size = 1
72
+ seq_len = 1024
73
+ seq_len_kv = 2048
74
+ q_start_index_s = 1024
75
+ n_heads = 128
76
+ head_dim = 512
77
+ tail_dim = 64
78
+ topk = 2048
79
+ kv_stride = 1
80
+ kv_group = 1
81
+ sm_scale = None
82
+
83
+ sparse_mla = SparseMLAKernel(
84
+ batch=batch_size,
85
+ seq_len=seq_len,
86
+ seq_len_kv=seq_len_kv,
87
+ q_start_index_s=q_start_index_s,
88
+ heads=n_heads,
89
+ dim=head_dim,
90
+ tail_dim=tail_dim,
91
+ topk=topk,
92
+ kv_stride=kv_stride,
93
+ kv_group=kv_group,
94
+ sm_scale=sm_scale,
95
+ is_casual=True,
96
+ dtype=torch.bfloat16,
97
+ device='cuda',
98
+ )
99
+
100
+ # Evaluate the Sparse MLA kernel performance
101
+ sparse_mla.check()
102
+ latency = sparse_mla.profile()
103
+ print(f"Latency: {latency:.4f} ms")
104
+ print(f'fwd tflops = ',
105
+ (batch_size * seq_len * (head_dim + tail_dim + head_dim) * topk * 2 * n_heads) / (latency * 1e-3) / 1e12)
106
+ ```
107
+
108
+ ### MLA
109
+
110
+ ```python
111
+ import torch
112
+ import top
113
+ from top import MLAKernel
114
+
115
+ device = "cuda"
116
+ dtype = torch.float16
117
+
118
+ batch = 128
119
+ heads = 64
120
+ kv_heads = 1
121
+ kv_ctx = 8192
122
+ dim = 512
123
+ pe_dim = 64
124
+
125
+ # Query input: [batch, heads, dim]
126
+ q = torch.randn(batch, heads, dim, device=device, dtype=dtype)
127
+
128
+ # Query positional encoding: [batch, heads, pe_dim]
129
+ q_pe = torch.randn(batch, heads, pe_dim, device=device, dtype=dtype)
130
+
131
+ # KV cache input: [batch, kv_ctx, kv_heads, dim]
132
+ kv = torch.randn(batch, kv_ctx, kv_heads, dim, device=device, dtype=dtype)
133
+
134
+ # KV positional encoding: [batch, kv_ctx, kv_heads, pe_dim]
135
+ k_pe = torch.randn(batch, kv_ctx, kv_heads, pe_dim, device=device, dtype=dtype)
136
+
137
+ # Use MLA kernel
138
+ block_N = 64
139
+ block_H = 64
140
+ num_split = 1
141
+
142
+ mla = MLAKernel(batch, heads, kv_heads, kv_ctx, dim, pe_dim, block_N, block_H, num_split)
143
+
144
+ out = mla(q, q_pe, kv, k_pe)
145
+ ```
146
+
147
+ ## Acknowledgments
@@ -1,7 +1,8 @@
1
1
  [project]
2
2
  name = "tileops"
3
- version = "0.0.1.dev1"
3
+ version = "0.0.1.dev2"
4
4
  description = "TileOPs kernels for efficient inference"
5
+ readme = "README.md"
5
6
  authors = [{ name="Tile-AI"}]
6
7
  dependencies = [
7
8
  "torch>=2.1.0",
@@ -0,0 +1,147 @@
1
+ Metadata-Version: 2.4
2
+ Name: tileops
3
+ Version: 0.0.1.dev2
4
+ Summary: TileOPs kernels for efficient inference
5
+ Author: Tile-AI
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.8
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: torch>=2.1.0
11
+ Requires-Dist: numpy>=1.23.5
12
+ Requires-Dist: einops>=0.6.0
13
+ Requires-Dist: Cython
14
+ Requires-Dist: tqdm>=4.62.3
15
+ Requires-Dist: typing_extensions>=4.10.0
16
+ Requires-Dist: cloudpickle
17
+ Requires-Dist: ml_dtypes
18
+ Requires-Dist: psutil
19
+ Requires-Dist: tilelang>=0.1.6.post1
20
+ Provides-Extra: dev
21
+ Requires-Dist: yapf==0.40.2; extra == "dev"
22
+ Requires-Dist: toml==0.10.2; extra == "dev"
23
+ Requires-Dist: tomli==2.0.1; extra == "dev"
24
+ Requires-Dist: ruff==0.6.5; extra == "dev"
25
+ Requires-Dist: codespell==2.3.0; extra == "dev"
26
+ Requires-Dist: clang-format==15.0.7; extra == "dev"
27
+ Dynamic: license-file
28
+
29
+ # TileOPs (TOP)
30
+
31
+ **TileOPs (TOP)** is a high-performance machine learning operator collections built on top of [TileLang](https://github.com/tile-ai/tilelang). It offers efficient, modular, and composable implementations optimized for AI workloads.
32
+
33
+ Note: TileOPs is still under rapid development.
34
+
35
+ ---
36
+
37
+ ![DeepSeek-V3.2-Exp DeepSeek Sparse Attention (DSA) performance on H800 SXM](https://raw.githubusercontent.com/tile-ai/TileOPs/main/docs/figures/sparse_mla_perf.png)
38
+ *DeepSeek-V3.2-Exp DeepSeek Sparse Attention (DSA) performance on H800 SXM*
39
+
40
+ ## 📦 Installation
41
+
42
+ ### Requirements
43
+
44
+ - Python 3.8+
45
+ - PyTorch >= 2.1
46
+ - GLIBCXX_3.4.32
47
+ - [TileLang](https://github.com/tile-ai/tilelang)
48
+
49
+ ### Method 1: Install with Pip
50
+
51
+ ```bash
52
+ pip install tileops
53
+ ```
54
+
55
+ ### Method 2: Install from source (editable mode for development)
56
+
57
+ ```bash
58
+ git clone https://github.com/tile-ai/TileOPs
59
+ cd TileOPs
60
+ pip install -e '.[dev]' -v # remove -e option if you don't want to install in editable mode, -v for verbose output
61
+ ```
62
+
63
+ ## 🚀 Quick Usage
64
+
65
+ ### Sparse MLA
66
+
67
+ ```python
68
+ import torch
69
+ from top import SparseMLAKernel
70
+
71
+ batch_size = 1
72
+ seq_len = 1024
73
+ seq_len_kv = 2048
74
+ q_start_index_s = 1024
75
+ n_heads = 128
76
+ head_dim = 512
77
+ tail_dim = 64
78
+ topk = 2048
79
+ kv_stride = 1
80
+ kv_group = 1
81
+ sm_scale = None
82
+
83
+ sparse_mla = SparseMLAKernel(
84
+ batch=batch_size,
85
+ seq_len=seq_len,
86
+ seq_len_kv=seq_len_kv,
87
+ q_start_index_s=q_start_index_s,
88
+ heads=n_heads,
89
+ dim=head_dim,
90
+ tail_dim=tail_dim,
91
+ topk=topk,
92
+ kv_stride=kv_stride,
93
+ kv_group=kv_group,
94
+ sm_scale=sm_scale,
95
+ is_casual=True,
96
+ dtype=torch.bfloat16,
97
+ device='cuda',
98
+ )
99
+
100
+ # Evaluate the Sparse MLA kernel performance
101
+ sparse_mla.check()
102
+ latency = sparse_mla.profile()
103
+ print(f"Latency: {latency:.4f} ms")
104
+ print(f'fwd tflops = ',
105
+ (batch_size * seq_len * (head_dim + tail_dim + head_dim) * topk * 2 * n_heads) / (latency * 1e-3) / 1e12)
106
+ ```
107
+
108
+ ### MLA
109
+
110
+ ```python
111
+ import torch
112
+ import top
113
+ from top import MLAKernel
114
+
115
+ device = "cuda"
116
+ dtype = torch.float16
117
+
118
+ batch = 128
119
+ heads = 64
120
+ kv_heads = 1
121
+ kv_ctx = 8192
122
+ dim = 512
123
+ pe_dim = 64
124
+
125
+ # Query input: [batch, heads, dim]
126
+ q = torch.randn(batch, heads, dim, device=device, dtype=dtype)
127
+
128
+ # Query positional encoding: [batch, heads, pe_dim]
129
+ q_pe = torch.randn(batch, heads, pe_dim, device=device, dtype=dtype)
130
+
131
+ # KV cache input: [batch, kv_ctx, kv_heads, dim]
132
+ kv = torch.randn(batch, kv_ctx, kv_heads, dim, device=device, dtype=dtype)
133
+
134
+ # KV positional encoding: [batch, kv_ctx, kv_heads, pe_dim]
135
+ k_pe = torch.randn(batch, kv_ctx, kv_heads, pe_dim, device=device, dtype=dtype)
136
+
137
+ # Use MLA kernel
138
+ block_N = 64
139
+ block_H = 64
140
+ num_split = 1
141
+
142
+ mla = MLAKernel(batch, heads, kv_heads, kv_ctx, dim, pe_dim, block_N, block_H, num_split)
143
+
144
+ out = mla(q, q_pe, kv, k_pe)
145
+ ```
146
+
147
+ ## Acknowledgments
@@ -1,26 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: tileops
3
- Version: 0.0.1.dev1
4
- Summary: TileOPs kernels for efficient inference
5
- Author: Tile-AI
6
- License-Expression: MIT
7
- Requires-Python: >=3.8
8
- License-File: LICENSE
9
- Requires-Dist: torch>=2.1.0
10
- Requires-Dist: numpy>=1.23.5
11
- Requires-Dist: einops>=0.6.0
12
- Requires-Dist: Cython
13
- Requires-Dist: tqdm>=4.62.3
14
- Requires-Dist: typing_extensions>=4.10.0
15
- Requires-Dist: cloudpickle
16
- Requires-Dist: ml_dtypes
17
- Requires-Dist: psutil
18
- Requires-Dist: tilelang>=0.1.6.post1
19
- Provides-Extra: dev
20
- Requires-Dist: yapf==0.40.2; extra == "dev"
21
- Requires-Dist: toml==0.10.2; extra == "dev"
22
- Requires-Dist: tomli==2.0.1; extra == "dev"
23
- Requires-Dist: ruff==0.6.5; extra == "dev"
24
- Requires-Dist: codespell==2.3.0; extra == "dev"
25
- Requires-Dist: clang-format==15.0.7; extra == "dev"
26
- Dynamic: license-file
@@ -1,26 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: tileops
3
- Version: 0.0.1.dev1
4
- Summary: TileOPs kernels for efficient inference
5
- Author: Tile-AI
6
- License-Expression: MIT
7
- Requires-Python: >=3.8
8
- License-File: LICENSE
9
- Requires-Dist: torch>=2.1.0
10
- Requires-Dist: numpy>=1.23.5
11
- Requires-Dist: einops>=0.6.0
12
- Requires-Dist: Cython
13
- Requires-Dist: tqdm>=4.62.3
14
- Requires-Dist: typing_extensions>=4.10.0
15
- Requires-Dist: cloudpickle
16
- Requires-Dist: ml_dtypes
17
- Requires-Dist: psutil
18
- Requires-Dist: tilelang>=0.1.6.post1
19
- Provides-Extra: dev
20
- Requires-Dist: yapf==0.40.2; extra == "dev"
21
- Requires-Dist: toml==0.10.2; extra == "dev"
22
- Requires-Dist: tomli==2.0.1; extra == "dev"
23
- Requires-Dist: ruff==0.6.5; extra == "dev"
24
- Requires-Dist: codespell==2.3.0; extra == "dev"
25
- Requires-Dist: clang-format==15.0.7; extra == "dev"
26
- Dynamic: license-file
File without changes
File without changes
File without changes
File without changes