Commit Graph

16 Commits

Author SHA1 Message Date
claude
ec140f3605 docs: complete porting assessment — 5 repos, 2660 build targets, ivcore10 compatibility
cat'd every source:
  - CCCL c/parallel/src/reduce.cu: NVRTC JIT (cannot port directly)
  - CCCL c/parallel.v2/src/reduce.cu: hostjit/libnvcc (cannot port directly)
  - CUB block/warp headers: pure header-only (CAN compile with corex)
  - CUTLASS SM70 SIMT GEMM: CAN port (example 24 grouped_gemm)
  - FlashAttention: SM80 Tensor Core (cannot port), but layer_norm is SIMT
  - FLA: pure Triton (needs corex Triton verification)
  - xllm ILU: all already ported

Key finding: CCCL c/parallel depends on nvrtc JIT — must bypass with AOT compilation
using CUB header-only API + corex clang --cuda-gpu-arch=ivcore10
2026-08-14 08:17:25 +00:00
muh
0cfdb6ae5d [docs] CCCL ↔ EngineX architecture alignment — from reading 3792 CCCL source files
Documents the three-layer mapping between CCCL's device-level API
(dispatch/kernel/agent) and EngineX's actual execution surface
(precompiled .so + Triton JIT + Python runtime).

Key finding: EngineX has ZERO .cu source files. All CUDA kernels are
precompiled in 3 .so files. Our optimization surface is:
1. Python runtime params (paged_attn.py, _custom_ops.py)
2. Triton JIT kernels (flash_attention, rmsnorm, rope, splitk)
3. Server config (computility-run.yaml)

CCCL patterns applied:
- GridEvenShare (grid_even_share.cuh) → V1/V2 dispatch + tile sizing
- Compound reduce (summary_statistics.cu) → online softmax accumulator
- Two-phase reduce (kernel_reduce.cuh) → paged_attention_v2 partition/merge
- spread_out_items_per_thread (dispatch_transform.cuh) → Triton BLOCK_SIZE
- Lookback delay (tuning_scan.cuh) → no_delay optimal for 16 SMs

Source: read agent_reduce.cuh (425 lines), kernel_reduce.cuh (290 lines),
dispatch_reduce.cuh (530 lines), grid_even_share.cuh (180 lines),
dispatch_transform.cuh (250 lines), kernel_scan.cuh (175 lines),
tuning_reduce.cuh (478 lines), common.cuh (330 lines),
flash_attention.py (230 lines), rmsnorm_kernels.py (140 lines),
triton_splitk.py (739 lines), prefix_prefill.py (866 lines)
2026-08-06 06:02:40 +00:00
muh-pipeline
11cbc00cf2 [DOCS] CCCL benchmark reference: 199 annotations from 27 tuning files extracted
Extracted all benchmark data from cccl_upstream tuning headers:
- 199 benchmark annotations (ipt_N.tpb_M speedup format)
- 286 template specializations across SM80/SM90/SM100
- Top files by data density: radix_sort(70), reduce_by_key(32),
  scan_by_key(30), unique_by_key(29), scan(16)
- Full delay algorithm reference (8 dcid variants)

Key finding: muh headers have 19% of CCCL's code volume (1348 vs 7113
lines for the 4 critical algorithms). The gap is benchmark DATA, not
code structure. CCCL's tuning files carry real hardware speedup numbers;
muh's bi100_* structs carry theoretical values needing BI-V100 validation.

Critical muh vs CCCL divergences documented:
- reduce: muh items=24 vs CCCL items=16 (2.5x more work/thread)
- scan: muh missing all delay parameters (ns, dcid, l2w)
- radix_sort: muh has 0/70 benchmark entries
- select_if: muh has 37 from 3-dimension restore, CCCL has 0 in comments
  but 77 specializations in template code

Refs: project_6 PRD items [muh-bench] reduce/scan/topk/transform
2026-08-06 02:16:42 +00:00
project_6
4e16133c7a [analysis] MoE execution path: 640+ kernel launches/step, 192 CUDA mallocs/step
Critical finding from reading fused_moe.py end-to-end:

The real decode bottleneck is NOT tuning parameters. It's:
1. 640+ ixformer kernel launches per decode step (64 MoE layers ×
   ~10 ops each). At target 395 TPS = 253K launches/second.
2. 192 torch.empty calls per step (3 intermediate caches × 64 layers).
3. Python-level dispatch overhead for each of these calls.

The BLOCK_SIZE_M heuristic is already reasonable (16 for decode).
The fused_moe Triton kernel is dead code — ixformer's C++ kernel
is called instead.

Actionable optimization: pre-allocate intermediate caches outside the
layer loop to eliminate 192 CUDA mallocs per decode step.

Source: vllm/model_executor/layers/fused_moe/fused_moe.py
        vllm/_custom_ops.py (ixf_F.vllm_invoke_fused_moe_kernel)
        cccl_upstream/cub/cub/device/dispatch/tuning/tuning_batch_memcpy.cuh
2026-08-05 03:58:07 +00:00
project_6
5ca49d0e7c [docs] GridEvenShare work distribution — BI-V100 attention reduce needs only 9 CTAs
From reading cccl_upstream/cub/cub/grid/grid_even_share.cuh:

Key finding: For Qwen3.6 attention score reduction (100K seq_len),
with tile_items=12288 (512 threads × 24 items), only 9 CTAs are
needed. All fit in one wave on 16 SMs.

This means reduce tuning (items/threads) matters less than the V1/V2
dispatch choice in paged_attn.py. V1 uses a single CTA iterating
sequentially over all KV blocks, completely bypassing GridEvenShare's
parallel distribution. V2 would enable partition-based parallelism.

Also documents: RAKE (scan) vs STRIP_MINE (reduce) strategies,
'big shares' load balancing, and the SingleTile fast path for
short sequences.
2026-08-05 03:36:45 +00:00
project_6
c17e517e9e [docs] CCCL transform architecture — vectorized vs prefetch, bytes_in_flight scope
From reading cccl_upstream/cub/cub/device/dispatch/tuning/tuning_transform.cuh:

1. BI-V100 can only use prefetch and vectorized algorithms.
   ldgsts (SM80+ cp.async) and ublkcp (SM90+ bulk copy) are NVIDIA-only.

2. bytes_in_flight only affects the PREFETCH path. For vllm's
   contiguous fp16 element-wise ops (RMSNorm/SiLU/RoPE), the
   VECTORIZED path is selected, where items_per_thread is fixed
   at compile time, not derived from bytes_in_flight.

3. CCCL's cc_to_min_bytes_in_flight: B200=64KB, H100=48KB, A100=16KB,
   V100=12KB. Our 64KB matches B200 level (56 GB/s/SM ≈ B200).

4. Bench result alg=1 confirms vectorized path is used on BI-V100.
   The vectorized default {256, 8, 4} matches the benchmark winner.

Source: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_transform.cuh
2026-08-05 03:36:00 +00:00
project_6
e36da2efa9 [docs+code] lookback delay is a no-op on BI-V100 + V2 compound reduce pattern
Two findings from reading CCCL source code:

1. single_pass_scan_operators.cuh: delay() has GridThreshold=500 gate.
   BI-V100 scan launches ~12 blocks (100K elements / tile_size).
   12 < 500, so ALL delay policies collapse to __threadfence_block().
   Conclusion: delay_ns, delay_l2w, delay_algorithm are IRRELEVANT
   on BI-V100. Only threads/items/load/scan algorithms matter.

2. summary_statistics.cu compound reduce pattern maps directly to
   paged_attention V2's cross-partition reduce. Updated muh_kernel_map.py
   with the structural mapping and the V2 dispatch bug (use_v1=True
   hardcoded in paged_attn.py line 99).

Source: cccl_upstream/cub/cub/agent/single_pass_scan_operators.cuh
        cccl_upstream/thrust/examples/summary_statistics.cu
2026-08-05 03:35:07 +00:00
project_6
f8153d492a [docs] agent_scan.cuh architecture — scan SMEM is real, reduce SMEM is not
Critical finding: scan and reduce have fundamentally different SMEM
models. Scan uses BlockLoad/BlockStore with WARP_TRANSPOSE which
puts tile data through SMEM (threads*items*type_size bytes). Reduce
keeps tile data in registers and only uses SMEM for BlockReduce
communication (~threads*4 bytes).

This means:
- Our SMEM constraint is CORRECT for scan (tuning_scan.cuh values
  are properly bounded)
- Our SMEM constraint is WRONG for reduce (tuning_reduce.cuh could
  use larger items_per_thread, especially for small types)
- The same check_smem() function should NOT be used for both algorithms

Source: cccl_upstream/cub/cub/agent/agent_scan.cuh _TempStorage union
2026-08-05 03:33:40 +00:00
project_6
3cc97c1d4e [docs] CCCL scan architecture — lookback vs lookahead, tile_state allocation, grid sizing
Key findings from reading dispatch_scan.cuh:
1. Lookahead scan requires PTX ISA >= 860 (NVIDIA SM100+), completely
   unavailable on BI-V100. Our lookback-only strategy is correct.
2. Lookback scan passes 0 dynamic SMEM — SMEM is all static via
   __shared__. Different from lookahead which uses dynamic stages.
3. Scan launches exactly num_tiles blocks (not sm_count * subscription),
   one CTA per tile. For 100K tokens: ~12 tiles all fit in one wave
   on 16 SMs, explaining why no_delay (dcid=0) is optimal.
4. Lookahead's num_stages auto-tuning is irrelevant for BI-V100 but
   reveals NVIDIA's pipeline depth selection strategy.
2026-08-05 03:21:51 +00:00
project_6
55b704c0e0 [docs] CCCL reduce architecture deep dive — SMEM model correction + V1/V2 dispatch finding
Read dispatch_reduce.cuh, kernel_reduce.cuh, agent_reduce.cuh,
tuning_reduce.cuh, and util_arch.cuh from cccl_upstream.

Key findings:
1. Reduce tile data is in REGISTERS, not SMEM. Our test_smem_safety
   model (tile = threads * items * type_size) checks scale_mem_bound's
   register-pressure cap, not actual SMEM usage. Real SMEM ≈ threads *
   sizeof(AccumT), which is 2-8 KB, not 32-49 KB.

2. scale_mem_bound vs scale_reg_bound serve different purposes:
   mem_bound allows items to 2x expand (for small types), reg_bound
   does not. Both use 48KB as register-spill prevention, not SMEM.

3. Our float64 tuning (threads=384) may be too conservative. CCCL
   SM100 uses threads=640 for float64 — this doesn't overflow SMEM
   because SMEM is only used for BlockReduce communication.

4. paged_attn.py line 99 hardcodes use_v1=True, completely disabling
   V2 partitioned attention. For 100K token sequences this is suboptimal.

5. _PARTITION_SIZE=512 is hardcoded, should be tunable via muh.
2026-08-05 03:20:56 +00:00
Claude
071fa361a3 docs: CCCL → Triton methodology transfer — parameter search translation table
Maps CCCL %RANGE% benchmark format to EngineX Triton autotune configs:
- prefix_prefill: ipt→BLOCK_M, tpb→num_warps
- triton_flash_attention: 8 configs safety filter by SMEM
- fused_moe: BLOCK_SIZE_M/N/K grid search from CCCL transform/reduce
- Execution plan: hardware confirm → grid search → filter → deploy
- Competitive advantage: systematic search vs guessing
2026-08-03 04:37:23 +00:00
Claude
fee8f1b9e4 docs: document Qwen3.6-35B-A3B bootstrap failure and architecture analysis
vllm 0.6.3 KeyError on qwen3_5_moe model type.
Model is hybrid linear+full attention MoE with 256 experts (top-8).
enginex-vllm-bi100-qwen36-main.zip in repo likely contains the fix.
2026-08-01 13:16:01 +00:00
Claude
9b0d1c283c docs: add competition server profile (4×BI-V100, Qwen3.6-35B-A3B)
Hardware: 4× Iluvatar BI-V100 32GB, Xeon Gold 6530, 503GB RAM
Software: vllm 0.6.3+corex.3.2.3, torch 2.1.0+corex.3.2.3
Model: Qwen3.6-35B-A3B at /root/public-storage/models/Qwen/
Benchmark: benchmark_server_v0.5.0.py with automated sweeps
2026-08-01 13:12:59 +00:00
Claude
173c6afe09 [muh] kernel_map: full vllm→CCCL mapping with SMEM overflow detection
muh_kernel_map.py maps every vllm kernel to its CCCL algorithm(s):
  paged_attention_v1 → reduce (compound: summary_statistics pattern)
  paged_attention_v2 → reduce + scan (two-pass partitioned)
  sampling_topk → topk + radix_sort
  activation_kernels → transform (SiLU/GELU)
  layernorm_kernels → reduce + transform (variance + normalize)
  rotary_embedding → for_each + transform (RoPE)
  cache_kernels → batch_memcpy (KV block copy)

Found 5 lookahead SMEM overflows — documented in SPECIALIZATION_ANALYSIS.md.
These are non-functional (BI-V100 lacks warpspeed pipeline) but the
dispatch correctly falls back to lookback.

The competitive moat:
  Others: tune 5 vllm launch params → hours
  Us: tune 7 CUB primitive dimensions per algorithm × 6 algorithms,
      constrained by SMEM/occupancy/L2, with CCCL benchmark protocol
2026-07-31 11:13:33 +00:00
dylanyunlon
d14b0c19e4 [docs] add CCCL SM100 vs muh BI-V100 specialization parity analysis 2026-07-31 18:35:50 +08:00
Claude
39e32343eb [ARCH] CCCL-derived paged attention kernel architecture + Triton rewrite
Architecture document: docs/paged_attention_kernel_architecture.md
Defines every module from CCCL algorithm patterns before code.

Three-level decomposition from CCCL:
  Level 1 (warp_reduce_shfl): shfl.down butterfly for per-thread QK scores
  Level 2 (block_reduce_warp_reductions): warp partials → SMEM → block aggregate
  Level 3 (agent_scan decoupled lookback): cross-partition combine

Compound type (from summary_statistics.cu):
  attention_partial = (max_score, exp_sum, weighted_v[256])
  combine(a, b) = online softmax rescaling (same math as Flash Attention)

Key design change: Grid on num_kv_heads, not num_heads.
  Before: grid = (1, 24, 200) = 4800 blocks, KV loaded 6x redundantly
  After:  grid = (1, 4, 200) = 800 blocks, KV loaded once per kv_head
  Each block computes GQA_RATIO=6 query heads with shared KV loads.
  Reduces KV cache bandwidth by 6x (the GQA ratio).

SMEM budget verified:
  K tile [32, 256] fp16 = 16KB
  V tile [32, 256] fp16 = 16KB
  Total = 32KB ≤ 48KB ✓

Phase 1 kernel: _partition_attn_kernel
  Processes query heads sequentially within the GQA group
  to minimize register pressure (6 × 256 = 1536 registers
  too many if all loaded simultaneously).

Phase 2 kernel: _reduce_partitions_kernel
  Also gridded on kv_heads, reduces all partitions for
  GQA_RATIO heads per block.

This replaces the previous Triton V2 which was gridded on num_heads
and had no GQA awareness at the kernel level.
2026-07-31 04:13:07 +00:00