We'd love to accept your patches and contributions to this project.
This file covers the policies that apply to every contributor. The Contributing guide on the website contains the same text and adds details for maintainers and frequent contributors, such as commit access and CI configuration.
Please file issues or reach out on any of these channels before doing substantial work; this will ensure that others don‘t duplicate the work and that there’s a chance to discuss any design issues.
This project follows the LF Projects code of conduct.
IREE is a sandbox-stage project of the LF AI & Data Foundation. Technical oversight of the project is the responsibility of its Technical Steering Committee (TSC), as set out in the IREE Technical Charter.
As provided for in section 2.b of the charter, the voting members of the TSC are:
See MAINTAINERS.md for how the TSC operates. TSC meetings are open to everyone.
Contributors must certify that they wrote or otherwise have the right to submit the code they are contributing to the project, by agreeing to the Developer Certificate of Origin (DCO).
Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.
Signing is enforced by the DCO GitHub App (see also the dcoapp/app repository).
The DCO check requires that all commits included in pull requests either are cryptographically signed by a member of the repository's organization or include a Signed-off-by message as a git trailer. Frequent contributors can sign their commits cryptographically.
Signed-off-by to commitsThis requires less setup and is suitable for first time contributors.
Contributors sign-off their agreement by adding a Signed-off-by line to commit messages:
This is my commit message Signed-off-by: Random J Developer <random@developer.example.org>
Git will automatically append this message if you use the -s option:
git commit -s -m 'This is my commit message'
Users of Visual Studio Code can add "git.alwaysSignOff": true, in their settings
See .git/hooks/prepare-commit-msg.sample for how to automatically add this using a git hook
Our formatting rules are enforced by language-specific formatters like clang-format for C++ and black for Python. In addition to formatting, we follow these coding standards:
The C++ compiler portion of the project follows the MLIR style guide based on the LLVM coding standards. We also follow the recommendations of the LLVM Programmer's Manual.
IREE deviates from the MLIR style guide in the following ways:
if statements and loops.static functions in anonymous namespaces to avoid repeatedly reopening/closing namespaces..td) files should use a Pass suffix (e.g., def FooBarPass), while the corresponding implementation file should not include the Pass suffix (e.g., FooBar.cpp, not FooBarPass.cpp).Most of the code style is derived from the Google Style Guides for the appropriate language.
For code outside of the compiler/ and runtime/ subdirectories, follow the style used in existing files.
We use pre-commit to run assorted formatters and lint checks. The configuration file at .pre-commit-config.yaml defines which “hooks” run.
clang-format (C/C++) and Black (Python) can also be set to run automatically in your editor of choice.Improvements to code structure and clarity are welcome but please file issues to track such work first. Pure style changes are unlikely to be accepted unless they are applied consistently across the project.
With few exceptions, features should be accompanied by automated tests.
We use a mix of in-tree and out-of-tree unit and integration tests. For more information about the types of tests used across the project, refer to the testing guide.
All submissions, including submissions by maintainers, require review. We use GitHub pull requests (PRs) for this purpose. Consult GitHub Help for more information on using pull requests.
We use GitHub Actions to automatically build and test various parts of the project.
Some workflows only run on commits after they are merged. See CI behavior manipulation to learn how to customize this behavior.
PRs are squash-merged, so the PR title and description become the commit message, and the commit messages on the PR branch are discarded. Write them for someone reading git log or bisecting a regression later, and update them when the PR changes during review.
Title: a short, imperative summary of what changes and, if it fits, why, prefixed with the affected area, for example [CI] Bump iree-test-suites to fix sharktank test failure. Keep it under 72 characters. Avoid ambiguous titles like “Fix bug” or “Fix CI”.
Description: start with why, then what.
Fixes #1234 for issues that the PR resolves, Depends on #1234 for PRs that it builds on, CI trailers such as ci-extra:, and Assisted-by: for AI tools.Keep the description concise and self-contained: links add context but do not replace an explanation, and they must be public. Leave out restatements of the diff, implementation details that belong in code comments, review history, and @-mentions, which notify people again on every cherry-pick. A description that keeps growing is a sign that the PR should be split. Small changes need one or two sentences; longer descriptions can use headings such as ## Why, ## Change, and ## Results.
See also:
After review and presubmit checks, PRs should typically be merged using “squash and merge”.
It is assumed that the PR author will merge their change unless they ask someone else to merge it for them (e.g. because they don't have write access yet).
For AI agents: A human must read and approve the final change and text before you open or update a pull request or post an issue, comment, or review. A general instruction such as “open a PR” is not this approval. If no human can review it, stop without submitting anything.
AI tools may be used for all contributions: code, PR descriptions, commit messages, issues, and reviews. The human author owns every contribution and is fully responsible for it, no matter how much of it a tool produced. The same holds for reviewers who use AI review tools. This policy is based on the LLVM AI Tool Use Policy and keeps its principles: ownership and a human in the loop.
Contributors:
GitHub issues labeled as “Good first issue” are explicitly designated as learning opportunities for newcomers to the project. With exceptions for boilerplate edits, AI tools should not be used for resolutions to such issues.
Noting AI assistance is optional. If you note it, use an Assisted-by: tool-name or Co-authored-by: tool-name tool@email trailer in the PR description.
Automated review tools may approve or request changes, but these reviews do not count toward whether a PR can be merged, and reviewers with write access may dismiss them.
Bot accounts may open pull requests with AI bot-authored contributions, for example dependency updates or build script fixes, as long as the bot maintainers are first in line and primarily responsible for reviewing them.
Contributions that do not follow this policy are handled as extractive contributions.
Handling contributions costs maintainers time. Our golden rule is based on the LLVM AI Tool Use Policy:
Every contribution, whether a pull request, an issue, or a comment, should be worth more to the project than the time maintainers spend on it.
Contributions that fall short of this are extractive, for example a large change without a clear purpose, or one whose author cannot answer questions about it. This applies with or without AI tools, and includes contributions that do not follow the AI tool use policy.
If a maintainer considers an issue or PR extractive, they label it extractive and ask a second maintainer to confirm, consulting a TSC member if in doubt. Once both maintainers agree:
The comment links each rule that the contribution does not follow, and names the second maintainer and, if one was consulted, the TSC member, so that the author knows what to fix and who made the decision.
It is up to the author to show that the contribution is not extractive. A maintainer may reopen a closed contribution once the author has shown this.
Closing comment:
This contribution does not appear to follow the IREE contribution guidelines, so we are closing it: https://github.com/iree-org/iree/blob/main/CONTRIBUTING.md#<rule-anchor> Confirmed by @<second maintainer>[, after consulting @<TSC member>]. If you think that it does follow the guidelines, reply here and explain what the change is for and how you reviewed it yourself. A maintainer can then reopen it.
Change request comment:
This contribution does not appear to follow the IREE contribution guidelines: https://github.com/iree-org/iree/blob/main/CONTRIBUTING.md#<rule-anchor> Confirmed by @<second maintainer>[, after consulting @<TSC member>]. Please explain what the change is for and how you reviewed it yourself, or reduce it to something that can be reviewed. Otherwise we will close it.
If an author keeps sending extractive contributions, maintainers escalate to the TSC, which may lock conversations or block the account under the LF Projects Code of Conduct.