Skip to content

feat(hygon): add native Clover diffusion and sparse MoE operators - #1015

Draft
Ringssss wants to merge 1 commit into
InfiniTensor:masterfrom
Ringssss:feat/hygon-clover-operators
Draft

Ringssss wants to merge 1 commit into
InfiniTensor:masterfrom
Ringssss:feat/hygon-clover-operators

Conversation

@Ringssss

Copy link
Copy Markdown

Summary

  • Add Hygon native/Triton providers for Clover preview convolution, bidirectional GDN, FP32 causal state commit, block coreset, live-row routing/cache merge, and packed dense MoE.
  • Enable Hygon Triton JIT module loading using the InfiniRT driver interface; retain gfx architecture and wave-size metadata.
  • Add missing Hygon causal-convolution/gating, layout and rotary providers needed by the model.
  • Add explicit public-API declaration selection for downstream model registries whose unused operators have no provider on this backend.

Motivation

Clover's noisy-block previews must preserve committed recurrent state and read a bidirectional block. The existing Hygon providers cannot execute that model. The companion InfiniLM integration uses these kernels directly from C++, with optional expert budgeting/live-row reuse during preview and full causal replay for commit.

Dependency: InfiniTensor/InfiniRT#52. The build was also checked against the installed Hygon SDK.

Type of Change

  • feat — new operators / backend capabilities
  • build — installed API generation
  • test — numerical/state and JIT metadata checks

Platforms Affected

  • Hygon (WITH_HYGON, added to this template)
  • Build system / CMake
  • Python bindings / user-facing API
  • CPU and NVIDIA: shared JIT/header-generation tooling; their kernel implementations are unchanged

Smoke Test Result

Hygon BW/gfx936, DTK 26.04, Torch 2.10.0, Triton 3.5.0, BF16 data and FP32 recurrent state:

Preview convolution/GDN: widths 1/8/32, batches 1/3; reference checks passed;
clean state remained bitwise unchanged.
Fused MoE: 1/32/64 tokens; independent Torch reference checks passed.
Causal GDN: packed lengths 4/7 and separate slots; output/state checks passed.
Coreset: widths 1/8/32, batches 1/4; routing masks matched exactly.
Live mask, inactive-route omission and cached output merge: passed.

The rebased build passed 62 wrapper/JIT/public-header and Clover tests. The required CPU/Hygon smoke selection passed: 121 passed, 43 skipped (inactive providers), 9485 deselected. Build, tooling and checked-in tests are documented in docs/clover-hygon.md. tests/native/clover_workspace_smoke.cpp exercises workspace-bearing providers through the native public API. Missing workspaces are rejected before launch. The original unguarded Python functional invocation failed; that failed prototype is not included as a passing result.

Test Results on Supported Platforms

Platform Affected Build / Smoke Result Full Result / Notes
Hygon Yes Full library build and numerical/state smoke passed Full-model TP2 generation and HTTP campaign passed; not the entire unrelated operator matrix
CPU API generation Wrapper, public-header and JIT unit tests passed Hygon build also includes CPU providers
NVIDIA Shared JIT metadata handling Unit tests cover CUDA and HIP metadata No NVIDIA hardware available for GPU validation
Iluvatar / MetaX / Moore / Cambricon / Ascend Shared opt-in declaration generator Existing default behavior retained Hardware unavailable; platform CI remains for maintainers

Benchmark / Performance Impact

The companion native InfiniLM campaign uses real Clover-35B-A3B-Preview weights, BF16 TP2, 32 short prompts repeated three times, concurrency one and a common OpenAI chat client. All 96 requests per lane completed. Visible output tokens are retokenized consistently; padded diffusion usage counters are excluded.

Measured integration throughput after upstream sync: native baseline 28.57 tok/s; frontier stride 38.47; expert budget/live reuse 28.70; joint 39.92; local SGLang Clover port 5.88. These are end-to-end integration results, not isolated operator speedups. The measurement record retains all requests, failures, warmups and rejected candidates. Final smoke repairs also cover strided casts and preserving the vendor HIP driver during autotuning.

Separate traces contain GPU events on both TP devices. Live-row kernels occur only in the joint path; summed routed-MoE GPU duration decreases from 1339 ms to 721 ms in the representative profiled request. Profiling time is excluded from throughput and summed device durations are not wall time.

Notes for Reviewers

Preview state is read-only. Causal replay remains exact to the specified recurrent equations; live-row reuse is an opt-in approximation controlled by the LM. The H100 DP/EP sequence-parallel communication pipeline is not ported here.

INFINI_OPS_DECLARATIONS exposes unsupported APIs for compilation/capability queries; it does not create fallback providers. Preserve explicit workspace lifetime and same-stream ordering. The code-generation comment-default issue found during bring-up was already fixed upstream; the branch keeps the upstream implementation.

Source provenance, API alignment, supported layouts and licenses are recorded in the operator guide and THIRD_PARTY.txt. Cross-platform accelerator CI is still needed for the shared tooling changes.

This branch has not been deployed

No deployments
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.

1 participant