Skip to content

Qgy - #1054

Open
qinguoyong wants to merge 61 commits into
InfiniTensor:masterfrom
szl1369117765:qgy
Open

Qgy#1054
qinguoyong wants to merge 61 commits into
InfiniTensor:masterfrom
szl1369117765:qgy

Conversation

@qinguoyong

Copy link
Copy Markdown

Summary

Motivation

Closes #

Type of Change

  • feat — new feature / new operator / new platform
  • fix — bug fix
  • perf — performance improvement (no behavioral change)
  • refactor — code restructuring without behavior change
  • test — adding or fixing tests only
  • docs — documentation only
  • build / ci — build system or CI configuration
  • chore — tooling, formatting, or other non-code changes
  • Breaking change (requires a ! in the Conventional Commits prefix or a BREAKING CHANGE: footer)

Platforms Affected

  • CPU (WITH_CPU)
  • NVIDIA (WITH_NVIDIA)
  • Iluvatar (WITH_ILUVATAR)
  • MetaX (WITH_METAX)
  • Cambricon (WITH_CAMBRICON)
  • Moore (WITH_MOORE)
  • Ascend (WITH_ASCEND)
  • PyTorch C++ bindings (WITH_TORCH)
  • Build system / CMake / CI
  • Python bindings / user-facing API

Smoke Test Result

paste smoke test output here

Test Results on Supported Platforms

Platform Affected Build / Smoke Result Full Result / Notes
NVIDIA
Iluvatar
MetaX
Cambricon
Moore
Ascend
Full `pytest` output (optional)
paste here

Benchmark / Performance Impact

Notes for Reviewers

songzhl and others added 19 commits November 16, 2026 11:28
Add dedicated Hygon providers with optimized decode and short-sequence
paths while retaining FP32 scan state and generic layout fallbacks.

Validation: clang-format and gfx936 provider instantiation compilation.
feat: add optimized Hygon Mamba conv and scan kernels
feat: add optimized VideoNSA operators
Protect Conv state-pool permutations and reject unsupported tensor overlap.
Use a block-wide read-before-write recurrence for short sequences to avoid
an extra history snapshot node while retaining the indexed/strided fallback.

Replace benchmark-shape capture restrictions and duplicated special cases
with reusable kernel families, preallocated workspace, and release metadata
validation. Keep Scan recurrence state in FP32 and widen scalar indexing.

Validation: Hygon gfx936, DTK 6.3.26113; 36 fixed Conv-Scan eager/native-Graph
checks passed with at least 12% latency reduction against vLLM. Graph
reductions ranged from 25.010% to 66.904%. All 54 targeted correctness checks
passed. Both headers passed clang-format and git diff --check.
Add wave64 Top-6 routing, fixed-width per-channel quantization and
SDOT4 single-row INT8 GEMV paths with generic fallbacks. Add HYGON
per-tensor quantization and dequantization with strided and graph support.
Preserve the new repository rounding, scale and normalization rules.

Validate on gfx936: routing 168, channel quantization 84, GEMV 72,
per-tensor quantization 270 and dequantization 378 numerical checks;
130 graph replays, 9 invalid-input and 12 public API checks.
Full model integration and final performance acceptance remain pending.
@qinguoyong
qinguoyong requested a review from a team November 24, 2026 16:19
qinguoyong and others added 10 commits November 25, 2026 03:25
Populate scalar Mul shape and strides so the Torch backend writes every
element. Validate CPU Cast storage spans and aliases before writes,
including cached calls, and use each operand's rank for strided indexing.

Add standalone CPU/Hygon public API regressions. Verified 24 CPU scalar,
48 combined CPU/Hygon scalar, and 9 CPU Cast checks. The actual LM W8A8
layer passes 16 eager cases and 48 graph replays after the scalar fix.
Performance acceptance remains pending.
Use packed integer dot products and one wave per output channel on Hygon.
Reduce quantization barriers with wave reductions. Preserve the SDK's
rounding, scale floor, epilogue order and workspace layout, with the
scalar fallback retained for tail or misaligned weight rows.

Add public SDK regressions for FP32/BF16 routed/shared experts, changing
graphs, invalid routes, grid-stride loops and the safe INT32 dot limit.
Each of two complete runs passed 164 strict checks and 112 graph replays.
Eight scenarios in five rounds per run improved throughput by at least
23.22% against the repository's retained scalar expert kernels. A prior
negative round is retained in the verification record; external SGLang
indicator-10 acceptance and full-model/TP8 validation remain incomplete.
Reuse the existing Hygon GEMM provider for eligible two-dimensional
BF16/FP16 matrices. Preserve the generic implementation for small,
batched, strided or overlapping cases, and initialize the BLAS handle
before graph capture. Check address overlap at execution to respect
metadata-based operator caching and rebound storage.

Add layout, degenerate leading-dimension, changing-input graph and
storage-rebinding regressions using the existing numerical tolerances.
Keep HIP FP32 reference matmuls in IEEE mode to avoid PyTorch 2.10 TF32
state conflicts; other backends retain their existing precision setting.
Server validation passed 132 Hygon and 57 CPU pytest cases, two batches
of 150 public API checks plus 450 graph replays, and 60 native device
graphs with 180 changing-input checks. Twelve accelerated scenarios
exceeded +12% against the retained scalar implementation in five rounds
of both batches. External reference and full indicator-9 acceptance
remain incomplete; this is not an end-to-end performance claim.
perf(hygon): migrate routing, matmul and W8A8 kernels
Port the short pooling kernel from 3c263b6 and its live option from ffb4154. Leave the option disabled by default.
(cherry picked from commit bf556b534eef031524449f9cc7ad962bd53c654b)
(cherry picked from commit 5934325f67ba079c04215c377095f6d47201d9a4)
(cherry picked from commit d4420e4493cf26beb2ad83d6a5614496b50ad1c0)
(cherry picked from commit 46c26ea1c0489b1f0f7ffb00ed475f3e2ac8da91)
Jay-Xiong and others added 24 commits November 26, 2026 11:28
Accelerate C4 indexing, compressed KV storage, Sparse MLA, mHC, RMSNorm, and W8A8 expert and linear projections.
Use the short provider path while preserving the accumulation order.

Original-snapshot: 2933e4b
Group Hygon MoE expert GEMVs and reuse packed INT8 projection weights.

Original-snapshot: abe56cc
Add the shared-expert and projection paths, select scratch with the live option, and declare the required GEMV launch bounds.

Original-snapshot: 8ba14b1
Allow an eligible C128 state update to omit the unpublished pooled output.

Original-snapshot: 4aabfb3
Expose schedule preparation and consumption while retaining the original sparse MLA API and per-layer scratch.

Original-snapshot: bd29638
Add independent M12 selectors for grouped W8A8 experts and packed INT8 projection.

Original-snapshot: e429475
# Conflicts:
#	src/native/cuda/hygon/ops/deepseek_v4_w8a8_experts/kernel.h
#	src/native/cuda/hygon/ops/i8_gemm/kernel.h
Reuse templated decode and prefill families for neighboring shapes. Improve
BF16 packed state access and resource-based Scan dispatch while preserving
FP32 recurrent state, indexed-pool synchronization, and generic fallbacks.
Separate Conv host launch policy from device functions and centralize Scan
family selection without adding descriptor or pointer caches.

Validation on Hygon gfx936 with DTK 6.3.26113:
- Fixed Conv-Scan matrix: 36/36 eager/Infini Graph checks passed the 12%
  latency-reduction gate against vLLM; minimum reduction was 23.632605%.
- All 102 targeted correctness checks passed.
- Native Infini Graph traces matched optimized kernels for all 18 sizes.
- Fixed Mamba model regression passed 18 configuration/batch cases and 90
  timed samples; model Graph traces matched the optimized kernels.
- Project clang-format and git diff --check passed.

Only the two Hygon Mamba headers are included. Model Graph test adapters,
benchmark data, and other projects remain outside this commit.
Pack adjacent channels in indexed Conv prefill while preserving FP16
pre-bias rounding, state-pool snapshots, and wide/unaligned fallbacks.
Stage B/C tiles in shared memory for canonical Scan recurrences and
cooperatively load prefix coefficients and FP32 state. Select block widths
from workload and resource budgets; keep existing decode kernels intact.

Validation (2026-11-26, Hygon gfx936, DTK 6.3.26113):
- Fixed Conv-Scan matrix: 36/36 eager/Infini Graph checks passed the 12%
  latency-reduction gate against vLLM; minimum reduction was 27.927269%.
- All 166 functional checks passed, including cross-tile FP32 carry,
  state-pool permutations, exact aliases, and unaligned fallbacks.
- Infini Graph traces matched the optimized kernels for all 18 sizes.
- Fixed Mamba regression passed 18 configuration/batch cases and 90 timed
  samples; full model Graph traces matched the optimized kernels.
- Project clang-format and git diff --check passed.

Only the two Hygon kernel headers are included in this commit.
perf: optimize Hygon Mamba conv and selective scan
Batch mHC decode, tile C4 scoring, reuse decoded MLA pages, and reduce expert data movement. Keep the new dispatch paths opt-in.
Add explicit WQ_A and WKV scale ordering and reference C4 compression arithmetic. Retain the optional tiled W8A8 projection path.
Reduce sparse MLA page expansion and mHC prefill work. Add optional attention, projection, and expert kernel paths while retaining reference rounding.

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.

6 participants