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

debug-compiler

Skill1 starsChanged 2 months agoApache-2.0View on GitHub

Diagnose Buckyball model import, graph transformation, MLIR lowering, layout, bank allocation, and compiler performance failures. Use when the failure precedes emulator or RTL execution.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    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. Distinctive:

    Verify the original model and chip rewrite separately.

    line 12
  2. Distinctive:

    Follow parameter identity/order through import and packing.

    line 14
  3. Very specific:

    Before adding a high-rank transpose, test whether aligned layouts or offline weight permutation remove it.

    line 16
  4. Distinctive:

    Use actual compute-bank dimensions.

    line 18
  5. Distinctive:

    Verify physical padding and logical trimming independently.

    line 28
  6. Distinctive:

    Do not adjust output comparisons or the golden model to conceal a mismatch.

    line 38
  7. Very specific:

    Use project MCP build tools.

    line 40

≈ “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

Compiler Debugging

Locate the first failing stage: model rewrite, graph import/grouping, quantization, layout, dialect verification, bank lowering/allocation, LLVM IR, or machine code. Retain the exact command, input graph, target configuration, and first diagnostic.

  • Verify the original model and chip rewrite separately. Quantization must not hide a changed preprocessing, pooling, bias, reduction, or flattening contract.
  • Follow parameter identity/order through import and packing; inspect shapes, strides, dtypes, scales, and producer/consumer layouts at the failing boundary.
  • Before adding a high-rank transpose, test whether aligned layouts or offline weight permutation remove it. Put model layout decisions in permute/.
  • Use actual compute-bank dimensions. Reduce tiles or split reduction/graph regions when the design exceeds them; do not silently enlarge capacity.
  • A fused region can recursively recompute its producers. Inspect its lowering and materialization boundaries when IR size or runtime work grows sharply.
  • For a performance target, use $debug-performance. Preserve fixed argument strides with dynamic offsets into packed payloads; forcing offset zero can make direct DMA read the wrong weights. Tile capacity must also respect ISA row bases.
  • Distinguish DMA-loaded storage from recursively assembled scratch tiles. A narrow row-base field can limit scratch assembly without limiting a whole-bank DMA load; applying one conservative limit to every path can break valid larger-bank users.
  • Verify physical padding and logical trimming independently. Calibration hooks must see the physical Linear/Conv channels before a wrapper trims the output; retain the original model as the reference for logical outputs.
  • For a slow compilation, inspect the live process/pass before assuming a hang. Preserve intermediate MLIR/LLVM IR when useful. Fix graph/lowering expansion before accumulating optimization-disable flags; validate any retained tradeoff.

Reproduce a semantic defect with a small independent C/MLIR case, fix the red stage, and run it plus affected existing cases. A lowering marker's indexing map can be consumed by a later pass; inspect that consumer before changing the map. Do not adjust output comparisons or the golden model to conceal a mismatch.

Use project MCP build tools. With user-authorized fallback, use nix develop -c bbdev; report logs/exit status. Distinguish an environment/source packaging error from a compiler defect. Nix Git-source packaging can omit a new untracked file that local compilation sees; inspect inclusion before altering code.

Once compilation is green, continue with BEMU and $debug-bemu as needed.

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.