Skip to content

refactor(runtime)!: adopt the modern Infini stack - #506

Draft
voltjia wants to merge 49 commits into
mainfrom
refactor/adopt-modern-infini-stack
Draft

refactor(runtime)!: adopt the modern Infini stack#506
voltjia wants to merge 49 commits into
mainfrom
refactor/adopt-modern-infini-stack

Conversation

@voltjia

@voltjia voltjia commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Rebase and preserve the InfiniCore-to-InfiniLM runtime migration on InfiniLM main at 80bb09ecebc9aabf198b9b866a89456bca1df946.
  • Synchronize the effective InfiniCore changes that landed after the migration source diverged, while retaining InfiniLM's stronger graph ownership, cancellation, and allocation-lifetime behavior.
  • Replace legacy/deprecated operator paths with current InfiniRT, InfiniOps, and InfiniCCL APIs.
  • Enable the currently validated NVIDIA and Moore execution paths, including explicit FlashAttention, paged segmented graph replay, tensor parallelism, and real-weight model coverage.
  • Fix Moore communicator initialization so short-lived worker threads select the native device without constructing and tearing down thread-local InfiniCore runtimes.

Current head: 5de9a0283ec66ed30006372c535a75983407cdfb.

The branch contains 43 commits on top of current main and remains mergeable.

Related to InfiniTensor/InfiniCore#1373.

Migration and Runtime Changes

  • InfiniLM owns the migrated runtime context, tensors, graph integration, operator adapters, distributed wrappers, and Python bindings.
  • Segmented graph replay keeps capture-unsafe MhaKVCache work in host segments while the remaining operators run in device-graph segments; TP paged decode no longer falls back to a wholly eager engine.
  • Static graph cache metadata stays device-resident and observes in-place replay updates.
  • The deprecated causal-softmax backend is removed from execution; the adapter composes current triangular-mask and softmax operations.
  • Linear bias is implemented as Gemm with beta=0 plus broadcast Add, including correct row/column-parallel placement and pre-transposed weights.
  • The dense factory enables validated Baichuan, ChatGLM, FM9G, GLM4, InternLM3, Llama, MiniCPM/MiniCPM4, Qwen2, and Qwen3 families.
  • Moore accepts its native device name and selects a dedicated 23-operator InfiniOps manifest; NVIDIA retains the 24-operator manifest including sampling.
  • Communicator-init threads call InfiniRT's native backend/device selection directly before infinicclCommInitRank. This avoids heap corruption caused by destroying a short-lived InfiniCore Runtime in each worker thread.

Current Upstream Stack

#506 uses AllGather, Send, and Recv, so #57/#58/#59 remain required. #69 is an independent master-based prerequisite; validation combined its MARCH_TYPE=310 behavior with the API stack.

Newly Validated Moore Capability

InfiniOps #819/#962 provide the missing paged prefill/decode attention closure. InfiniCCL #69 passes the actual MUSA architecture into MCCL so S5000's existing BF16 collective support is visible.

The selected formal matrix passed 13/13 commands:

IDs Workloads Result
D01-D03 9g-8B explicit FlashAttention + graph, batches 1/4/16 PASS
D05 9g-8B paged attention + graph, batch 32 PASS
D14 Qwen3-32B paged FlashAttention + graph, TP4 PASS
D15 Llama-3.2-3B paged FlashAttention + graph PASS
D17 Baichuan2-7B paged FlashAttention + graph, TP2 PASS
D18 ChatGLM3-6B paged FlashAttention + graph PASS
D19 InternLM3-8B paged FlashAttention + graph PASS
D20, D22 MiniCPM4-8B generation and benchmark graph paths PASS
D21 GLM-4-9B paged FlashAttention + graph PASS
D26 MiniCPM4-8B Eagle speculative decoding PASS

Every row reported segmented graph execution with host_segments > 0; none used whole-engine eager fallback. D14 and D17 additionally prove TP4/TP2 communicator setup and BF16 AllReduce. D14 completed in 191.391s and D17 in 74.904s after the two single-purpose fixes.

The formal operator smoke also passed D64/D128 paged prefill/decode coverage: 4 passed, 8 deselected.

All selected Moore commands are greedy/default sampling. Non-greedy sampling remains gated because the Moore manifest does not yet include a supported top_k_top_p_sampling_from_logits implementation.

Preserved NVIDIA Validation

  • Real-weight two-token smokes passed for Llama-3.2-3B, FM9G 9g-8B, Baichuan2-7B, ChatGLM3-6B, InternLM3-8B, GLM-4-9B, MiniCPM4-8B, Qwen2-compatible FM9G-70B TP8, and Qwen3-0.6B.
  • Explicit FlashAttention passed eager and segmented graph paths for Qwen3 and Llama, including Qwen3-32B BF16 TP4.
  • Qwen3 TP2 paged segmented graph passed batch sizes 1 and 16 without CUDA_LAUNCH_BLOCKING.
  • Bias, pre-transposition, TP1/TP2, and paged FlashAttention combinations passed the existing focused matrix.

Gates Intentionally Retained

  • FlashInfer attention: the selected linked provider implements sampling, not an attention backend.
  • Compressed-tensors W8A8, AWQ/GPTQ, MXFP4/Quark, and INT8 KV cache: InfiniLM does not yet have complete execution chains for these formats.
  • GPT-2: the required NVIDIA LayerNorm provider is unavailable in the selected closure.
  • Mistral: the current implementation does not consume sliding_window, so a short prompt is not sufficient semantic validation.
  • Mamba, Qwen3-Next, and Qwen3.5: required causal-convolution/selective-scan/gated-delta provider chains are incomplete.
  • Complete MoE and multimodal model-specific paths remain out of scope.
  • Moore non-greedy sampling remains unsupported as described above.

Verification

  • Static contract suite: 83/83 passed.
  • Build-script unit suite: 20/20 passed.
  • Current GitHub Check Format and Ruff jobs: passed.
  • git diff --check: passed.
  • Independent Moore InfiniLM extension build: passed in 118.662s.
  • Two-device and four-device BF16 AllReduce probes: passed with correct numeric outputs.
  • InfiniCCL [DEV] 修改 lanch_server, 支持 vllm benchmark 测试补全文本 #69: explicit mixed-architecture and native-detection builds passed; CTest 2/2 in both configurations; default examples build passed; two-device BF16 AllReduce passed.
  • The InfiniOps pre-rebase hardware-tested commits map one-for-one to the current #819/#962 commits under git range-diff.

Type of Change

  • refactor
  • fix
  • test
  • docs
  • build / CI
  • breaking change

Landing Order

  1. InfiniOps #819.
  2. InfiniOps #962, then retarget it from #819 to master.
  3. InfiniCCL [DEV] 修改 lanch_server, 支持 vllm benchmark 测试补全文本 #69 can land independently.
  4. InfiniCCL 支持海光运行 #57 -> [BUG] test_ppl.py run fail #58 -> Feature/use logsoft max in ppl #59; rebase the stack onto the [DEV] 修改 lanch_server, 支持 vllm benchmark 测试补全文本 #69-updated master before updating the final component pin.
  5. InfiniCore #1406 updates its InfiniCCL and InfiniOps component pins to the merged heads.
  6. This PR.

This PR remains draft until the upstream component PRs and final pins land, but it is ready for code review against the dependency order above.

@voltjia
voltjia force-pushed the refactor/adopt-modern-infini-stack branch 3 times, most recently from 7c36e2f to 077867b Compare August 13, 2026 15:26
voltjia added 25 commits August 25, 2026 12:53
BREAKING CHANGE: legacy InfiniCore runtime and inference APIs are removed in favor of InfiniRT, InfiniOps, and the migrated InfiniLM runtime.
Carry segmented P2P graph replay, graph-aware tensor initializers, runtime compatibility helpers, and long-context chunking into the InfiniLM-owned runtime.

Preserve the stronger migrated graph ownership, cancellation, and allocation lease semantics while reconciling current InfiniLM attention behavior.
@voltjia
voltjia force-pushed the refactor/adopt-modern-infini-stack branch from 9439ea6 to 9d64e14 Compare August 25, 2026 05:12
@voltjia
voltjia force-pushed the refactor/adopt-modern-infini-stack branch from 03d7533 to dcfbebc Compare August 31, 2026 07:07
@voltjia
voltjia force-pushed the refactor/adopt-modern-infini-stack branch from 2a44095 to 5de9a02 Compare September 2, 2026 14:17
voltjia and others added 2 commits September 3, 2026 11:11
…ention

feat(cambricon): enable tensor-parallel flash attention
* feat(iluvatar): enable modern Infini stack

* feat(iluvatar): enable canonical attention adapters

* feat(iluvatar): enable flash attention backend

* fix(iluvatar): address review feedback

* fix(model-loading): mmap zip-format pytorch checkpoints

* fix(bench): reuse paged cache during warmup
throw std::invalid_argument("infinilm::config::ConfigFactory::createConfig: Unsupported model config type: " + model_type);
}

static const std::unordered_set<std::string> kModernModelTypes{

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm

const std::string quant_method = quantization_config.value("quant_method", "");

// Determine the quantization scheme from the JSON config
if (quant_method == "compressed-tensors") {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥在这儿就都不支持了,我感觉是不是到了算子调用再拦住比较好。不然回头把东西补回来的时候又要一串一串改。

以及之前的全量测试好像确实忘记加量化相关的东西了

gongchensu and others added 3 commits September 9, 2026 09:41
Register Hygon with the canonical InfiniOps bridge, greedy sampling, RoPE cache, and FlashAttention adapters.

Extend the integration builder with Hygon architecture and RCCL wiring. Keep the platform-specific InfiniOps operator selection outside the repository and require it through --operator-config, matching the Iluvatar workflow.
* perf(runtime): make stream access constant time

* perf(mlp): consume packed gate-up output

* perf(ops): cache default infiniops implementation

* perf(paged): reuse decode metadata buffers

* perf(cache): skip unused paged cache scale upload

* perf(graph): avoid eager output snapshots

* perf(inference): optimize reviewed execution paths

* perf(speculative): reuse graphs for token verification

* perf(paged): capture ChatGLM short decode graph

* test(runtime): cover optimized inference paths

* style: format optimized inference paths

* refactor(graph): centralize reviewed profile checks
throw std::invalid_argument("infinilm::config::ConfigFactory::createConfig: Unsupported model config type: " + model_type);
}

static const std::unordered_set<std::string> kModernModelTypes{

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

所以现在是要求显示列举支持的模型类型了么?本来应该是不需要的

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上,这样以后恢复起来岂不是很费劲。由缺失算子支持造成的问题还是建议直接暴露在算子层,而不是直接从基建里把痕迹都移除了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants