with one click
port-kernel
// Get structured porting guidance when moving a kernel between architectures. Launches sages for source and target, reads test harness.
// Get structured porting guidance when moving a kernel between architectures. Launches sages for source and target, reads test harness.
Run LLK tests using the test runner agent. Never run pytest directly.
Look up Tensix architecture, instruction, or LLK implementation details across architectures. Orchestrates sage agents in parallel.
Debug compilation or runtime errors in LLK kernels. Infers architecture and kernel type from path.
Enforce safe bash scripting practices when writing, reviewing, or fixing shell scripts. Covers quoting, arrays, conditionals, arithmetic, redirections, strict mode, and static analysis. Use when editing .sh/.bash files, reviewing shell scripts, fixing shellcheck warnings, or writing new bash code.
Guides test-first workflows for bugs and features: write a minimal failing test that encodes contracts and clear failure messages, confirm the gap is not already covered, implement and document the fix, then verify green. Use when fixing bugs with tests, adding features via TDD, writing regression tests, or when the user asks for red-green-refactor or test-driven development.
| name | port-kernel |
| description | Get structured porting guidance when moving a kernel between architectures. Launches sages for source and target, reads test harness. |
| user_invocable | true |
/port-kernel reduce --from wormhole --to quasar
/port-kernel pack_untilize --from blackhole --to quasar
/port-kernel eltwise_binary --from wormhole --to blackhole
kernel_type (sfpu/math/unpack/pack) by checking which subdirectory or header prefix the kernel lives under in the source architecture.Task A — Source sage: Launch the sage for the source architecture
Agent tool:
subagent_type: "sage-{source_arch}"
description: "Source analysis: {kernel}"
prompt: |
Find the implementation of {kernel} on {source_arch}.
Report: algorithm, function signatures, template parameters,
key constructs (MOP, replay buffer, address modifiers),
data format handling, dependencies.
Task B — Target sage: Launch the sage for the target architecture
Agent tool:
subagent_type: "sage-{target_arch}"
description: "Target conventions: {kernel}"
prompt: |
Find the conventions for {kernel_type} kernels on {target_arch}.
Search for: closest existing kernel of the same type,
file naming pattern, instruction conventions, MOP patterns,
config write patterns, any existing partial implementation of {kernel}.
While sages run, read the test harness for the target architecture:
tests/sources/ for matching test files#ifdef ARCH_{TARGET} sections for expected function signatures when presentARCH_{TARGET} sections exist, fall back to unguarded/common signatures in the matching test filestests/helpers/include/* for target-specific declarations/helpers (especially for Quasar), and if needed inspect target arch headers directlyAggregate into structured porting guidance:
## Porting: {kernel} ({source} → {target})
### Algorithm Summary
[From source sage — what the kernel does]
### Source Implementation
[Key functions, patterns, data format handling]
### Target Conventions
[From target sage — how similar kernels are structured on target]
### API Contract (from test harness)
[Expected function signatures, template params from test files]
### Key Differences
[What changes between source and target — naming, instructions, patterns]
### Recommended Template
[Which existing target kernel to use as a starting point]
### Porting Checklist
- [ ] Function signatures match test harness expectations
- [ ] Uses target arch instruction conventions
- [ ] Init/uninit symmetry maintained
- [ ] All data format paths handled
.claude/references/porting-guide.md for detailed methodology