SuperAPI AI Directory

kernel-worker

Coding & development

View repository

Updated 10-29 09:37

About this skill

Kernel Worker: bounded delegation with evidence handoff

Followgoal-first. The main session owns why to optimize, task semantics, and final integration; the worker owns the agreed-scope candidates and evidence. Loading the skill does not create a sub-Agent; start it explicitly through an editable, executable delegation entry actually provided by the host.

1. Dispatch after independence is met

  • First havepytorch-perf-tuningconfirm the hotspot; if an existing candidate or a simple change can solve it directly, do not force delegation.
  • Fix the reference computation, real replayable inputs, output interfaces, and numerical standards. If the algorithm, statistical grouping, rounding, or state semantics are undetermined, resolve them in the main session first.
  • Fill in thetask brief, or reference an existing task record that covers equivalent information. Pass this entry, the brief, and absolute paths to related resources; do not assume the worker can read the main session history.
  • Independent worktree/directory, recording the baseline commit or source digest; for uncommitted changes provide an explicit snapshot and do not move the user's modifications. List writable files, output locations, and the sole writer.
  • Allocate devices and total budget, and check live occupancy before starting; context/worktree isolation is not device isolation. The total budget includes preparation, compilation, tuning, validation, and delivery.
  • Once the contract, environment, and budget are clear, dispatch autonomously within the authorization; new platform adaptation, semantic changes, or budget increases go back to the main session and are not hidden in routine subtasks.

Done: the worker can independently replay and judge correctness, without relying on implicit context and without contending with the mainline for resources.

2. Verify the task and expertise

  • The worker reads the brief, reference sources, and workspace conventions, and verifies the interpreter, versions, inputs, shape/dtype/stride, masks/grouping, exceptional value domains, and necessary backward/STE. Reuse existing evidence of the same scope first.
  • Whenkernel-knowledgeis available, use thedomain library entryto locate the current source and platform skills, and read the required engineering/measurement conventions; it is installed by the user on demand and is not a required dependency of this suite.
  • If the library is unavailable but the project already has trustworthy implementations and tools, develop directly within the same contract; for dedicated capabilities with missing dependencies, report the blocker and do not fabricate experience or automatically install a platform.
  • Atrex/KLineage is only an optional external capability. Verify the actual version, target backend, and evaluator; reference material supporting a certain DSL does not mean the full engine can run. When starting the full engine, only the internal Agent writes candidates, and the outer worker handles adaptation and delivery.

Done: there is a trustworthy baseline, a feasible execution path, and a clear resource source, or an actionable blocker is returned.

3. Hold the implementation and evidence contract

  • Do not change the reference, inputs, error thresholds, or timers to accommodate the candidate; do not hardcode answers based on input values/pointers, and do not skip failing shapes.
  • Reuse correct candidates within scope and iterate in a bounded manner based on evidence; separate algorithmic preprocessing from stable primitives, and preserve normal PyTorch interfaces and the boundaries of vendor high-performance libraries. Specific optimization methods are maintained by the project or domain library.
  • Validate the real workloads, tail blocks, layouts, statistical axes, states, and gradients claimed to be supported; limited validation does not mean new models/versions are automatically usable. Explicitly fall back or error for unsupported forms.
  • Interleave comparisons with the reference using the same inputs, same environment, and same measurement protocol, preserving source code/configuration and per-round results. The measurement contract declares window, warm-up, number of iterations, statistics, and concurrency dependencies; plain, dummy, and graph are each reported separately, without mixing speedup factors.
  • Compilation/preparation cost is separated from steady state, and the full cold-start cost is not silently deleted. Multiple streams must be joined correctly; local device timing cannot substitute for host-side end-to-end gains.
  • Once the gain is reliable and sufficient, or when stalled or the budget is exhausted, return the best validated candidate or the reference, without automatically expanding to other hotspots; a correctness failure cannot be marked "ready to integrate".

Complete: numerical results, support scope, and performance evidence match this round's candidate; startup, process termination, or stale state files are not proof of passing.

4. Background lifecycle and delivery

  • Start in the background using the host mechanism and wait for a completion notification, without sleep or polling; the main session only performs independent work. Ordinary details stay in the workspace; contract blockers or abnormal exits are reported back promptly.
  • On timeout/cancellation, check the status of this task and descendant processes, and save validated candidates; worker exit does not mean external engine/device tasks have stopped, and do not clean up other jobs.
  • Return to the brief the candidate location, source summary, correctness and performance evidence, uncovered scope, integration method, actual cost, and reason for stopping. "Ready to integrate" only means the local contract passed.
  • After the main session verifies the evidence and support scope, integrate back into PyTorch and perform the necessary same-input numerical and host-side end-to-end comparisons; passexp-workflowonly when existing release requirements are met, then run in batches, reusing valid records.

5. Feedback

  • Delegation omissions, resource conflicts, handoff and cost issues update this skill; specific machine paths and run states remain in project/host records.
  • Specialized measurement, platform implementation, and case studies return to their independent domain repositories and are published according to their current intake specifications; the main body only synchronizes the necessary summaries and references and does not maintain a second source of technical facts.
  • The first worker/external engine integration must undergo practical acceptance; documentation and load checks cannot substitute for it.