Agent skill

Add Ttir D2m Lowering

by tenstorrent in tenstorrent/tt-mlir

Elementwise TTIR→D2M→TTMetal path: tablegen, TTIRToD2M.cpp, D2MToTTKernel.cpp, and — only when the kernel API callee is new — TTKernelIncludesMap.h (per-op api/compute/eltwiseunary/.h mapping for…

Apache-2.0Auto-check passed

Install Add Ttir D2m Lowering

skills CLI
$ npx skills add tenstorrent/tt-mlir --skill add-ttir-d2m-lowering -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install tenstorrent/tt-mlir add-ttir-d2m-lowering --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/tenstorrent/tt-mlir.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/add-ttir-d2m-lowering .claude/skills/add-ttir-d2m-lowering && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
add-ttir-d2m-lowering
GitHub stars
314
Token cost
~1.6k tokens
SKILL.md length
666 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
Apache-2.0

At a glance

Elementwise TTIR→D2M→TTMetal path: tablegen, TTIRToD2M.cpp, D2MToTTKernel.cpp, and — only when the kernel API callee is new — TTKernelIncludesMap.h (per-op api/compute/eltwiseunary/.h mapping for…

  • Works in 4 steps: Tablegen — e.g.… → lib/Conversion/TTIRToD2M/TTIRToD2M.cpp —… → lib/Conversion/D2MToTTKernel/D2MToTTKerne… → …
  • Calls cmake

What it does

Add Ttir D2m Lowering is an agent skill from tenstorrent/tt-mlir. Elementwise TTIR→D2M→TTMetal path: tablegen, TTIRToD2M.cpp, D2MToTTKernel.cpp, and — only when the kernel API callee is new — TTKernelIncludesMap.h (per-op api/compute/eltwiseunary/.h mapping for JIT). Does not edit D2MGenericRegionOps.cpp or TTKernelToCpp.cpp. Not for reductions, matmul, views, or CCL.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It works with C++. The repository describes itself as: Tenstorrent MLIR compiler. The licence is Apache-2.0.

Example prompts

  • “/add-ttir-d2m-lowering”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Tablegen — e.g. include/ttmlir/Dialect/D2M/IR/D2MGenericRegionOps.td (and any other .td you
  2. lib/Conversion/TTIRToD2M/TTIRToD2M.cpp — in populateTTIRToD2MPatterns, add one line to the
  3. lib/Conversion/D2MToTTKernel/D2MToTTKernel.cpp — extend ComputeOpMap / IntComputeOpMap and
  4. include/ttmlir/Target/TTKernel/TTKernelIncludesMap.h (only if the kernel API callee is new) —

What it can do on your machine

Read from SKILL.md and the folder at commit 78b7044. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • cmake

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Add Ttir D2m Lowering loads about 1.6k tokens when it runs. Until then it costs about 82 tokens; SKILL.md has 666 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~82
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from tenstorrent/tt-mlir at commit 78b7044, republished under its Apache-2.0 licence (© tenstorrent). 666 words, ~1,636 tokens.

Download SKILL.mdSave it as .claude/skills/add-ttir-d2m-lowering/SKILL.md (or your agent's skills folder).
name
add-ttir-d2m-lowering
description
Elementwise TTIR→D2M→TTMetal path: tablegen, TTIRToD2M.cpp, D2MToTTKernel.cpp, and — only when the kernel API callee is new — TTKernelIncludesMap.h (per-op api/compute/eltwise_unary/*.h mapping for JIT). Does not edit D2MGenericRegionOps.cpp or TTKernelToCpp.cpp. Not for reductions, matmul, views, or CCL.

TTIR elementwise → D2M (TTMetal path)

Allowed edits (these layers):

  1. Tablegen — e.g. include/ttmlir/Dialect/D2M/IR/D2MGenericRegionOps.td (and any other .td you already own for the op). Pick the same base class as the nearest op (unary: D2M_GenericRegionComputeUnaryDstOp; typical binary: …FPUOrSFPUBinary; ternary: …TernaryDstOp). Prefer ops that need no hand-written C++ in D2MGenericRegionOps.cpp; that file is out of scope for this workflow.

  2. lib/Conversion/TTIRToD2M/TTIRToD2M.cpp — in populateTTIRToD2MPatterns, add one line to the big patterns.add< … > list with the other elementwise rewriters, e.g. D2MNamedElementwiseRewriter<ttir::YourOp, d2m::TileYourOp>, (keep ordering consistent with neighbors). Use notifyMatchFailure inside patterns, not emitOpError.

  3. lib/Conversion/D2MToTTKernel/D2MToTTKernel.cpp — extend ComputeOpMap / IntComputeOpMap and the patterns.add<…D2MSFPUOpsRewriter…> list to match the nearest unary/binary tile op.

    If the TTKernel op takes i32-encoded scalar params (float attrs bit-reinterpreted, or int attrs, or a runtime scalar Value), reuse the shared helpers defined at the top of the anonymous namespace rather than re-inlining a lambda:

    • floatAttrToI32Bits(rewriter, loc, attr) — FloatAttr → i32 bits (e.g. selu scale/alpha, clamp_scalar float min/max).
    • intAttrToI32(rewriter, loc, attr) — IntegerAttr → sign-extended i32 (e.g. clamp_scalar int min/max).
    • scalarToI32Bits(rewriter, loc, value) — runtime scalar Value → i32 (float widened+bitcast, int sign-extended/truncated). Used by binop_with_scalar-style scalar rhs lowerings.

    Ops with scalar attributes typically need a dedicated else if constexpr (std::is_same_v<SFPUOp, ttkernel::FooTileOp>) branch in the D2MSFPUOpsRewriter body that pulls attrs off op and calls the shared helper — see the SeluTileOp / ClampScalarTileOp branches as templates.

  4. include/ttmlir/Target/TTKernel/TTKernelIncludesMap.h (only if the kernel API callee is new) — the ScopedModuleHelper in lib/Target/TTKernel/TTKernelToCpp.cpp no longer hardcodes api/compute/eltwise_unary/*.h. It walks the region and looks up each emitc.call_opaque callee in getCalleeToHeadersMap(). If your op lowers to a tt-metal SFPU helper (foo_tile / foo_tile_init) that isn't already in that map, add entries like:

    cpp
    {"foo_tile",      {"api/compute/eltwise_unary/foo.h", ""}},
    {"foo_tile_init", {"api/compute/eltwise_unary/foo.h", ""}},

    The callee string must match the TTKernel_SFPUOp<"foo_tile", …> / TTKernel_InitOp<"foo_tile_init"> name in TTKernelOps.td exactly. Do not edit TTKernelToCpp.cpp to add includes directly — the old unconditional emitc::IncludeOp block was removed. Without a map entry, wormhole JIT can fail with "foo_tile was not declared in this scope" in chlkc_unpack.cpp.

Out of scope here: D2MGenericRegionOps.cpp, TTKernelToCpp.cpp. For TTNN / flatbuffer / full builder parity across all targets, use .claude/skills/add-op/SKILL.md.

Tests (minimal): extend existing TTIR→D2M lit at test/ttmlir/Conversion/TTIRToD2M/named_to_generic.mlir. Chain the new op into the SSA dataflow of the existing named_elementwise function (bump the %N numbering and add a // CHECK: d2m.tile_<op> + the ttir.<op> call) — do not create a separate named_elementwise_* func for the new op. No lit under test/ttmlir/Conversion/D2MToTTKernel/ is required.

Golden (TTMetal-only, no TTNN): add ttir_<op>.mlir under mlir_snippets/ttir/ — one snippet per new op so test_parse_split_ops.py exercises parse/split for each. Add the golden in tools/golden/mapping.py and the matching @tag / @parse / @split in tools/builder/ttir/ttir_builder.py (same pattern as square / exp: pass output_type_mlir into the golden, no _op_proxy).

Show full SKILL.md (246 more words)Show less

For ops that carry MLIR attributes (e.g. SELU's scale / alpha, clamp's min / max), the golden function should accept the MLIR attr types (FloatAttr, IntegerAttr, …) as positional arguments and unpack them internally with unpack_mlir_attr — do not give the golden Python-level defaults that duplicate the tablegen DefaultValuedAttr. The builder @tag method is allowed to keep Python-float defaults as a caller convenience; just convert them to FloatAttr.get_f32(...) and pass the FloatAttr directly into the golden (both from @tag and from @parse, where you already have the attr off old_op). Mirror the ttnn_clamp_scalar_golden / ttnn_leaky_relu_golden shape for this.

In test/python/golden/ttir_ops/eltwise/test_ttir_unary.py (or sibling), mark the op with SkipIf("ttnn", "emitc", "emitpy", "sim") so it runs only on ttmetal on silicon until TTNN lowering exists. SkipIf is already imported from test_utils; prefer it over the more verbose Marks(pytest.mark.skip_config([...]), …) form.

Run cmake --build build after changes.

Checklist

  • D2M_Tile* in D2MGenericRegionOps.td (tablegen only; no extra .cpp for D2M tile op)
  • D2MNamedElementwiseRewriter<ttir::…, d2m::Tile…> in the elementwise section of populateTTIRToD2MPatterns’s patterns.add<{…}>
  • D2M→TTKernel map + rewriter in D2MToTTKernel.cpp (reuse floatAttrToI32Bits / intAttrToI32 / scalarToI32Bits for any i32-encoded scalar params; don't inline new lambdas)
  • TTKernelIncludesMap.h: entries for any new *_tile / *_tile_init callees (skip if the callee is already mapped). Do not touch TTKernelToCpp.cpp.
  • Lit: chain the new op into the existing named_elementwise func in named_to_generic.mlir (no new func). No D2MToTTKernel lit required.
  • Golden: one mlir_snippets/ttir/ttir_<op>.mlir per new op + mapping.py golden (take FloatAttr/IntegerAttr positionally and unpack_mlir_attr inside for ops with attrs — no Python defaults) + ttir_builder.py @tag/@parse/@split + SkipIf("ttnn", "emitc", "emitpy", "sim") for ttmetal-only-on-silicon (no TTNN)

© tenstorrent, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/add-ttir-d2m-lowering of tenstorrent/tt-mlir.

Open the folder on GitHubat commit 78b7044

Compare with similar skills

Add Ttir D2m Lowering next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Add Ttir D2m Lowering compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Add Ttir D2m Lowering this skilltenstorrent/tt-mlir314—~1.6kAutomated safety check: PassApache-2.0
Paddle BuildPaddlePaddle/Paddle24k—~1kAutomated safety check: PassApache-2.0
Fory Releaseapache/fory4.6k—~2.9kAutomated safety check: PassApache-2.0
ONNX Runtime Shape Inference Safety Auditmicrosoft/onnxruntime22k—~3.3kAutomated safety check: PassMIT
Code Audit3stoneBrother/code-audit8921 repos~2.7kAutomated safety check: PassNone
Leetcuda Tex To Readthedocsxlite-dev/LeetCUDA12k—~902Automated safety check: PassGPL-3.0

Similar skills

  • Paddle Build

    PaddlePaddle/Paddle

    A skill your agent uses when needing to compile, rebuild, or install Paddle from source after code changes.

    24k GitHub stars~1k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Fory Release

    apache/fory

    Prepare an Apache Fory release candidate from a clean release branch, including the version bump, RC tag, JVM staging, ASF source artifacts, SVN upload, and vote email.

    4.6k GitHub stars~2.9k tokensUpdated yesterday
    Auto-check passed
  • Official

    Finds and fixes out-of-range output writes in ONNX Runtime operator shape-inference functions where a getNumOutputs guard admits too few outputs.

    22k GitHub stars~3.3k tokensUpdated today
    SecurityAuto-check passed
  • Code Audit

    3stoneBrother/code-audit

    Professional code security audit skill covering 55+ vulnerability types.

    892 GitHub starsUsed in 1 repo~2.7k tokens
    SecurityAuto-check passed
  • Leetcuda Tex To Readthedocs

    xlite-dev/LeetCUDA

    LeetCUDA 书稿 LaTeX 到 Read the Docs 站点的转换管线维护 skill(站点目录 LeetCUDA/docs/readthedocs/)。当任务涉及:改完书稿后让站点同步、改转换器 convert/、本地构建与预览 build.sh、内容核对 convert.verify、浏览器验收…

    12k GitHub stars~902 tokensUpdated today
    Documents & OfficeAuto-check passed
  • Qt C++ Code Review

    x-tools-author/x-tools

    Read-only review of Qt6 C++ code that combines a deterministic lint script with six parallel analysis agents and reports only high-confidence issues.

    1.1k GitHub starsUsed in 2 repos~4.3k tokens
    DevelopmentAuto-check passed

More from tenstorrent/tt-mlir

All 9 skills in this repo
  • Add Op

    tenstorrent/tt-mlir

    How to add a new operation (op) to the tt-mlir compiler across all layers: TTIR/TTNN dialect definitions, StableHLO composite conversion, TTIR-to-TTNN conversion, EmitC/EmitPy conversions…

    314 GitHub stars~11k tokensUpdated yesterday
    Auto-check passed
  • Add Ttir Builder Op

    tenstorrent/tt-mlir

    Add full builder API support (@tag, @parse, @split) for a TTIR op.

    314 GitHub stars~1.6k tokensUpdated yesterday
    Auto-check passed
  • Run Ops Mlir Snippets

    tenstorrent/tt-mlir

    Compile and optionally execute every func.func in an ops.mlir-style snippet file (or every .mlir file in a directory) using runopsmlirsnippets.py.

    314 GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • Add a new composite op decomposition pattern to the TTMetal pipeline.

    314 GitHub stars~2.2k tokensUpdated yesterday
    Auto-check passed
  • Uplift Ttsim CI

    tenstorrent/tt-mlir

    Uplift the TTSim version used by tt-mlir CI and refresh WH/BH simulator skips.

    314 GitHub stars~3.1k tokensUpdated yesterday
    Auto-check passed
  • Validate a tt-mlir PR against tt-xla by creating a cherry-picked branch and triggering CI.

    314 GitHub stars~4.5k tokensUpdated yesterday
    Auto-check passed

Works with

Questions about Add Ttir D2m Lowering

What does Add Ttir D2m Lowering do?

Elementwise TTIR→D2M→TTMetal path: tablegen, TTIRToD2M.cpp, D2MToTTKernel.cpp, and — only when the kernel API callee is new — TTKernelIncludesMap.h (per-op api/compute/eltwiseunary/.h mapping for…. Add Ttir D2m Lowering is an agent skill from tenstorrent/tt-mlir.h mapping for JIT).

How do I install Add Ttir D2m Lowering in Claude Code?

Run `npx skills add tenstorrent/tt-mlir --skill add-ttir-d2m-lowering -a claude-code`. Or copy the skill folder (.claude/skills/add-ttir-d2m-lowering in tenstorrent/tt-mlir) into .claude/skills/add-ttir-d2m-lowering in your project. Claude Code loads it when a task matches its description.

How do I install Add Ttir D2m Lowering in Codex?

Run `npx skills add tenstorrent/tt-mlir --skill add-ttir-d2m-lowering -a codex`. Or copy the skill folder (.claude/skills/add-ttir-d2m-lowering in tenstorrent/tt-mlir) into .agents/skills/add-ttir-d2m-lowering in your project. Codex loads it when a task matches its description.

Can I use Add Ttir D2m Lowering in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add tenstorrent/tt-mlir --skill add-ttir-d2m-lowering -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/add-ttir-d2m-lowering, .gemini/skills/add-ttir-d2m-lowering, .github/skills/add-ttir-d2m-lowering and .opencode/skills/add-ttir-d2m-lowering in your project.

What does Add Ttir D2m Lowering need to run?

Going by SKILL.md and its folder, Add Ttir D2m Lowering needs the command-line tools its instructions call (cmake). Our summary lists: Python 3.

Does Add Ttir D2m Lowering access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Add Ttir D2m Lowering safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Add Ttir D2m Lowering use?

Add Ttir D2m Lowering is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Add Ttir D2m Lowering use?

About 1.6k tokens (SKILL.md is roughly 6.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Add Ttir D2m Lowering?

Skills that share tags, products or a category with Add Ttir D2m Lowering: Paddle Build (PaddlePaddle/Paddle, 24k stars), Fory Release (apache/fory, 4.6k stars), ONNX Runtime Shape Inference Safety Audit (microsoft/onnxruntime, 22k stars) and Code Audit (3stoneBrother/code-audit, 892 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Add Ttir D2m Lowering?

tenstorrent (a GitHub organization) maintains it in tenstorrent/tt-mlir, which has 314 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on October 10, 2026.

Source: tenstorrent/tt-mlir on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.