tenstorrent/tt-emule

parallel-mock-implementation

Pattern for parallelizing emule mock authorship via the Workflow tool.

View source

How to use

  1. Copy the installation command and review the source package before installing it in your own agent environment.
  2. Check the source document for required tools, credentials and supported hosts.
  3. Describe your input and desired deliverable; review the output against the source material.
npx skills add https://github.com/tenstorrent/tt-emule --skill parallel-mock-implementation

Before you start

  • Installation does not include a model subscription, API allowance or permission to access your files.
  • Repository stars and installation counts describe activity, not an independent quality or security test.
Original skill document

Rendered from the source repository. Headings, examples, code, tables, links, and referenced images are preserved.

Parallel mock implementation

This is a building block, not a standalone bring-up workflow. Invoke it as part of /implement-mock or /compute-llk-bringup when the work-list is large enough to amortize the dispatch overhead.

When to use

  • ≥4 similar files to author (e.g. a batch of SFPU shims, a sweep of

missing NOC overloads, a fanout of fabric primitives).

  • Each output is independent — one file per worker, no shared

edits, no read dependencies between workers.

Don't use it for:

  • Single-file work — call the worker prompt directly inline.
  • Cross-cutting wiring that touches a shared file (e.g. one

sfpu_split_includes.h, one .claude/references/structure.yaml). The orchestrator handles those centrally after workers return.

Worker prompt skeleton

Each worker writes exactly one file. Customize the constraints for your scope; the structure below stays the same.

You are implementing an emule mock for tt-emule. Write exactly ONE file.

TARGET FILE: <relative path under include/jit_hw/ or src/>
UPSTREAM REFERENCE (read-only): <path to the silicon API definition>
ADDITIONAL REFERENCE (read-only, optional): <e.g. LLK impl, RTL spec>
REFERENCE EMULE FILES (read for boilerplate):
  <path to an existing similar mock — keep this list short>

REQUIRED SIGNATURES (mirror upstream — if upstream differs, follow upstream):
<list>

SEMANTICS:
<formula / contract>

HARD CONSTRAINTS:
- Do NOT modify any file other than the TARGET FILE.
- Do NOT touch shared wiring files (the orchestrator handles those).
- Do NOT run pytest, build, or commit.
- Read at most 3 files: upstream, optional second reference, one
  existing mock as boilerplate.
- (Add scope-specific exclusions — e.g. for compute shims:
  "Do NOT read tt_metal/llrt/, tt_metal/impl/dispatch/,
  tt_metal/soc_descriptors/".)

OUTPUT: write the file, return status=DONE with file=<relative path>
and lines=<count>.
If signature is ambiguous or upstream missing, return status=STUCK with
a one-sentence reason.
Do NOT invent signatures.

Result schema

js
const RESULT_SCHEMA = {
  type: 'object',
  properties: {
    status: { type: 'string', enum: ['DONE', 'STUCK'] },
    file:   { type: 'string' },
    lines:  { type: 'integer' },
    reason: { type: 'string' },
  },
  required: ['status', 'file'],
  additionalProperties: false,
}

Orchestration

js
phase('Write mocks')
const results = await parallel(ITEMS.map(it => () =>
  agent(makePrompt(it), {
    label: `mock:${it.name}`,
    phase: 'Write mocks',
    schema: RESULT_SCHEMA,
  }).then(r => ({ item: it.name, ...(r || {status: 'NULL'}) }))
))
const done  = results.filter(r => r.status === 'DONE')
const stuck = results.filter(r => r.status !== 'DONE')
log(`${done.length}/${ITEMS.length} DONE; ${stuck.length} STUCK`)
return { done, stuck }

Orchestrator finalization

After the workers return, the orchestrator (you) handles centrally:

  1. Visual diff each new file.
  2. Wire any shared aggregator/registration file (e.g. for compute LLK

shims: SFPU_OP_*_INCLUDE branches in sfpu_split_includes.h).

  1. Update .claude/references/structure.yaml with one line per new file (per CLAUDE.md

project rule).

  1. Build.
  2. Run targeted tests for each new mock — this loop can itself

parallelize via one pytest call per item.

  1. Promote 100%-pass entries into the regression script (e.g.

scripts/run_ttnn_pytests.sh for compute LLK shims).

  1. For partial passes, decide per-item: pytest -k filter, or defer

with a written note.

Anti-patterns

  1. Don't have parallel workers touch shared files. Each worker

owns a unique target path; the orchestrator centralizes wiring after the batch returns. Without this, you get racing writes that silently lose changes.

  1. Don't skip the `STUCK` branch. When a worker hits ambiguity it

must report STUCK with a reason; the orchestrator decides how to resolve (e.g. surface to the user, drop the item, hand-write it). Workers that "guess" produce subtle bugs that surface much later.

  1. Don't bypass the schema. Free-text worker output is unparseable

at scale. Even a STUCK item needs structured {status: STUCK, file: <intended path>, reason: <one sentence>}.

  1. Concurrency cap is automatic. The Workflow runtime limits

concurrent agent() calls (typically ≤16); excess queue up. Don't manually batch in chunks unless you have a reason — parallel() over the full work-list is fine.

Related by task

from this repository

More skills

All skills
tenstorrent
Community

index-based-ops

Bring up or debug index-based compute ops (TopK, Sort, Argmax) in tt-emule — ops that return values + indices, where ties make the index choice non-unique. Use when implementing one of these ops or triaging its value/index test failures.

installs
1
GitHub stars
5
Updated
Oct 16
tenstorrent
Community

memory-debug

Diagnose data-corruption failures in tt-emule operations (wrong values, partial zeros, off-by-N row/col writes). Use when a regression test reports ATOL 1e-3 on otherwise-functional kernel paths.

installs
1
GitHub stars
5
Updated
Oct 16
tenstorrent
Community

verify-mock

Verification checklist to walk before declaring a tt-emule mock complete. Use after implementing a stub (typically at the end of /implement-mock or /compute-llk-bringup) to catch the recurring failure modes — signature drift, no-op math, missing format dispatch, JIT-cache staleness, regression baseline drift.

installs
1
GitHub stars
5
Updated
Oct 16
tenstorrent
Community

workarounds

Registry of deliberate, non-ideal workarounds currently live in tt-emule (hacks we accepted to make something pass, NOT normal development practice). Read this before adding any new workaround, and when touching code that carries one — each entry records what the hack is, why it is not the right fix, the real root cause, and the path to removing it.

installs
1
GitHub stars
5
Updated
Oct 16