From 10d459e808a9eb898cb5c95d0aca32a0f0ed4754 Mon Sep 17 00:00:00 2001 From: MaseChen <93691652+MaseChen@users.noreply.github.com> Date: Thu, 25 Jun 2026 14:03:51 +0800 Subject: [PATCH] =?UTF-8?q?(flashinfer):=20gitlink=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...:从性能基线到XPU-OJ冒烟提交.md | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/基于AI Agent开发范式的国产GPU大模型推理算子库优化/FlashInfer Benchmark实战:从性能基线到XPU-OJ冒烟提交.md b/基于AI Agent开发范式的国产GPU大模型推理算子库优化/FlashInfer Benchmark实战:从性能基线到XPU-OJ冒烟提交.md index 2a03b16..4af322b 100644 --- a/基于AI Agent开发范式的国产GPU大模型推理算子库优化/FlashInfer Benchmark实战:从性能基线到XPU-OJ冒烟提交.md +++ b/基于AI Agent开发范式的国产GPU大模型推理算子库优化/FlashInfer Benchmark实战:从性能基线到XPU-OJ冒烟提交.md @@ -566,14 +566,14 @@ FlashInfer 方向包含 **4 个可选算子题目**,每个对应独立的 benc - **固定参数**:`num_qo_heads = 32`、`num_kv_heads = 4`、`head_dim_qk = 128`、`head_dim_vo = 128`、`causal = 1`、数据类型 `bfloat16` - **可变参数**(共 **12 个测试用例**): - | batch_size | seq_len | 估算 Q 张量大小 | 估算 KV 张量大小 | - |:---:|:---:|:---:|:---:| - | 1 | 1024 | 1×1024×32×128×2B = 8 MB | 2×1×1024×4×128×2B ≈ 2 MB | - | 1 | 4096 | 32 MB | 8 MB | - | 1 | 8192 | 64 MB | 16 MB | - | 1 | 16384 | 128 MB | 32 MB | - | 4 | 1024~16384 | 32 MB ~ 512 MB | 8 MB ~ 128 MB | - | 16 | 1024~16384 | 128 MB ~ 2 GB | 32 MB ~ 512 MB | + | batch_size | seq_len | 估算 Q 张量大小 | 估算 KV 张量大小 | + |:---:|:---:|:---:|:---:| + | 1 | 1024 | 1×1024×32×128×2B = 8 MB | 2×1×1024×4×128×2B ≈ 2 MB | + | 1 | 4096 | 32 MB | 8 MB | + | 1 | 8192 | 64 MB | 16 MB | + | 1 | 16384 | 128 MB | 32 MB | + | 4 | 1024~16384 | 32 MB ~ 512 MB | 8 MB ~ 128 MB | + | 16 | 1024~16384 | 128 MB ~ 2 GB | 32 MB ~ 512 MB | - **精度要求**:`torch.allclose(output.float(), output_ref.float(), rtol = 1e-2, atol = 1e-2)` - **显存上限**:OJ 评测环境设计 `VRAM_SIZE = 48 GB`(见 `testcase_config.py`) @@ -661,7 +661,7 @@ FlashInfer 方向包含 **4 个可选算子题目**,每个对应独立的 benc ![smoke code](https://origin.picgo.net/2026/06/25/-2026-06-25-095143e59315c41ab0319a.png) - **参考 prompt:** + **参考 prompt** 及 **20001 FlashInfer Ragged Prefill 参考冒烟代码**: ```plaintext # FlashInfer Ragged Prefill CUDA Kernel — Problem 20001 @@ -847,12 +847,9 @@ FlashInfer 方向包含 **4 个可选算子题目**,每个对应独立的 benc 15. All kernel pointers `__restrict__`. warp_sum in namespace. Only code output — no markdown. **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`. - ``` - **20001 FlashInfer Ragged Prefill 参考冒烟代码:** - ```cpp #include