Repository navigation
Conversation
Ringssss
marked this pull request as ready for review
November 19, 2026 07:37
CloverGenerator and the clover chat server hard-coded the Hygon platform, which blocked the (already multi-device) InfiniOps providers from running the native block-diffusion path on any other accelerator. - CloverGenerator gains a device parameter (default "cuda") with an explicit platform -> Torch device mapping; engine dtype now flows into the logits copy-out instead of a fixed bfloat16, and every hard-coded cuda:0 / hygon literal is derived from the selected device. - clover_server --device (default auto) reuses the framework's device resolution; --tp default drops to 1 for single-GPU startup. - Docs describe the validated A100 (CUDA 13.1, TP2) configuration next to the Hygon one. - Ignore pip editable-install artifacts; bump the InfiniCore submodule pointer to the multi-device InfiniOps operators. Verified on NVIDIA A100 TP2 with Clover-35B-A3B-Preview: baseline and frontier policies generate correct text; device aliases (cuda/nvidia) resolve identically and unknown platforms are rejected up front.
`CloverGenerator._forward` passed `[1, tokens]` positions. `Mrope` reads a two-dimensional tensor as `[3, tokens]` axis rows, so with contract asserts compiled out the kernel took the h and w rows from the memory after the positions buffer. Clover uses a single position axis, so pass the packed `[tokens]` form.
The top-level README's entries build InfiniOps as Release through `pip install` and InfiniCCL as Release through `scripts/build.sh`, while the InfiniRT command sets no build type. The Hygon block now matches them.
`examples/test_clover.py` generates text for a few prompts. `test/diffusion` records the logits of the checkpoint's reference implementation along its block diffusion trajectory, replays the same trajectory with the engine and reports the KL divergence from a float32 reference. A probe compares the `Mrope` kernel with the checkpoint's rotary for each positions layout.
Clover runs on both platforms, so the guide and its CMake preset drop the `-hygon` name, the README entry is no longer "Clover on Hygon", and the build, generation and serving examples start from NVIDIA with the Hygon differences noted. A note that applies to both platforms moves out of the Hygon build block, and the throughput numbers are labelled as recorded on Hygon. The validation image keeps its name: it is the record of the Hygon campaign. The guide also gains two notes. On Hygon gfx936 the fused MoE runs the native InfiniOps kernels, and INFINI_OPS_HYGON_MOE_TRITON=1 selects the Triton ones. The `pip install -e` step copies the Infini libraries into python/infinilm/_lib and the package loads those copies, so it has to be repeated after rebuilding one of them.
InfiniOps PR #1015 replaces CloverRecurrentGdn with a packed overload of RecurrentGatedDeltaRule that takes the state pool, the sequence offsets and the initial and final slots. The causal replay of the GDN layer calls it; the preview operators are unchanged. BREAKING CHANGE: requires InfiniOps PR #1015 at 3a046113 or later.
The InfiniOps guide that held these notes is removed upstream. Keep in the InfiniLM guide what matters here: which shapes take the native kernels, how to select the Triton kernels, and the measured gain for spread and concentrated routing.
InfiniOps dropped INFINI_OPS_DECLARATIONS in favor of ops.json
selection. The InfiniLM profiles ship in the InfiniOps checkout
(scripts/configs/infiniops_ops_{hygon,nvidia}_infinilm.json) beside its
own build profiles, documented in its docs/build-hygon-inference.md; the
guide's build commands pass them through -DINFINI_OPS_OPS. docs/clover-
ops.cmake and the two repository-local json files are gone.
BREAKING CHANGE: the documented InfiniOps build passes -DINFINI_OPS_OPS
pointing into the InfiniOps checkout instead of -C docs/clover-
ops.cmake.
Add the NVIDIA counterpart of the Hygon validation record: the same client, workload, prompts and sampling controls on two A100 80GB with TP=2, BF16 and concurrency one, 32 prompts x 3 repeats after a warmup. baseline 96/96 44.09 tok/s joint 96/96 58.51 tok/s The joint path is 1.327x the native baseline. Each variant answered the workload's own check on all 96 requests; this checks the fixture, not general quality. The SGLang comparison was not run (that port is not available on the NVIDIA host). Also reword the note that placed every throughput number on Hygon.
The clover extras duplicated the server and torch groups under a model name and carried triton, which nothing in InfiniLM imports: it is a runtime dependency of the InfiniOps in infini package, and the DTK Torch wheel ships it. Installing '.[server,torch-compat]' covers serving and local generation alike; the guide states what each group is for and where Triton comes from.
humannumber196
force-pushed
the
feat/clover-hygon-diffusion
branch
from
November 26, 2026 07:52
5698cc1 to
a653798
Compare
Review fixes for PR InfiniTensor#604. Server: the generation lock is a threading lock held inside the worker for the whole synchronous generate, so a cancelled request coroutine no longer releases the slot while its thread still runs - a second request waits for the first generation to actually return instead of resetting the engine cache under it. The OpenAI endpoint maps max_completion_tokens onto the generation cap and rejects stop sequences and n > 1 with a 4xx instead of silently ignoring them. Generator: the logits copy stages through a buffer of the source dtype, so a BF16 model with an FP32 output head copies FP32 logits without truncation (the engine_logits script likewise); the TP ranks sit on the caller's indexed device for tp=1, while a bare platform name keeps the first tp ranks. Native entry: the preview input must be exactly [1, block_size] - [2, 16] and [1, 64] take unsupported paths through the layers - and the MRoPE positions are checked for the packed [tokens] or axis-row [3, tokens] layout before any device submit; a 2-D [1, T] row would otherwise read out of bounds in release builds. Scripts: the engine_logits first-block comparison generates with ignore_eos and compares the complete block, so an early EOS no longer truncates both sides into a vacuous pass; compare_logits returns zero samples for a stage no case recorded instead of crashing on an empty concatenation.
Round-2 review fixes for PR InfiniTensor#604. The MRoPE position validation moved from the preview branch to the shared Clover forward entry, so prompt prefill and causal replay are checked as well: positions must be the packed [tokens] row or the [3, tokens] axis-row form on every path, before any device submit. The OpenAI endpoint computes one effective token cap and shares it between the generation and the finish_reason, so an honored max_completion_tokens request reports `length` at exactly that cap, including a cap of zero. A device object names one specific accelerator like an indexed string does: both map their normalized index onto the TP config for tp=1, while a bare platform name keeps the first tp ranks. The generation slot is one FIFO that every request joins, the running one included. A request cancelled while waiting vanishes at its own await point before any worker starts; a request cancelled after dispatch keeps its shielded worker to the end so the slot is released exactly once. A queued request cancelled just before its worker would start is seen by the worker and yields without generating.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
clover_moemodel using the existing Qwen3.5-MoE modules, strict checkpoint mapping, FP32 recurrent state and native InfiniOps providers.Motivation
Clover-35B-A3B-Preview was unsupported by the native Hygon stack. This runs full checkpoint inference in InfiniLM C++ on two Hygon BW 64GB DCUs. Torch is used for token-confidence selection; model forward does not use a Torch/Transformers or SGLang fallback.
Dependencies, in order:
The dLLM-serve adaptation is the frontier/stride mechanism, with a confidence floor and immediate progress for already-confident positions. The supplied dllm-h100 study informs top-4 preview routing and TV6 live-row reuse with refresh interval five. This PR does not claim the full admission/compaction scheduler or the H100 DP/EP communication pipeline. The endpoint currently serializes requests; that boundary is explicit in the guide.
Type of Change
feat— new model and decoding pathtest— checkpoint mapping, frontier and full-model validationdocs— supported configuration and reproductionbuild— dependency pin / optional decoder dependenciesTest Results of Involved Models on Supported Platforms
Hygon BW/gfx936, DTK 26.04, Torch 2.10.0, Triton 3.5.0, BF16 TP2, eager static cache, 2048 context capacity:
The native baseline matched local SGLang token IDs on the four initial prompts. Other inputs can differ across the kernels' floating-point paths. These fixture checks do not establish general accuracy equivalence. The lower confidence floors 0.3/0.5 were rejected after repetition/invalid Python appeared.
This is a rendered record of measured test output, not a terminal screenshot. The original request/response logs and traces are retained with the local integration artifacts.
Benchmark / Performance Impact
Same complete model/tokenizer, BF16, TP2, greedy sampling, neutral penalties, thinking disabled, 32 mixed prompts, three measured repetitions after warmup, concurrency one. Prompt/output caps and client endpoint are shared. Throughput uses visible completion tokens retokenized with the same tokenizer, divided by summed client request time; padded diffusion usage counters are excluded.
Joint/native is 1.397x and joint/local-SGLang is 6.791x. Joint repetitions measured 39.85–40.02 tok/s. This is serial short-prompt throughput, not peak concurrent capacity, and compares the local iterative SGLang port rather than Clover's official self-speculative implementation. The SGLang reference runs on a separate identical TP2 pair on the same host.
examples/bench_clover.pyandtest/diffusion/workload.jsonreproduce the HTTP workload. Seedocs/clover-hygon.mdfor launch/build details. Separate profiles verify dispatch and are excluded from timing.Notes for Reviewers
Supported now: BF16, Hygon, eager/static cache, greedy non-streaming text, causal block commit. The model's 128K maximum context, general continuous batching, graphs, multimodal input, stochastic sampling and official AR-verify speculation are not validated by this change. Unsupported endpoint options are rejected explicitly.
Review block/slot boundaries, state immutability, full-route causal replay after approximate preview, and the shared attention preview flag. The checkpoint cast bridge also rejects same-address dtype conversion before writing, restoring an existing loading regression invariant discovered during integration.
This remains a draft pending dependency review and the broader model/service integration expected by the repository. The dedicated Clover generator/server is the validated path; the generic AR
examples/test_infer.py/examples/bench.py/ benchmark suite does not yet drive diffusion.CI / ChatOps
Fork Ruff CI passed. The rerun at https://github.com/Ringssss/InfiniLM/actions/runs/40928429479 passed Host behavior, Check Format, dependency identity, and matrix generation. The NVIDIA build/package job is queued for an external runner. The earlier fork-only format failure was caused by a stale fork main; syncing the fork resolved it without unrelated source changes. Local checks using the CI formatter versions also pass all 24 changed code files.
Checklist
Title, Branch, and Commits
feat/with hyphen-separated words.mainat preparation.Scope and Design
General Code Hygiene
git diff --checkpassed.C++ Specific
llama_legacy.scripts/format.pywith the CI formatter version.Python Specific
auto_config.py.Testing
examples/test_infer.py: AR entry point; dedicated Clover generator validated instead.examples/bench.py: AR entry point; paired Clover HTTP/offline measurements supplied instead.Build, CI, and Tooling
Documentation
Security and Safety