agentleFS
DangoSysDangoSys/skills/debug-bemu/SKILL.md

debug-bemu

Skill1 starsChanged 2 months agoApache-2.0View on GitHub

Diagnose Buckyball BEMU failures or numerical mismatches against C, PyTorch, or another declared reference. Use for emulator semantics and compiled-model execution, not RTL timing.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use BEMU to localize semantic differences and excessive CPU/lowering work, then confirm a hardware performance hypothesis with …

    line 42
  2. Very specific:

    Prefer project bbdev_* MCP tools and poll terminal results.

    line 49

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

BEMU Debugging

Confirm the exact chip, executable/model artifact, input, and reference. Read the active ISA/configuration and reproduce the first failure through project tools. Build success, process startup, and a running CPU are not correctness results.

For a model mismatch, compare the earliest available tensor/operator boundary: preprocessing, offline weights, activation/weight quantization, bias, accumulation, pooling, flattening, and outputs. Check shape, stride, packing, tail zero fill, signedness, overflow, and rounding. Use $debug-compiler when the imported graph or lowering is already wrong.

For Linux DMA page faults, identify the buffer and failing page before changing the emulator. Untouched calloc padding or a DMA-only destination can lack backing pages. Check page residency and access permissions in the model/runtime; do not silently map a faulting DMA address or alter tensor data to conceal the defect.

For CPU external-input optimizations, prove when each input can affect architectural state. Disabled local IRQ enables do not make pending CSR reads unobservable, and disabled global IRQ enables do not eliminate WFI wake conditions. Compare fixed input snapshots against the optimized provider at each step, including CSR reads, IRQ priority/delegation, timer MMIO, cycle inhibition, and WFI boundaries.

For an operator mismatch, use an independent small C reference and inspect itrace/mtrace around its command and bank reads/writes. Pin the documented contract before changing the emulator. Follow $ball-align: C+BEMU must be green before compiler/MLIR changes are accepted, and MLIR+BEMU before RTL changes.

For a slow run, check progress in instruction/operation completions and map the current PC to the actual executable. Distinguish repeated computation or costly fusion from a stopped command. Do not claim a layer/percentage from elapsed time.

Re-run the failing case after a targeted fix and cover affected existing consumers. Full models and large bank cases belong on BEMU or P2E, not full-model Verilator. Label BEMU cycle counts as BEMU evidence; they are not RTL/P2E timing or PPA. An accelerator instruction's functional execution cost is not its hardware latency. Use BEMU to localize semantic differences and excessive CPU/lowering work, then confirm a hardware performance hypothesis with $debug-performance on RTL/P2E.

Explicit model-only --reuse-simulator can run a previously built matching simulator during model iteration. Check its chip geometry and instruction semantics; rebuild when either changes. A cached simulator must not hide a semantic regression.

Prefer project bbdev_* MCP tools and poll terminal results. If the user authorizes fallback for a broken MCP entry, use nix develop -c bbdev and retain logs/exit codes.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.