agentleFS
rainoftimerainoftime/pl-skills/mlir-dialect-designer/SKILL.md

mlir-dialect-designer

Skill17 starsChanged 9 months agoApache-2.0View on GitHub

Designs MLIR dialects and transformations. Use when: (1) Building domain-specific

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use traits for common operation properties

    line 62
  2. Distinctive:

    Follow ODS (Operation Definition Specification)

    line 64

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

MLIR Dialect Designer

Designs MLIR (Multi-Level Intermediate Representation) dialects and transformations.

When to Use

  • Building domain-specific compilers
  • Creating custom IR abstractions
  • Implementing multi-level lowering
  • Optimizing compilers for specific domains
  • Integrating with LLVM ecosystem

What This Skill Does

  1. Designs dialects - Custom operations and types
  2. Defines patterns - Transformation rules
  3. Implements lowering - Dialect-to-dialect lowering
  4. Creates passes - Optimization and lowering passes

Key Concepts

ConceptDescription
DialectCollection of operations and types
OperationInstructions in the IR
BlockSequence of operations
RegionContainer for blocks
PatternTransformation rule

Standard Dialects

DialectPurpose
arithArithmetic operations
linalgLinear algebra
affineAffine loops/conditionals
scfStructured control flow
funcFunction definitions
LLVMLLVM dialect

Tips

  • Design operations at right abstraction level
  • Use traits for common operation properties
  • Implement folding for constant propagation
  • Follow ODS (Operation Definition Specification)
  • Test patterns thoroughly

Related Skills

  • llvm-backend-generator - LLVM code generation
  • ssa-constructor - SSA form
  • dataflow-analysis-framework - Analysis
  • llvm-backend-generator - Integration

Canonical References

ReferenceWhy It Matters
MLIR SpecificationOfficial MLIR docs
TensorFlow MLIRProduction MLIR usage
LLVM Developers Meeting TalksMLIR design talks
ODSv2 TutorialOperation definition

Tradeoffs and Limitations

Design Tradeoffs

ApproachProsCons
High-level opsSimple, easy to optimizeLess control
Low-level opsFine-grained controlComplex patterns
HybridBalanceComplexity

Limitations

  • Steep learning curve
  • Large ecosystem to understand
  • Patterns can be complex
  • Dialect conversion requires care

Research Tools & Artifacts

Real-world MLIR dialects:

ToolWhy It Matters
LinalgLinear algebra dialect
SCFControl flow dialect
AffineAffine loops dialect
VectorVector operations

Key Systems

  • TensorFlow MLIR: Production MLIR
  • IREE: MLIR-based runtime

Research Frontiers

Current MLIR research:

DirectionKey PapersChallenge
Dialect design"MLIR Design"Abstractions
Lowering"Dialect Lowering"Patterns

Hot Topics

  1. Wasm MLIR: WebAssembly dialect
  2. Quantum MLIR: Quantum dialects

Implementation Pitfalls

Common MLIR bugs:

PitfallReal ExamplePrevention
PatternsWrong patternTest

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.