diff --git a/基于AI Agent开发范式的国产GPU大模型推理算子库优化/Fused MoE Baseline入门:快速跑通最小闭环教程.md b/基于AI Agent开发范式的国产GPU大模型推理算子库优化/Fused MoE Baseline入门:快速跑通最小闭环教程.md index cac3326..d4f6133 100644 --- a/基于AI Agent开发范式的国产GPU大模型推理算子库优化/Fused MoE Baseline入门:快速跑通最小闭环教程.md +++ b/基于AI Agent开发范式的国产GPU大模型推理算子库优化/Fused MoE Baseline入门:快速跑通最小闭环教程.md @@ -57,11 +57,13 @@ **环境准备:** + * 已进入赛事专属镜像环境。 **工具准备:** + * 已准备 Agent 工具; * 已配置 Token / API Key; @@ -71,6 +73,7 @@ **代码准备:** + * 已获取 Fused MoE Baseline 源码。 @@ -129,6 +132,7 @@ EOF | `Python 3.6.x/ Python 3.7.x` | Python 版本过低 | `conda install python=3.12` (推荐3.10+) | | `ModuleNotFoundError: numpy` | 当前 Python 缺少依赖 | `pip install numpy torch triton` | + ### 步骤 2:进入项目目录 **目标:**进入本模块所需的源码目录。 @@ -186,9 +190,9 @@ PYTHON_BIN=/path/to/python bash scripts/build_fused_moe_i8_tn_pybind.sh ### 步骤 4:正确性测试 -**目标:**验证 reference 计算、pybind 计算、Triton 计算这三种方式计算结果的数值是否完全一致。 +**目标:** 验证 reference 计算、pybind 计算、Triton 计算这三种方式计算结果的数值是否完全一致。 -**操作:**运行 `fused_moe/scripts/run_fused_moe_i8_tn_pybind_test.sh` 脚本 +**操作:** 运行 `fused_moe/scripts/run_fused_moe_i8_tn_pybind_test.sh` 脚本 **命令示例:** @@ -208,22 +212,16 @@ bash scripts/run_fused_moe_i8_tn_pybind_test.sh --backend reference 编译成功无报错,输出示例如下: -> pybind:fused\_moe\_i8\_tn\_topk1 passed: rows=256, cols=128, sample C\[0\]=0.69531, C\[last\]=-0.44531 - -> pybind:fused\_moe\_i8\_tn\_topk2 passed: rows=512, cols=128, sample C\[0\]=-0.57813, C\[last\]=-0.49805 - +> pybind:fused\_moe\_i8\_tn\_topk1 passed: rows=256, cols=128, sample C\[0\]=0.69531, C\[last\]=-0.44531 +> pybind:fused\_moe\_i8\_tn\_topk2 passed: rows=512, cols=128, sample C\[0\]=-0.57813, C\[last\]=-0.49805 > pybind:fused\_moe\_i8\_tn\_topk3 passed: rows=384, cols=128, sample C\[0\]=-1.08594, C\[last\]=-0.33594 -> reference:fused\_moe\_i8\_tn\_topk1 passed: rows=256, cols=128, sample C\[0\]=0.6934, C\[last\]=-0.4451 - -> reference:fused\_moe\_i8\_tn\_topk2 passed: rows=512, cols=128, sample C\[0\]=-0.5768, C\[last\]=-0.4975 - +> reference:fused\_moe\_i8\_tn\_topk1 passed: rows=256, cols=128, sample C\[0\]=0.6934, C\[last\]=-0.4451 +> reference:fused\_moe\_i8\_tn\_topk2 passed: rows=512, cols=128, sample C\[0\]=-0.5768, C\[last\]=-0.4975 > reference:fused\_moe\_i8\_tn\_topk3 passed: rows=384, cols=128, sample C\[0\]=-1.0875, C\[last\]=-0.3362 -> triton:fused\_moe\_i8\_tn\_topk1 passed: rows=256, cols=128, sample C\[0\]=0.69337, C\[last\]=-0.44513 - -> triton:fused\_moe\_i8\_tn\_topk2 passed: rows=512, cols=128, sample C\[0\]=-0.57678, C\[last\]=-0.49749 - +> triton:fused\_moe\_i8\_tn\_topk1 passed: rows=256, cols=128, sample C\[0\]=0.69337, C\[last\]=-0.44513 +> triton:fused\_moe\_i8\_tn\_topk2 passed: rows=512, cols=128, sample C\[0\]=-0.57678, C\[last\]=-0.49749 > triton:fused\_moe\_i8\_tn\_topk3 passed: rows=384, cols=128, sample C\[0\]=-1.08748, C\[last\]=-0.33618 **结果解释:** @@ -249,9 +247,9 @@ bash scripts/run_fused_moe_i8_tn_pybind_test.sh --backend reference ### 步骤5:性能测试 -**目标:**输出 benchmark 结果对比表 +**目标:** 输出 benchmark 结果对比表 -**操作:**运行 `fused_moe/scripts/run_fused_moe_i8_tn_benchmark.sh` 脚本 +**操作:** 运行 `fused_moe/scripts/run_fused_moe_i8_tn_benchmark.sh` 脚本 **命令示例:** @@ -267,21 +265,15 @@ bash scripts/run_fused_moe_i8_tn_benchmark.sh --backend all --warmup 5 --iters 2 编译成功无报错,输出示例如下: > pybind:fused\_moe\_i8\_tn\_topk1 benchmark: avg\_ms=0.308978, TOPS=0.027149, warmup=5, iters=20 - > pybind:fused\_moe\_i8\_tn\_topk2 benchmark: avg\_ms=0.304500, TOPS=0.055098, warmup=5, iters=20 - > pybind:fused\_moe\_i8\_tn\_topk3 benchmark: avg\_ms=0.297775, TOPS=0.042256, warmup=5, iters=20 > reference:fused\_moe\_i8\_tn\_topk1 benchmark: avg\_ms=1685.43, TOPS=0.000005, warmup=5, iters=20 - -> reference:fused\_moe\_i8\_tn\_topk2 benchmark: avg\_ms=3384.52, TOPS=0.000005, warmup=5, iters=20 - +> reference:fused\_moe\_i8\_tn\_topk2 benchmark: avg\_ms=3384.52, TOPS=0.000005, warmup=5, iters=20 > reference:fused\_moe\_i8\_tn\_topk3 benchmark: avg\_ms=2532.14, TOPS=0.000005, warmup=5, iters=20 -> triton:fused\_moe\_i8\_tn\_topk1 benchmark: avg\_ms=19.013421, TOPS=0.000441, warmup=5, iters=20 - +> triton:fused\_moe\_i8\_tn\_topk1 benchmark: avg\_ms=19.013421, TOPS=0.000441, warmup=5, iters=20 > triton:fused\_moe\_i8\_tn\_topk2 benchmark: avg\_ms=16.745914, TOPS=0.001002, warmup=5, iters=20 - > triton:fused\_moe\_i8\_tn\_topk3 benchmark: avg\_ms=19.630328, TOPS=0.000641, warmup=5, iters=20 **结果解释:** @@ -416,7 +408,7 @@ bash scripts/run_fused_moe_i8_tn_benchmark.sh --backend all --warmup 5 --iters 2 5. 提交优化任务:点击右下角 \[优化\] 按钮,系统将提交任务并进入 \[生成中\] 状态 - ![image.png](https://origin.picgo.net/2026/06/04/image659a3f15b96be22c1.png) + ![image.png](https://origin.picgo.net/2026/06/04/image659a3f15b96be22c1.png) 完成上述步骤将看到如下界面: @@ -424,7 +416,7 @@ bash scripts/run_fused_moe_i8_tn_benchmark.sh --backend all --warmup 5 --iters 2 ### 步骤2:任务查看与结果管理 -**目标:**在新建优化任务后可追踪任务进度,获取优化结果 +**目标:** 在新建优化任务后可追踪任务进度,获取优化结果 **操作:** @@ -457,7 +449,7 @@ bash scripts/run_fused_moe_i8_tn_benchmark.sh --backend all --warmup 5 --iters 2 * 顶部:任务名称、创建/更新时间、适配硬件、当前轮次进度 - ![image.png](https://origin.picgo.net/2026/06/04/image9e9b23d9b25ddfe25.png) + ![image.png](https://origin.picgo.net/2026/06/04/image9e9b23d9b25ddfe25.png) 3. 获取优化结果:当前任务状态为【已完成】时,可在详情页查看优化结果: