Skip to content

feat: add DCU kernel auto optimization task - #26

Merged
myrfy001 merged 6 commits into
HuangPuStar:next-appfrom
fms-zth:feat/dcu-kernel-auto-opt
Sep 2, 2026
Merged

feat: add DCU kernel auto optimization task#26
myrfy001 merged 6 commits into
HuangPuStar:next-appfrom
fms-zth:feat/dcu-kernel-auto-opt

Conversation

@fms-zth

@fms-zth fms-zth commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Add a new dcu-kernel-auto-opt task plugin for automated DCU kernel generation and optimization on Hygon K500SM_AI / gfx928.

The workflow uses multiple isolated agents and GPU workers to generate, benchmark, profile, optimize, synthesize, and validate HIP kernels. The initial production target is INT8 W8A8 GEMM for DeepSeek-V4 TP4/TP8 workloads.

Key changes

  • Add the dcu-kernel-auto-opt task plugin, including:
    • task configuration and form schema
    • orchestration pipeline and phase state machine
    • multi-agent worker lifecycle
    • GPU assignment and parallel exploration
    • correctness and performance acceptance gates
    • PMC/ISA analysis support
    • skill and experience storage
    • final candidate synthesis and serial regression validation
  • Add the trusted INT8 W8A8 GEMM API contract and HIP variant reference.
  • Add the W8A8 benchmark harness and baseline extension template.
  • Add WebUI pages for:
    • guided workload/shape configuration
    • worker and iteration status
    • optimization results and reports
    • task cancellation and cleanup
  • Integrate the custom shape widget with the next-app form widget registry.
  • Improve task process handling:
    • treat zombie processes as stopped
    • expose agent PID and status
    • cancel external agent processes when a task is killed
    • clean up task-owned generated kernel repositories
  • Add unit and integration tests for the new workflow.

Workflow

The task follows this high-level pipeline:

  1. Parse configuration and validate the immutable operator API contract.
  2. Generate or stage the kernel repository.
  3. Measure the trusted baseline.
  4. Run parallel optimization workers, with one worker assigned to each GPU.
  5. Accept candidates only when correctness and performance gates pass.
  6. Synthesize accepted worker artifacts into a final implementation.
  7. Run serial validation across optimization and fallback shapes.
  8. Generate the final report and reusable optimization kno wledge.

Agents are restricted to their assigned source files. Compilation, benchmarking, profiling, artifact verification, and final acceptance remain under control-plane ownership.

Compatibility with next-app

This branch is rebased onto the latest next-app.

The DCU-specific form widget is registered through the new shared form widget registry, and the pipeline has been adapted to the current StateStore.init_or_resume() API.

Validation

Local non-GPU test suite:

200 passed

@fms-zth
fms-zth force-pushed the feat/dcu-kernel-auto-opt branch 2 times, most recently from 3213cb9 to 9fdf083 Compare August 31, 2026 07:34
…ema APIs

- StateStore.init_or_resume() no longer takes task_type (SSOT in
  requirements.json); drop the extra argument at all call sites
- next-app form schema no longer propagates override_module (override
  components self-register); drop the stale assertion
@fms-zth
fms-zth force-pushed the feat/dcu-kernel-auto-opt branch from 9fdf083 to 73c213c Compare August 31, 2026 08:55
dsh_agent.main() exits 1 without credentials (TENCENT_API_KEY env or
~/.dsh/.credentials.yaml), which CI runners lack, so three tests failed
on the GitHub runner while passing on dev machines. Inject a dummy API
key inside run_wrapper and restore the environment afterwards.
@myrfy001
myrfy001 merged commit 8bf26f9 into HuangPuStar:next-app Sep 2, 2026
0 of 4 checks passed
fms-zth added a commit to fms-zth/MetaInfer that referenced this pull request Sep 11, 2026
Content imported from the DCU dev container tree (/root/zth_agent/MetaInfer),
3-way merged onto the merged PR HuangPuStar#26 head so the next-app alignment and CI fixes
stay in place. Scope is limited to this task plugin.

Added:
- orchestrator: planner.py (+ planner_policy/manifest/gates), gate_policy.py,
  gpu_preflight.py, harness_io.py, predictions.py, validation_budget.py,
  variant_promote.py
- harness_default/: planner_catalog.yaml, planner_policy.yaml, manifest.yaml,
  gates.yaml
- reports/: best-variant tables (csv/json/xlsx) and the summary scripts
- skills/: int8-w8a8-gemm foundations/decode/prefill skill packs
- tools/baseline/: Triton INT8 benchmark harness, baseline graph JSONs
- 11 new test modules (planner, gate policy, gpu preflight, harness io,
  predictions, validation budget, variant promote, plan render, prompt schema,
  planner wiring, planner policy)
- retuned variant kernels for glm52/TP8 and hy3/TP4, refreshed WORKFLOW.md

Changed:
- gen_and_opt_pipeline.py, w8a8_pipeline.py, real_pipeline.py, pipeline.py,
  skill_store.py, variant_store.py, server/routes.py, static (detail view,
  shape input, css), form.yaml, bridge/dsh/dsh_agent.py, api/assets helpers
- PR-side fixes kept: init_or_resume(task_id) alignment (73c213c) and the
  CPU-only-CI torch guards (3d70f58) / hermetic dsh tests (6a8f235)

Excluded: *.bak-* kernel backups.
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.

2 participants