[MUH] Fix 7 structural discrepancies vs CCCL — read source, not grep

Fixes found by reading all 17 muh files + 6 CCCL counterpart
policy_selectors as full source code input:

1. topk: BLOCK_LOAD_DIRECT → BLOCK_LOAD_VECTORIZE (CCCL SM90+ uses
   VECTORIZE). bits_per_pass was wrong (muh: ks<=4→9, CCCL: ks>=2→11).
   items now computed dynamically (4*4/key_size) not hardcoded.

2. reduce: added determinism dispatch — three modes matching CCCL:
   gpu_to_gpu (BLOCK_REDUCE_RAKING, vec_size=1, LOAD_DEFAULT),
   run_to_run (WARP_REDUCTIONS, LOAD_LDG, default),
   not_guaranteed (WARP_REDUCTIONS_NONDETERMINISTIC).
   Added bi100_det_float32 and bi100_det_float64 tuning structs
   with SM90 benchmark reference values.

3. batch_memcpy: flat single-tier → SmallBuffer+LargeBuffer two-tier
   matching CCCL structure (128 threads small, 256 threads large,
   warp_threshold=128, block_threshold=8192).

4. transform: single BulkPolicy → three-policy structure
   (VectorizedPolicy + AsyncCopyPolicy + PrefetchPolicy) matching CCCL.
   items_per_thread computed from bytes_in_flight / (threads * elem_size).

5. compile_test: 17 checks → 33 checks. Now verifies exact values:
   reduce determinism modes, topk VECTORIZE + bits=11, batch_memcpy
   two-tier thresholds, transform three-policy structure.

6. gen_patch: added fallback extraction for inline policy_selector
   values (topk now generates SAMPLING_BLOCK_SIZE patch).

7. MUH_PROJECT_CHECKPOINT.md: 'PRD设计阶段还没有代码' → actual status.

7 files changed, 413 insertions, 265 deletions.
This commit is contained in:
Claude
2026-07-30 14:37:38 +00:00
parent e02134a3ce
commit c7a63bc2c8
7 changed files with 411 additions and 263 deletions

View File

@@ -45,7 +45,7 @@ muh 是我们设计的 **tuning DSL领域特定语言**,用于:
**为什么需要它**: CCCL 有 27 个 tuning_*.cuh 文件17000+ 行),每个算法都有针对不同 NVIDIA SM 架构的特化参数。天垓100 不是 NVIDIA GPU不能直接用这些参数但 tuning 的维度block size、warp 策略、shared memory 用量、prefetch 策略是通用的。muh 让迁移过程变成"改配置 + 跑 benchmark"而不是"手改 kernel + 祈祷"。
**muh 的状态**: PRD 设计阶段,还没有代码
**muh 的状态**: v0.3 — 6个算法的C++ tuning headers已就绪(reduce/scan/topk/transform/batch_memcpy/for)compile_test 33项通过gen_patch.py从C++ headers提取bi100值生成vllm patches。参数值从CCCL SM100复制等BI-V100实测替换
## 四、已完成的工作
@@ -93,9 +93,9 @@ muh 是我们设计的 **tuning DSL领域特定语言**,用于:
## 五、还没做的(下一步)
1. **muh 语言 PRD 设计** — 定义 muh 的 schema、语法、codegen target、参数空间
2. **muh PRD items 写入 project 6** — 作为真实 Issue带 label 和测试用例
3. **从 CCCL tuning_*.cuh 提取参数空间** — 建立"CCCL tuning 维度 → muh 配置项"的映射
1. ~~muh 语言 PRD 设计~~ ✅ Done — muh是C++ header-only lib不是独立语言
2. ~~从 CCCL tuning_*.cuh 提取参数空间~~ ✅ Done — 6个算法的policy_selector已实现
3. **在BI-V100上跑benchmark** — 用实测数据替换bi100_*中的SM100复制值
4. **获取 enginex-vllm-bi100-qwen36 的实际代码** — 需要在 Phanthy Cloud 开发环境里操作
5. **设计 muh → vllm kernel 的 codegen 管道**
6. **实际在天垓100 上跑 benchmark**