onnx-mlir
AGENTS.md1.1k starsChanged 9 days agoApache-2.0View on GitHub
onnx-mlir compiles ONNX models to native code using MLIR and LLVM. A model is imported into the ONNX dialect, transformed (shape inference, constant propagation, decompositions), and lowered. The main path goes through the Krnl dialect, then Affine/SCF/MemRef and LLVM. Other paths start from the same ONNX dialect: - Linalg: --use-linalg-path replaces Krnl for selected ops (--linalg-ops). - StableHLO and TOSA: conversion passes in src/Conversion/ONNXToStablehlo/ and ONNXToTOSA/, run through onnx-mlir-opt. StableHLO is built when ONNX_MLIR_ENABLE_STABLEHLO is on, which is the default.…
Trending
Quiet since December.about the whole repository
Who's talking about onnx/onnx-mlir
- elixir-nx/nx“Import of MLIR modules”GitHub · Mar 5, 2024 · 4 reactions
- PyTorchKR/pytorchcore-kr“더 나은 질의 응답 구조를 위한 Discussion 활용 방안”GitHub · Jan 20, 2025 · 2 reactions
- llvm/torch-mlir“[RFC] Support for an embedded build of Torch-MLIR”GitHub · Sep 23, 2022 · 2 reactions
- Samsung/ONE“[circle-mlir] Update onnx-mlir to official release”GitHub · Jun 8, 2025 · 1 reactions
- Xilinx/onnx-mlir“ONNX to TOSA Legalization Upstream tracker”GitHub · Apr 20, 2023 · 1 reactions
The biggest 5 of 22 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 22
Talked about on GitHub (22 times).
On GitHub · 22
- Mar 5, 2024Import of MLIR modules — elixir-nx/nx4 reactions · 2 comments
- Jan 20, 2025더 나은 질의 응답 구조를 위한 Discussion 활용 방안 — PyTorchKR/pytorchcore-kr2 reactions
- Sep 23, 2022[RFC] Support for an embedded build of Torch-MLIR — llvm/torch-mlir2 reactions · 4 comments
- Jun 8, 2025[circle-mlir] Update onnx-mlir to official release — Samsung/ONE1 reaction · 4 comments
- Apr 20, 2023ONNX to TOSA Legalization Upstream tracker — Xilinx/onnx-mlir1 reaction
17 more on GitHub
- Dec 16, 2025[ttl] Automate elementwise op generation from specifications — tenstorrent/tt-lang0 reactions · 1 comment
- Jul 29, 2025Missing Symbols due to visibility setting change — onnx/onnx0 reactions · 2 comments
- Nov 19, 2024Add fancier CI badges showing number of tests and/or test coverage — iree-org/iree-test-suites0 reactions · 2 comments
- Aug 6, 2024Standardize rewriter tests; testing facilities — microsoft/onnxscriptsays it tested it0 reactions · 1 comment
- May 8, 2024Fix macos build by pinning version — Xilinx/onnx-mlir0 reactions
- Mar 30, 2024Include the ".onnxtext" extension in supported serialization format — onnx/onnx0 reactions · 1 comment
- Dec 20, 2023add filecheck test for add.onnx — xdslproject/xdsl0 reactions · 7 comments
- Dec 1, 2023Failed to build with the use of --cpp-implementation — protocolbuffers/protobuf0 reactions
- Oct 27, 2023Bring in the fix for empty slice in canonicalization — Xilinx/onnx-mlir0 reactions
- Oct 25, 2023Cherry-picked upstream PR: Add conversion for DivOp ONNX to TOSA (#2207) — Xilinx/onnx-mlir0 reactions
- Aug 26, 2023Build error on M1 MacOS machine — onnx/onnx0 reactions · 3 comments
- Oct 18, 2022ONNX MLIR exporter — nod-ai/onnx-mlir-exporter0 reactions · 1 comment
- Oct 9, 2022[Feature request] Machine Readable definition of Operations (Schema file instead of Markdown or cc file) — onnx/onnx0 reactions · 14 comments
- Jun 28, 2022Can we have newer opset of bidaf-9 model (including opset 9 or newer onnx.Scan op)? — onnx/models0 reactions · 1 comment
- Jun 5, 2022Broken Links — onnx/onnx.github.io0 reactions · 3 comments
- May 12, 2022Update the onnx-mlir version — DependableSystemsLab/LLTFI0 reactions · 2 comments
- Jun 30, 2020Error when trying to lower alex net onnx model to MLIR — onnx/models0 reactions · 1 comment
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,700 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 repository14 other files it gives its agents.
- add-fusion-patternSkill
- add-new-onnx-operationSkill
- add-onnx-op-loweringSkill
- add-onnx-op-to-dialectSkill
- add-onnx-transform-passSkill
- coding-conventionsSkill
- debug-compilationSkill
- debug-type-catalogueSkill
- ground-lit-testsSkill
- nnpa-internalsSkill
- nnpa-performanceSkill
- onnx-mlir-internalsSkill
- upgrade-llvm-mlirSkill
- using-torch-onnxmlir-with-huggingfaceSkill
The file
We split this AGENTS.md into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
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
- Distinctive: line 91
Keep changes focused on the task, and don't reformat or refactor unrelated code.
≈ “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
<!--- SPDX-License-Identifier: Apache-2.0 -->onnx-mlir
onnx-mlir compiles ONNX models to native code using MLIR and LLVM. A model is imported into the ONNX dialect, transformed (shape inference, constant propagation, decompositions), and lowered. The main path goes through the Krnl dialect, then Affine/SCF/MemRef and LLVM. Other paths start from the same ONNX dialect:
- Linalg:
--use-linalg-pathreplaces Krnl for selected ops (--linalg-ops). - StableHLO and TOSA: conversion passes in
src/Conversion/ONNXToStablehlo/andONNXToTOSA/, run throughonnx-mlir-opt. StableHLO is built whenONNX_MLIR_ENABLE_STABLEHLOis on, which is the default. - NNPA (IBM Z): the accelerator lowers supported ops through the ZHigh and
ZLow dialects (
src/Accelerators/NNPA/).
Where things are
src/Builder/: ONNX model importersrc/Dialect/ONNX/,src/Dialect/Krnl/: dialects, ops, shape inferencesrc/Dialect/ONNX/Transforms/,src/Transform/: ONNX-level and Krnl-level passessrc/Conversion/: lowerings (ONNXToKrnl/,KrnlToAffine/,KrnlToLLVM/, ...)src/Accelerators/NNPA/: NNPA acceleratorsrc/Compiler/: driver and options (CompilerOptions.cpp)src/Runtime/: runtime library and Python/Java bindingssrc/Tools/:onnx-mlir-optand other toolstest/mlir/: lit tests;test/backend/: ONNX backend tests;test/numerical/: numerical testsutils/: scripts (gen_onnx_mlir.py,fixLitTest.py,GroundLitTest.py, ...)third_party/: vendored submodules, not modified here
Build and test
onnx-mlir builds against a specific LLVM commit, the one in
utils/clone-mlir.sh. Full setup is in
docs/BuildOnLinuxOSX.md; NNPA builds add
-DONNX_MLIR_ACCELERATORS=NNPA. From an existing build/ directory:
cmake --build . # build; binaries in <Config>/bin
cmake --build . --target check-onnx-lit # lit tests, required for every change
llvm-lit -v test/mlir/onnx/<file>.mlir # one lit test (path relative to build/)
cmake --build . --target check-onnx-backend # ONNX backend tests
TEST_CASE_BY_USER=<test_name> cmake --build . --target check-onnx-backend
cmake --build . --target check-onnx-numerical # numerical testsllvm-lit is in the LLVM build's bin/ directory. Other targets and
environment variables are in docs/Testing.md.
A lit test's CHECK lines only confirm that the output has a given shape, not
that it is correct. When adding or changing a lowering or pass, ground each
case by running it with utils/GroundLitTest.py before recording the CHECK
lines; see docs/GroundedLitTests.md.
Style
- C++: LLVM coding standards, formatted with
clang-formatusing the repository's.clang-format. CI checkssrc/. - Python: formatted with
black, which CI also checks. - Project-specific rules are in CODING_PRACTICE.md and
the
coding-conventionsskill.
Generated files: do not edit by hand
src/Dialect/ONNX/ONNXOps.td.inc: editutils/gen_onnx_mlir.py, then regenerate withmake OMONNXOpsIncTranslationand commit the output (docs/ImportONNXDefs.md).docs/Dialects/*.md: regenerate withmake onnx-mlir-docs.docs/SupportedONNXOps-*.md: generated byutils/documentOps.py..agents/skills/: exported from a knowledge base; see its README.
Skills
Task guides live in .agents/skills/, one SKILL.md per
task: adding ONNX ops (dialect, lowering, end to end), passes, op fusion,
grounded lit tests, debugging compilation, NNPA performance, and LLVM
upgrades. onnx-mlir-internals and nnpa-internals hold background reference
pages. Load the skill that matches the task before starting.
Contribution rules
These come from CONTRIBUTING.md, which follows the LLVM AI Tool Use Policy:
- A human must approve every commit, PR, and comment. Never push, open a PR, or post on GitHub on your own.
- Commits need a DCO sign-off (
git commit -s). Note substantial AI help with anAssisted-by: <tool>trailer or in the PR description. - Keep changes focused on the task, and don't reformat or refactor unrelated code.
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.

