heir
AGENTS.md948 starsChanged 7 months agoApache-2.0View on GitHub
- When creating operations, always use the format OpType::create(rewriter, ...) and never use the (deprecated) format rewriter.create<OpType>(...). - When writing unit tests with filecheck, never use CHECK-LABEL; just use CHECK instead. - scripts/templates/templates.py (which requires python-fire and jinja2) provides boilerplate for generating new transforms and passes. After running the script to create a new pass, one still must register the pass in heir-opt.cpp and add the necessary build dependencies. Copied from https://mlir.llvm.org/docs/Tutorials/MlirOpt/ with minor tweaks. - --mlir-timing displays execution times…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,439 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository4 other files it gives its agents.
- dump-intermediate-irSkill
- e2e-to-bazelSkill
- lit-to-bazelSkill
- reproduce-failureSkill
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 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.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
When creating operations, always use the format OpType::create(rewriter, ...) and never use the (deprecated) format …
- Very specific: line 12
When writing unit tests with filecheck, never use CHECK-LABEL.
- Very specific: line 44
When using print-ir flags, adding --mlir-print-ir-tree-dir writes the IRs to files in a directory tree, making them easier to inspect …
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md 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.
Files
AGENTS.md
Bazel conventions
- Our build files are
BUILDin almost all cases, notBUILD.bazel.
MLIR conventions
- When creating operations, always use the format
OpType::create(rewriter, ...)and never use the (deprecated) formatrewriter.create<OpType>(...). - When writing unit tests with filecheck, never use
CHECK-LABEL; just useCHECKinstead.
Helper tooling
template scripts
scripts/templates/templates.py(which requirespython-fireandjinja2) provides boilerplate for generating new transforms and passes. After running the script to create a new pass, one still must register the pass inheir-opt.cppand add the necessary build dependencies.
heir-opt flags
Copied from https://mlir.llvm.org/docs/Tutorials/MlirOpt/ with minor tweaks.
--mlir-timingdisplays execution times of each pass.--debugprints all debug information produced byLLVM_DEBUGorLDBGcalls.--debug-only="my-tag"prints only the debug information produced byLLVM_DEBUGin files that have the macro#define DEBUG_TYPE "my-tag". This often allows you to print only debug information associated with a specific pass."greedy-rewriter"only prints debug information for patterns applied with the greedy rewriter engine."dialect-conversion"only prints debug information for the dialect conversion framework.
--dump-pass-pipelineprints the full pipeline that will be run before starting.--mlir-print-ir-after-allprints the IR after each pass.- See also
--mlir-print-ir-after-change,--mlir-print-ir-after-failure, and analogous versions of these flags withbeforeinstead ofafter. - When using
print-irflags, adding--mlir-print-ir-tree-dirwrites the IRs to files in a directory tree, making them easier to inspect versus a large dump to the terminal. A common practice when encountering a segfault is to create a minimal reproducing test case by adding--dump-pass-pipeline --mlir-print-ir-before-all --mlir-print-ir-tree-dir=/tmp/mlir, copying the last IR file (filenames are prefixed by the number of the pass in the pipeline) and running the single failing pass on it, using the output of--dump-pass-pipelineto get the pass options.
- See also
<!-- mdformat global-off -->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
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.

