Commit ba011d1
perf: TRT-LLM MoE Block-FP8 activation optimization (#2063)
<!-- .github/pull_request_template.md -->
## 📌 Description
- Small optimization to the activation kernel for block-FP8 MoE for
large batch size.
| BS | Baseline, us | Optimized, us |
| ------------- | ------------- | ------------- |
| 1 | 2.4 | 2.1 |
| 32 | 3.5 | 2.6 |
| 256 | 21.7 | 8.7 |
| 1024 | 84.4 | 23.8 |
| 4096 | 333 | 87.0 |
| 16384 | 1330 | 365 |
- Adding micro-benchmark for DS FP8 implemented by @IwakuraRein.
<!-- What does this PR do? Briefly describe the changes and why they’re
needed. -->
## 🔍 Related Issues
<!-- Link any related issues here -->
## 🚀 Pull Request Checklist
Thank you for contributing to FlashInfer! Before we review your pull
request, please make sure the following items are complete.
### ✅ Pre-commit Checks
- [x] I have installed `pre-commit` by running `pip install pre-commit`
(or used your preferred method).
- [x] I have installed the hooks with `pre-commit install`.
- [x] I have run the hooks manually with `pre-commit run --all-files`
and fixed any reported issues.
> If you are unsure about how to set up `pre-commit`, see [the
pre-commit documentation](https://pre-commit.com/).
## 🧪 Tests
- [x] Tests have been added or updated as needed.
- [x] All tests are passing (`unittest`, etc.).
## Reviewer Notes
<!-- Optional: anything you'd like reviewers to focus on, concerns, etc.
-->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Improved Mixture-of-Experts inference with configurable multi-token
batching per GPU core for higher throughput.
* Expanded FP8 quantization with a new block-scale mode and dynamic,
hardware-aware kernel scheduling for better utilization and numerical
stability.
* Vectorized max-reduction and per-block scaling to accelerate
reductions and improve output scaling precision.
* Autotuner/CLI now exposes the FP8 block quantization option for
tuning.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Signed-off-by: Siyuan Fu <[email protected]>
Co-authored-by: Siyuan Fu <[email protected]>1 parent e450c7d commit ba011d1
File tree
3 files changed
+356
-84
lines changed- benchmarks
- csrc
- include/flashinfer/trtllm/fused_moe
3 files changed
+356
-84
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | | - | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
32 | | - | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
44 | | - | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| 51 | + | |
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
56 | | - | |
57 | | - | |
58 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
59 | 82 | | |
60 | | - | |
61 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
62 | 87 | | |
63 | | - | |
64 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
65 | 92 | | |
66 | | - | |
67 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
68 | 97 | | |
69 | 98 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
93 | 150 | | |
94 | 151 | | |
95 | 152 | | |
| |||
135 | 192 | | |
136 | 193 | | |
137 | 194 | | |
| 195 | + | |
138 | 196 | | |
139 | 197 | | |
140 | 198 | | |
| |||
263 | 321 | | |
264 | 322 | | |
265 | 323 | | |
266 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
267 | 331 | | |
268 | 332 | | |
269 | 333 | | |
| |||
288 | 352 | | |
289 | 353 | | |
290 | 354 | | |
291 | | - | |
| 355 | + | |
292 | 356 | | |
293 | 357 | | |
294 | 358 | | |
| |||
0 commit comments