<docs>(flashinfer): 补充附录和相应本地链接 统一本地链接格式符合gitlink

This commit is contained in:
MaseChen 2026-06-25 15:12:50 +08:00
parent 822624a778
commit 1bef660960
1 changed files with 14 additions and 5 deletions

View File

@ -193,7 +193,7 @@ curl -fsSL https://opencode.ai/install | bash
- 已获取测试脚本和 Benchmark 脚本。
> 具体操作可见章节 [*6.1 在赛事镜像中运行 FlashInfer Benchmark*](#run-flashinfer-bench)
> 具体操作可见章节 [*6.1 在赛事镜像中运行 FlashInfer Benchmark*](#61%20在赛事镜像中运行%20flashinfer%20benchmark)
### 4.4 账号准备
@ -222,7 +222,6 @@ XPU-OJ 账号由组委会统一发放,参赛者无需自行注册。
- **Prefill = 并行处理用户输入Decode = 逐个生成回答 token**
<a id="benchmark-baseline"></a>
### 5.2 benchmark / 性能基线
`benchmark/` 目录中的脚本用于运行原库或迁移库的性能测试,帮助选手理解目标 API、输入输出 shape、性能指标和瓶颈位置。benchmark 输出的 CSV、日志或结果为 “性能基线结果”。
@ -246,7 +245,6 @@ XPU-OJ 账号由组委会统一发放,参赛者无需自行注册。
**目标:** 以一个具体算子题目 **20001 FlashInfer Ragged Prefill** 为例,跑通 benchmark 脚本,建立性能基线,理解对应 XPU-OJ 题目包,并完成一次 OJ 冒烟提交,为后续 Agent 辅助优化建立起点。
<a id="run-flashinfer-bench"></a>
### 6.1 在赛事镜像中运行 FlashInfer Benchmark
#### Step 1检查运行环境
@ -366,7 +364,7 @@ python -c "from bench_common import setup_workspace, get_csv_path; print('脚本
**操作:** 运行基准测试脚本 (以 Ragged Prefill Benchmark 为例),读取生成的 CSV 结果文件。
> 每个算子优化题目都对应一个 Benchmark见 [*5.2 查看性能基线*](#benchmark-baseline)
> 每个算子优化题目都对应一个 Benchmark见 [*5.2 查看性能基线*](#52%20benchmark%20%20性能基线)
**运行算子 Benchmark以 Ragged Prefill 为例):**
@ -661,6 +659,8 @@ FlashInfer 方向包含 **4 个可选算子题目**,每个对应独立的 benc
![smoke code](https://origin.picgo.net/2026/06/25/-2026-06-25-095143e59315c41ab0319a.png)
**针对题目 Ragged Prefill 的参考 Prompt 和冒烟代码**位于[*附录*](#附录)
- [*点击查看参考 Prompt*](#参考%20prompt)
- [*点击查看参考冒烟代码*](#20001%20flashinfer%20ragged%20prefill%20参考冒烟代码)
@ -1082,6 +1082,8 @@ mv *.csv results/
### 参考 prompt
[回退到 Step 8](#step%208提交%20oj%20冒烟代码)
```plaintext
# FlashInfer Ragged Prefill CUDA Kernel — Problem 20001
@ -1267,8 +1269,13 @@ Before output, confirm ALL items. Any failure = 0 points.
**Common errors**: (1) `-INFINITY` for m → NaN; use `-1.0e20f`. (2) Missing alpha guard → exp(1e20) overflow. (3) K/V ptr uses 32 instead of 4 → wrong stride (4096 vs 512). (4) Output ptr uses kv_head instead of qo_head → 8 heads write to same location. (5) `sum/t` divides by zero at t=0; use `sum/(t+1)`. (6) Signed `0xffffffff` mask → UB; use `0xffffffffu`.
```
[回退到 Step 8](#step%208提交%20oj%20冒烟代码)
### 20001 FlashInfer Ragged Prefill 参考冒烟代码
[回退到 Step 8](#step%208提交%20oj%20冒烟代码)
```cpp
#include <stdint.h>
@ -1451,4 +1458,6 @@ extern "C" void run_kernel(
q, k, v, output, qo_indptr, kv_indptr, batch_size, seq_len,
num_qo_heads, num_kv_heads, head_dim_qk, head_dim_vo, causal, exact_len);
}
```
```
[回退到 Step 8](#step%208提交%20oj%20冒烟代码)