kernel_workflow: surface target-backend + target-language authoring k… - #373
Draft
IzacharyI wants to merge 1 commit into
Draft
kernel_workflow: surface target-backend + target-language authoring k…#373IzacharyI wants to merge 1 commit into
IzacharyI wants to merge 1 commit into
Conversation
…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
marked this pull request as draft
July 31, 2026 07:43
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
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_workflowknowledge-selection also surface the targetbackend card and the target language's authoring documentation on any
cross-backend port — for any
source→targetpair (ck→flydsl, triton→tilelang,hip→ck, …), not just ck→flydsl.
Root cause
tech_leadanalyze setkk_language= current (source) language and populatedkk_refsonly from the source backend card — no target-side refs.engineer/deep_engineerread/mined onlybackends/<KK_LANGUAGE>.md(source).(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, keepkk_language= editablesource, but
kk_refsnow ALSO includes (a) the target backend cardoperators/<op>/backends/<target>.mdand (b) the target language's authoringhow-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 thetarget 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 toauthoring_gemm_levers/authoring_optimization/authoring_tile_programming/debugging.Before → After (ck→flydsl fp8 blockscale)
kk_refs= CK card only → engineer sees CK tuning knobs(which don't transfer) → reimplements FlyDSL blind.
engineer gets tiling / LDS / XCD-swizzle / epilogue levers, structure-first
optimization workflow, the
@flyc.kerneltile-programming model, and debuggingtriage for the target.
Scope / generality
Rules are written for any
source→targetmigration via the id→dir map; ck→flydslis just the motivating case (a2b / c2d all covered).