lightmoe 0.1.0__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.
- lightmoe-0.1.0/BENCHMARKS.md +174 -0
- lightmoe-0.1.0/LICENSE +201 -0
- lightmoe-0.1.0/MANIFEST.in +6 -0
- lightmoe-0.1.0/NOTICE +24 -0
- lightmoe-0.1.0/PKG-INFO +317 -0
- lightmoe-0.1.0/README.md +285 -0
- lightmoe-0.1.0/benchmarks/__init__.py +1 -0
- lightmoe-0.1.0/benchmarks/model_shapes.py +399 -0
- lightmoe-0.1.0/benchmarks/moe.py +1198 -0
- lightmoe-0.1.0/benchmarks/moe_backends.py +634 -0
- lightmoe-0.1.0/benchmarks/nvfp4_gemm.py +1680 -0
- lightmoe-0.1.0/benchmarks/reference.py +371 -0
- lightmoe-0.1.0/lightmoe/__init__.py +30 -0
- lightmoe-0.1.0/lightmoe/_quantization.py +102 -0
- lightmoe-0.1.0/lightmoe/gemm.py +121 -0
- lightmoe-0.1.0/lightmoe/inference.py +1035 -0
- lightmoe-0.1.0/lightmoe/kernels/__init__.py +73 -0
- lightmoe-0.1.0/lightmoe/kernels/_common.py +165 -0
- lightmoe-0.1.0/lightmoe/kernels/dense/__init__.py +27 -0
- lightmoe-0.1.0/lightmoe/kernels/dense/kernel.py +1721 -0
- lightmoe-0.1.0/lightmoe/kernels/dense/runtime.py +146 -0
- lightmoe-0.1.0/lightmoe/kernels/gated.py +361 -0
- lightmoe-0.1.0/lightmoe/kernels/grouped/__init__.py +31 -0
- lightmoe-0.1.0/lightmoe/kernels/grouped/kernel.py +3694 -0
- lightmoe-0.1.0/lightmoe/kernels/grouped/pipeline.py +71 -0
- lightmoe-0.1.0/lightmoe/kernels/grouped/runtime.py +663 -0
- lightmoe-0.1.0/lightmoe/kernels/grouped/scheduler.py +1240 -0
- lightmoe-0.1.0/lightmoe/kernels/grouped/wgrad.py +182 -0
- lightmoe-0.1.0/lightmoe/kernels/grouped/wgrad_kernel.py +1673 -0
- lightmoe-0.1.0/lightmoe/kernels/grouped/wgrad_tma.py +1024 -0
- lightmoe-0.1.0/lightmoe/kernels/quantize/__init__.py +37 -0
- lightmoe-0.1.0/lightmoe/kernels/quantize/decode.py +1320 -0
- lightmoe-0.1.0/lightmoe/kernels/quantize/kernel.py +1066 -0
- lightmoe-0.1.0/lightmoe/kernels/quantize/runtime.py +284 -0
- lightmoe-0.1.0/lightmoe/kernels/routing/__init__.py +31 -0
- lightmoe-0.1.0/lightmoe/kernels/routing/combine.py +526 -0
- lightmoe-0.1.0/lightmoe/kernels/routing/dispatch.py +443 -0
- lightmoe-0.1.0/lightmoe/kernels/unary.py +85 -0
- lightmoe-0.1.0/lightmoe/routing.py +5 -0
- lightmoe-0.1.0/lightmoe/training.py +881 -0
- lightmoe-0.1.0/lightmoe.egg-info/PKG-INFO +317 -0
- lightmoe-0.1.0/lightmoe.egg-info/SOURCES.txt +45 -0
- lightmoe-0.1.0/lightmoe.egg-info/dependency_links.txt +1 -0
- lightmoe-0.1.0/lightmoe.egg-info/requires.txt +8 -0
- lightmoe-0.1.0/lightmoe.egg-info/top_level.txt +1 -0
- lightmoe-0.1.0/pyproject.toml +65 -0
- lightmoe-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Benchmarks
|
|
2
|
+
|
|
3
|
+
Operator measurements use an NVIDIA B200 (`sm100`, 148 SMs),
|
|
4
|
+
`nvcr.io/nvidia/pytorch:26.07-py3`, PyTorch
|
|
5
|
+
`2.13.0a0+9186a08b2c.nv26.07`, CUDA 13.3, driver 580.95.05, CUTLASS DSL
|
|
6
|
+
4.7.0, FlashInfer 0.6.17, and Transformer Engine 2.17. The full-model result
|
|
7
|
+
uses eight B200s, vLLM 0.27.1, PyTorch 2.13.0+cu130, and FlashInfer
|
|
8
|
+
0.6.16.post3.
|
|
9
|
+
|
|
10
|
+
## Measurement
|
|
11
|
+
|
|
12
|
+
| Scope | Included | Excluded |
|
|
13
|
+
|---|---|---|
|
|
14
|
+
| Grouped GEMM | one prepacked NVFP4 grouped GEMM launch | quantization, packing, allocation, compilation, autotuning |
|
|
15
|
+
| Complete MoE inference | BF16 input quantization, dispatch, two expert projections, activation, routing weights, combine | router logits, top-k selection, communication, weight packing, compilation |
|
|
16
|
+
| Routed-expert training | dispatch, expert forward and backward, routing weights, combine | router logits, top-k selection, communication, optimizer |
|
|
17
|
+
| Full-model serving | one warmed `LLM.generate` call | model load, JIT compilation, dataset loading, tokenization |
|
|
18
|
+
|
|
19
|
+
Operator backends run on identical shapes and route tensors in randomized,
|
|
20
|
+
alternating order. Each point uses 21 CUDA-event samples and reports median
|
|
21
|
+
`[IQR]`. Training arms run for two seconds before measurement. The complete
|
|
22
|
+
arm sequence is then repeated; a point is rejected after three attempts if the
|
|
23
|
+
two LightMoE medians differ by more than 5%. Runs are also rejected when host
|
|
24
|
+
wall time divided by enclosed CUDA-event time exceeds 1.5. An unavailable
|
|
25
|
+
backend is marked unavailable, not replaced by another implementation.
|
|
26
|
+
|
|
27
|
+
For expert `e`, `M_e` is its local row count. **Ragged** means that the `M_e`
|
|
28
|
+
values are unequal; a zero-row expert is valid. The stress matrix uses unequal
|
|
29
|
+
counts, a route distribution concentrated on one expert, and counts around
|
|
30
|
+
tile boundaries with one zero-row expert.
|
|
31
|
+
|
|
32
|
+
Grouped-GEMM useful work is `2 × sum(M_e) × N × K`, with one multiply-add
|
|
33
|
+
counted as two FLOPs. Peak percentages use the B200 dense FP4 specification of
|
|
34
|
+
9,000 TFLOP/s; the 18,000 TFLOP/s structured-sparse figure is not used. This is
|
|
35
|
+
logical throughput, so work added by tile padding is not counted as useful
|
|
36
|
+
FLOPs.
|
|
37
|
+
|
|
38
|
+
## Grouped NVFP4 GEMM
|
|
39
|
+
|
|
40
|
+
These are model-derived expert projection shapes with 8,192 input tokens per
|
|
41
|
+
EP rank and balanced routing. The local grouped GEMM contains
|
|
42
|
+
`sum(M_e) = tokens × top-k` rows across `experts / EP size` local experts.
|
|
43
|
+
LightMoE and FlashInfer write to preallocated outputs. PyTorch
|
|
44
|
+
`scaled_grouped_mm` allocates its output because its API has no `out=` argument.
|
|
45
|
+
The baseline column selects the faster runnable baseline for each row.
|
|
46
|
+
|
|
47
|
+
| Model / projection | Experts / top-k / EP size | `N × K` | LightMoE µs `[IQR]` | Fastest baseline µs | Baseline / LightMoE | TFLOP/s | Dense FP4 peak |
|
|
48
|
+
|---|---:|---:|---:|---:|---:|---:|---:|
|
|
49
|
+
| Qwen3.5-35B-A3B gate/up | 256 / 8 / 16 | 1,024 × 2,048 | **77.0 [0.2]** | FlashInfer 95.8 | 1.243× | 3,569 | 39.7% |
|
|
50
|
+
| Qwen3.5-35B-A3B down | 256 / 8 / 16 | 2,048 × 512 | **67.8 [2.0]** | FlashInfer 68.0 | 1.003× | 2,027 | 22.5% |
|
|
51
|
+
| Qwen3.5-397B-A17B gate/up | 512 / 10 / 32 | 2,048 × 4,096 | **296.2 [9.3]** | PyTorch 342.2 | 1.155× | 4,640 | 51.6% |
|
|
52
|
+
| Qwen3.5-397B-A17B down | 512 / 10 / 32 | 4,096 × 1,024 | **214.3 [1.0]** | FlashInfer 248.4 | 1.159× | 3,207 | 35.6% |
|
|
53
|
+
| DeepSeek-V4-Flash gate/up | 256 / 6 / 32 | 4,096 × 4,096 | **353.4 [12.1]** | PyTorch 392.4 | 1.110× | 4,667 | 51.9% |
|
|
54
|
+
| DeepSeek-V4-Flash down | 256 / 6 / 32 | 4,096 × 2,048 | **195.9 [2.0]** | PyTorch 226.5 | 1.156× | 4,210 | 46.8% |
|
|
55
|
+
| Kimi-K3 gate/up | 896 / 16 / 32 | 6,144 × 3,584 | **1,191.0 [27.6]** | FlashInfer 1,777.7 | 1.493× | 4,847 | 53.9% |
|
|
56
|
+
| Kimi-K3 down | 896 / 16 / 32 | 3,584 × 3,072 | **644.4 [3.1]** | FlashInfer 893.9 | 1.387× | 4,479 | 49.8% |
|
|
57
|
+
| GLM-5.2 gate/up | 256 / 8 / 16 | 4,096 × 6,144 | **627.7 [2.3]** | PyTorch 691.4 | 1.101× | 5,255 | **58.4%** |
|
|
58
|
+
| GLM-5.2 down | 256 / 8 / 16 | 6,144 × 2,048 | **406.7 [3.9]** | PyTorch 437.4 | 1.075× | 4,055 | 45.1% |
|
|
59
|
+
| MiniMax-M3 gate/up | 128 / 4 / 16 | 6,144 × 6,144 | **486.6 [2.2]** | PyTorch 530.5 | 1.090× | 5,084 | 56.5% |
|
|
60
|
+
| MiniMax-M3 down | 128 / 4 / 16 | 6,144 × 3,072 | **275.6 [2.0]** | PyTorch 304.2 | 1.104× | 4,489 | 49.9% |
|
|
61
|
+
| Nemotron-3.5-Lightning-30B-A3B up | 128 / 6 / 16 | 1,920 × 2,688 | **156.1 [3.4]** | PyTorch 158.3 | 1.014× | 3,250 | 36.1% |
|
|
62
|
+
| Nemotron-3.5-Lightning-30B-A3B down | 128 / 6 / 16 | 2,688 × 1,920 | **167.2 [0.3]** | PyTorch 168.5 | 1.008× | 3,035 | 33.7% |
|
|
63
|
+
|
|
64
|
+
All 14 balanced rows pass the two validity gates. The maximum LightMoE repeat
|
|
65
|
+
deviation is 4.10%, the maximum host/CUDA ratio is 1.035, and sampled cosine
|
|
66
|
+
against FP32 GEMM from the same BF16 operands is at least 0.99086. Nemotron's
|
|
67
|
+
1,856-wide expert intermediate is padded to 1,920 for the NVFP4 kernel.
|
|
68
|
+
Kimi-K3 uses its 3,584-wide routed latent expert input; its 7,168-wide outer
|
|
69
|
+
projections are outside this grouped-GEMM boundary.
|
|
70
|
+
|
|
71
|
+
The ragged matrix covers imbalanced, single-expert-skew, and alignment-stress
|
|
72
|
+
routing, including a zero-row expert. PyTorch is unavailable for these rows
|
|
73
|
+
because its NVFP4 grouped GEMM requires every group to have a 128-row-aligned
|
|
74
|
+
size.
|
|
75
|
+
|
|
76
|
+
## Complete MoE inference
|
|
77
|
+
|
|
78
|
+
[](https://github.com/roycho96/lightmoe/blob/main/assets/moe-inference-latency.svg)
|
|
79
|
+
|
|
80
|
+
[](https://github.com/roycho96/lightmoe/blob/main/assets/moe-inference-speedup.svg)
|
|
81
|
+
|
|
82
|
+
`M` is the number of input tokens before top-k routing; the layer processes
|
|
83
|
+
`M × top-k` token–expert assignments. Each point uses the model-derived local
|
|
84
|
+
EP shard, fixed synthetic BF16 inputs, deterministic balanced routes, prepacked
|
|
85
|
+
weights, preallocated outputs, and CUDA Graph replay. The FlashInfer 0.6.17 arm
|
|
86
|
+
captures `fp4_quantize` and `trtllm_fp4_block_scale_routed_moe` together,
|
|
87
|
+
matching the complete `InferenceMoE` call boundary. Package initialization and
|
|
88
|
+
tactic loading happen before capture.
|
|
89
|
+
|
|
90
|
+
| Model | `M=1` µs | `M=128` µs | `M=8,192` µs | FlashInfer / LightMoE at `M=8,192` | Lowest ratio in sweep |
|
|
91
|
+
|---|---:|---:|---:|---:|---:|
|
|
92
|
+
| Qwen3.5-35B-A3B | 14.4 | 28.8 | 252.5 | **1.290×** | 0.857× at `M=128` |
|
|
93
|
+
| Qwen3.5-397B-A17B | 20.5 | 53.6 | 770.7 | **1.211×** | 0.907× at `M=32` |
|
|
94
|
+
| DeepSeek-V4-Flash | 20.5 | 48.9 | 679.5 | **1.365×** | 0.828× at `M=32` |
|
|
95
|
+
| GLM-5.2 | 40.5 | 91.4 | 1,364.0 | **1.369×** | 0.920× at `M=128` |
|
|
96
|
+
| MiniMax-M3 | 34.7 | 71.8 | 900.5 | **1.524×** | 0.932× at `M=128` |
|
|
97
|
+
| Nemotron-3.5-Lightning-30B-A3B | 16.4 | 32.7 | 387.3 | **1.175×** | 0.821× at `M=32` |
|
|
98
|
+
|
|
99
|
+
All 42 points pass the measurement gates. The maximum LightMoE repeat
|
|
100
|
+
deviation is 3.64% and the maximum host/CUDA ratio is 1.054. Ratios below 1.0
|
|
101
|
+
identify short-token points where FlashInfer is faster; they are retained in
|
|
102
|
+
the speedup chart.
|
|
103
|
+
|
|
104
|
+
## Routed-expert training
|
|
105
|
+
|
|
106
|
+
[](https://github.com/roycho96/lightmoe/blob/main/assets/moe-training-latency.svg)
|
|
107
|
+
|
|
108
|
+
[](https://github.com/roycho96/lightmoe/blob/main/assets/moe-training-speedup.svg)
|
|
109
|
+
|
|
110
|
+
The complete forward-and-backward curve uses the same model-derived local EP
|
|
111
|
+
shards and deterministic balanced routes as the inference curve. The speedup
|
|
112
|
+
chart includes Transformer Engine only for standard SwiGLU models with an
|
|
113
|
+
exact activation contract. Bounded SwiGLU, SwiGLU-OAI, and ReLU² remain in the
|
|
114
|
+
LightMoE latency chart and are not compared with a different TE activation.
|
|
115
|
+
|
|
116
|
+
| Model | `M=32` ms `[IQR]` | `M=512` ms `[IQR]` | `M=8,192` ms `[IQR]` | TE / LightMoE at `M=8,192` |
|
|
117
|
+
|---|---:|---:|---:|---:|
|
|
118
|
+
| Qwen3.5-35B-A3B | 2.140 [0.037] | 2.163 [0.034] | 2.174 [0.036] | **1.914×** |
|
|
119
|
+
| Qwen3.5-397B-A17B | 2.188 [0.032] | 2.207 [0.042] | 4.066 [0.023] | **1.505×** |
|
|
120
|
+
| DeepSeek-V4-Flash | 2.085 [0.140] | 2.090 [0.118] | 3.791 [0.115] | — |
|
|
121
|
+
| GLM-5.2 | 2.207 [0.046] | 2.215 [0.047] | 6.465 [0.117] | **1.369×** |
|
|
122
|
+
| MiniMax-M3 | 2.069 [0.116] | 2.120 [0.150] | 4.646 [0.046] | — |
|
|
123
|
+
| Nemotron-3.5-Lightning-30B-A3B | 2.058 [0.111] | 2.066 [0.093] | 2.480 [0.028] | — |
|
|
124
|
+
|
|
125
|
+
All 30 LightMoE points and all 15 exact-contract TE points pass the measurement
|
|
126
|
+
gates. The maximum LightMoE repeat deviation is 1.98% and the maximum
|
|
127
|
+
host/CUDA ratio is 1.014. Input, router, expert-weight, and output gradients
|
|
128
|
+
are finite. Minimum sampled cosine against the BF16 reference is 0.9726 for
|
|
129
|
+
outputs and 0.9617 for input gradients. These are precision checks, not
|
|
130
|
+
training-convergence results.
|
|
131
|
+
|
|
132
|
+
## Full-model vLLM serving
|
|
133
|
+
|
|
134
|
+
`nvidia/DeepSeek-V4-Flash-NVFP4` revision
|
|
135
|
+
`e3cd60e7de98e9867116860d522499a728de1cf9` runs on eight B200s with tensor
|
|
136
|
+
parallel size 8 and an FP8 KV cache. Attention, scheduling, collectives, and all
|
|
137
|
+
non-MoE operators are fixed; only the NVFP4 MoE backend changes. Prompts are
|
|
138
|
+
fixed SWE-bench Verified samples from revision
|
|
139
|
+
`78f471bf655a3137b2e8a75af1501690ec009ec3`.
|
|
140
|
+
|
|
141
|
+
| Workload | Fixed batch | LightMoE initial median `[IQR]` | FlashInfer TensorRT-LLM median `[IQR]` | LightMoE repeat median `[IQR]` | Baseline / LightMoE |
|
|
142
|
+
|---|---:|---:|---:|---:|---:|
|
|
143
|
+
| Prefill | 8 × 1,024 input → 1 output | 221.670 [2.869] ms | 250.464 [4.300] ms | 226.927 [1.803] ms | 1.10–1.13× |
|
|
144
|
+
| Decode | 32 × 256 input → 256 output | 2.4488 [0.0125] s | 2.5395 [0.0667] s | 2.4587 [0.0653] s | 1.033–1.037× |
|
|
145
|
+
|
|
146
|
+
Each backend has 21 warmed runs. Initial-to-repeat drift is 2.37% for prefill
|
|
147
|
+
and 0.40% for decode. Inputs, outputs, and generated token sequences match
|
|
148
|
+
across backends. This is the only full-model backend swap claimed here; an
|
|
149
|
+
operator result is never presented as end-to-end performance.
|
|
150
|
+
|
|
151
|
+
## Run
|
|
152
|
+
|
|
153
|
+
Pinned model sources and revisions live in `benchmarks/model_shapes.py`.
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
python -m benchmarks.nvfp4_gemm \
|
|
157
|
+
--models all --tokens 8192 --routing balanced \
|
|
158
|
+
--projections gate_up,down \
|
|
159
|
+
--backends lightmoe,flashinfer_cutedsl,torch_scaled_grouped_mm \
|
|
160
|
+
--mode prepacked --warmup 5 --iterations 21
|
|
161
|
+
|
|
162
|
+
python -m benchmarks.nvfp4_gemm \
|
|
163
|
+
--models all --tokens 8192 \
|
|
164
|
+
--routing imbalanced,single_expert_skew,alignment_stress \
|
|
165
|
+
--projections gate_up,down \
|
|
166
|
+
--backends lightmoe,flashinfer_cutedsl,torch_scaled_grouped_mm \
|
|
167
|
+
--mode prepacked --warmup 5 --iterations 21
|
|
168
|
+
|
|
169
|
+
python -m benchmarks.moe \
|
|
170
|
+
--models all --tokens 8192 --routing balanced,imbalanced \
|
|
171
|
+
--backends lightmoe,transformer_engine_nvfp4_fused,pytorch_bf16 \
|
|
172
|
+
--scope full-layer --pass fwd_bwd --warmup 15 --iterations 21 \
|
|
173
|
+
--interleave-training
|
|
174
|
+
```
|
lightmoe-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
lightmoe-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
LightMoE third-party notices
|
|
2
|
+
============================
|
|
3
|
+
|
|
4
|
+
The following files retain upstream copyright and license notices.
|
|
5
|
+
|
|
6
|
+
BSD-3-Clause
|
|
7
|
+
------------
|
|
8
|
+
|
|
9
|
+
- lightmoe/kernels/dense/kernel.py
|
|
10
|
+
- lightmoe/kernels/grouped/kernel.py
|
|
11
|
+
- lightmoe/kernels/grouped/pipeline.py
|
|
12
|
+
|
|
13
|
+
These files are based on NVIDIA CUTLASS CuTe DSL examples.
|
|
14
|
+
Upstream: https://github.com/NVIDIA/cutlass
|
|
15
|
+
|
|
16
|
+
Apache-2.0
|
|
17
|
+
----------
|
|
18
|
+
|
|
19
|
+
- lightmoe/kernels/grouped/scheduler.py
|
|
20
|
+
- lightmoe/kernels/grouped/wgrad_kernel.py
|
|
21
|
+
- lightmoe/kernels/grouped/wgrad_tma.py
|
|
22
|
+
|
|
23
|
+
These files are based on NVIDIA cuDNN Frontend examples.
|
|
24
|
+
Upstream: https://github.com/NVIDIA/cudnn-frontend
|