Skip to content

kernel_workflow: surface target-backend + target-language authoring k… - #373

Draft
IzacharyI wants to merge 1 commit into
AMD-AGI:mainfrom
IzacharyI:A2B_link_to_skills
Draft

kernel_workflow: surface target-backend + target-language authoring k…#373
IzacharyI wants to merge 1 commit into
AMD-AGI:mainfrom
IzacharyI:A2B_link_to_skills

Conversation

@IzacharyI

Copy link
Copy Markdown

Summary

Cross-backend kernel port/migration runs (e.g. rewriting an fp8 a8w8 blockscale
GEMM from CK to FlyDSL) previously only surfaced the source backend's knowledge
card. The agent never pulled in the target language's general-GEMM authoring
docs, so the engineer re-implemented the new backend "blind" — boxed in by the
source card (or a narrow block-scale/expert card) instead of the target backend's
full authoring how-to.
This PR makes kernel_workflow knowledge-selection also surface the target
backend card and the target language's authoring documentation on any
cross-backend port — for any source→target pair (ck→flydsl, triton→tilelang,
hip→ck, …), not just ck→flydsl.

Root cause

  • tech_lead analyze set kk_language = current (source) language and populated
    kk_refs only from the source backend card — no target-side refs.
  • engineer / deep_engineer read/mined only backends/<KK_LANGUAGE>.md (source).
  • Operator backend cards had no cross-links to the target language's authoring docs
    (e.g. the CK card never pointed at the FlyDSL authoring docs).

What changed (prompt + docs only — no runtime/kernel code)

Role prompts

  • tech_lead.md (analyze): on a cross-backend port, keep kk_language = editable
    source, but kk_refs now ALSO includes (a) the target backend card
    operators/<op>/backends/<target>.md and (b) the target language's authoring
    how-to under languages/<dir>/, via an id→dir map:
    triton→triton_amd, hip→hip_cpp, ck→composable_kernel, asm→asm_mfma,
    flydsl→flydsl, tilelang→tilelang, gluon→gluon, hipkittens→hipkittens.
  • engineer.md / deep_engineer.md: on a cross-backend rewrite, also read/mine the
    target backend card + target language authoring docs (same map).
    Operator cards (cross-links to the FlyDSL GEMM authoring docs)
  • scaled_quant_gemm/backends/ck.md — new "Porting to FlyDSL (ck→flydsl)" section.
  • scaled_quant_gemm/backends/flydsl.md, fused_moe_grouped_gemm/backends/flydsl.md,
    dense_gemm/backends/flydsl.md — "Authoring / optimizing a FlyDSL GEMM" links to
    authoring_gemm_levers / authoring_optimization / authoring_tile_programming /
    debugging.

Before → After (ck→flydsl fp8 blockscale)

  • Before: analyze emits kk_refs = CK card only → engineer sees CK tuning knobs
    (which don't transfer) → reimplements FlyDSL blind.
  • After: analyze emits CK card + FlyDSL SOTA card + FlyDSL authoring docs
    engineer gets tiling / LDS / XCD-swizzle / epilogue levers, structure-first
    optimization workflow, the @flyc.kernel tile-programming model, and debugging
    triage for the target.

Scope / generality

Rules are written for any source→target migration via the id→dir map; ck→flydsl
is just the motivating case (a2b / c2d all covered).

…nowledge on cross-backend ports

When a TASK rewrites a kernel into a different backend (any source->target, e.g.
ck->flydsl, triton->tilelang, hip->ck), the source backend card alone doesn't teach
how to author the target. Now:
- tech_lead analyze: kk_refs also includes the target backend card + target
  language authoring how-to under languages/<dir>/ (with id->dir map).
- engineer / deep_engineer: also read/mine the target backend card + target
  language authoring docs on cross-backend rewrites.
- operator cards (scaled_quant_gemm ck+flydsl, fused_moe_grouped_gemm flydsl,
  dense_gemm flydsl): cross-link the FlyDSL GEMM authoring docs.

Fixes: ck->flydsl (and any a2b) migration runs previously only saw the source
backend card and never surfaced target-language general-GEMM authoring knowledge.
@IzacharyI
IzacharyI marked this pull request as draft July 31, 2026 07:43
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