ttir-decomposition-for-ttmetal

Register TTIR composite op decomposition patterns for the TTMetal backend.

295|145|Updated Jun 17, 2024
One-click install
npx skills add https://github.com/tenstorrent/tt-mlir --skill ttir-decomposition-for-ttmetal
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ttir-decomposition-for-ttmetal
Source: https://github.com/tenstorrent/tt-mlir/tree/main/.claude/skills/ttir-decomposition-for-ttmetal
Command: npx skills add https://github.com/tenstorrent/tt-mlir --skill ttir-decomposition-for-ttmetal

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TTIR composite op decompositions enable lowering high-level TTIR ops into primitive TTIR ops for the TTMetal backend, when fused TTIR support is not available or desirable.

Core Features & Use Cases

  • Pattern-driven lowering: Add and register OpRewritePattern-based decompositions for ops like rms_norm, sdpa, layer_norm, softmax.
  • Pipeline integration: Ensure patterns are applied by TTIRDecomposeComposites with correct benefit ordering and TTMetal pipeline scheduling.
  • Testing & maintenance: Update tests and docs to validate the new decomposition path and maintain compatibility with TTNN backend when not triggered.

Quick Start

Define and register a new TTIR composite decomposition pattern to lower a high-level TTIR op into primitive TTIR ops for the TTMetal backend.

Frequently Asked Questions about ttir-decomposition-for-ttmetal

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decompose TTIR composite ops into primitives for the TTMetal backend?

To decompose TTIR composite ops for the TTMetal backend, you add and register an OpRewritePattern-based decomposition. This lowers high-level ops like rms_norm, sdpa, layer_norm, and softmax into primitive TTIR ops such as matmul, add, multiply, and reduce.

When do I need to lower high-level TTIR ops into primitive TTIR ops?

High-level TTIR op lowering into primitive TTIR ops is needed when fused TTIR support is not available or desirable for the TTMetal backend. This decomposition enables the compiler to break down composite operations into executable primitives.

How do I register a new TTIR decomposition pattern in the MLIR pipeline?

To register a new TTIR decomposition pattern, you apply it through the TTIRDecomposeComposites pipeline with correct benefit ordering. You must also specify the files to modify and ensure proper TTMetal pipeline scheduling.

Does TTMetal op decomposition maintain compatibility with the TTNN backend?

Yes, TTMetal op decomposition maintains compatibility with the TTNN backend when the decomposition pattern is not triggered. You must update tests and docs to validate the new decomposition path and ensure this compatibility is preserved.

What TTIR ops can be lowered using the pattern rewriter for TTMetal?

The pattern rewriter can lower high-level TTIR ops including rms_norm, sdpa, layer_norm, and softmax. These composite ops are decomposed into primitive TTIR ops like matmul, add, multiply, and reduce for the TTMetal backend.

What files do I need to modify to add a new TTIR composite op decomposition?

Adding a new TTIR composite op decomposition requires modifying files to define the pattern, register the pipeline, and add tests. This ensures the pattern is properly integrated into the TTMetal backend lowering pipeline.