From 24db9ce55a49e6b7808d1890e805a63aa3a6b1c0 Mon Sep 17 00:00:00 2001 From: Surendar Rama Sitaraman Date: Fri, 11 Apr 2025 19:32:45 -0700 Subject: [PATCH 1/3] Update CMake configuration in Linux precommit workflow to enable custom crash diagnostics --- .github/workflows/linux-precommit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux-precommit.yml b/.github/workflows/linux-precommit.yml index 556463bf21a1..54b555c00663 100644 --- a/.github/workflows/linux-precommit.yml +++ b/.github/workflows/linux-precommit.yml @@ -57,8 +57,8 @@ jobs: -DLLVM_ENABLE_BINDINGS=OFF \ -DLLVM_ENABLE_RTTI=ON \ -DLLVM_ENABLE_EH=ON \ - -DLLVM_ENABLE_BACKTRACES=OFF \ - -DLLVM_ENABLE_CRASH_OVERRIDES=OFF \ + -DLLVM_ENABLE_BACKTRACES=ON \ + -DLLVM_ENABLE_CRASH_OVERRIDES=ON \ -DLLVM_ENABLE_PROJECTS="mlir" \ -DLLVM_ENABLE_ASSERTIONS=${LLVM_ENABLE_ASSERTIONS} \ -DLLVM_INCLUDE_TESTS=ON \ From ccbe9ff2571546aa60b9859a815ed09fed14e11f Mon Sep 17 00:00:00 2001 From: rayngun <103146671+rayngun@users.noreply.github.com> Date: Wed, 16 Apr 2025 10:17:57 +0000 Subject: [PATCH 2/3] [EISW-141730] 19.x Merge (#107) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [mlir][RFC] Allow to skip operands type specification in ASM form Based on the following discussion: https://llvm.discourse.group/t/declarative-assembly-format-requirement-for-type-presence/4399 Relax checks in `OperationParser` - it allows to skip value type specification, if the value was already defined in the same block. Differential Revision: https://reviews.llvm.org/D111650 * Add FlatSymbolRefAttr and ArrayAttr for memory space representation (#44/#45) * [mlir] Relax ASM parser requirements about operands Type presence * [mlir] Remove LIT tests affected by ASM simplification * Add flag to disable unused GPU dialects in MLIR * [MLIR] Extend MlirOptMain API to register HW-specific options inside * Merge pull request #11 from iszilve/SymbolTableTweaks add support for SymbolContainer trait in MLIR infrastructure * Disable failed tests: #73140 * extend SymbolContainer semantics to SymbolUserMap * Update PR template See PR22 for details * Use virtual inheritance for PassPipelineOptions See PR25 for details * Add method getInlineBlockAndPoint for DialectInlinerInterface * PR #38: Replace BaseMemRef/TensorType class with TypeInterface * PR #27: Adding newlines and tracking indent level moved to mlir::AsmPrinter * Added f8E4M3FN and f8E5M2 support to existing QuantizedTypes (17.x) (#37) * added integral type check * changed to f8e_m_ format, removed isF8 helper method, formatting * added negative tests, removed duplicate test * Added endline in parse-uniform-invalid.mlir * changed to f8E5M2/f8E4M3FN format, enabled default type parsing * updated parse-any-invalid error message checks * Customize memref->tensor conversion via dialect interface (#40) Add a special DialectBufferizerInterface that handles memref -> tensor conversions. Custom dialects must provide the interface implementation for the tensor/memref types they expose. Provide an implementation for Builtin dialect so that mlir::*MemRefType -> mlir::*TensorType is supported natively. However, do this in a form of interface "extension" so that the users could still overwrite the default behavior (e.g. to customize MemRefType::layout -> RankedTensorType::encoding conversion). Use an interface wrapper in memref::getTensorTypeFromMemRefType() - the main place that the one-shot bufferization relies on for type inference, type checking and so on. * Initialize pass options using pipeline options * Fix compilation issue with MSVC * SDL security fixes (#32) * Bump the llvm-docs-requirements group in /llvm/docs with 23 updates Bumps the llvm-docs-requirements group in /llvm/docs with 23 updates: | Package | From | To | | --- | --- | --- | | [alabaster](https://github.com/sphinx-doc/alabaster) | `0.7.13` | `0.7.16` | | [babel](https://github.com/python-babel/babel) | `2.14.0` | `2.15.0` | | [beautifulsoup4](https://www.crummy.com/software/BeautifulSoup/bs4/) | `4.12.2` | `4.12.3` | | [certifi](https://github.com/certifi/python-certifi) | `2023.11.17` | `2024.6.2` | | [docutils](https://docutils.sourceforge.io) | `0.20.1` | `0.21.2` | | [furo](https://github.com/pradyunsg/furo) | `2023.8.19` | `2024.5.6` | | [idna](https://github.com/kjd/idna) | `3.6` | `3.7` | | [jinja2](https://github.com/pallets/jinja) | `3.1.2` | `3.1.4` | | [markdown](https://github.com/Python-Markdown/markdown) | `3.5.1` | `3.6` | | [markupsafe](https://github.com/pallets/markupsafe) | `2.1.3` | `2.1.5` | | [mdit-py-plugins](https://github.com/executablebooks/mdit-py-plugins) | `0.4.0` | `0.4.1` | | [myst-parser](https://github.com/executablebooks/MyST-Parser) | `2.0.0` | `3.0.1` | | [packaging](https://github.com/pypa/packaging) | `23.2` | `24.0` | | [pygments](https://github.com/pygments/pygments) | `2.17.2` | `2.18.0` | | [requests](https://github.com/psf/requests) | `2.31.0` | `2.32.3` | | [sphinx](https://github.com/sphinx-doc/sphinx) | `7.1.2` | `7.3.7` | | [sphinx-automodapi](https://github.com/astropy/sphinx-automodapi) | `0.16.0` | `0.17.0` | | [sphinxcontrib-applehelp](https://github.com/sphinx-doc/sphinxcontrib-applehelp) | `1.0.4` | `1.0.8` | | [sphinxcontrib-devhelp](https://github.com/sphinx-doc/sphinxcontrib-devhelp) | `1.0.5` | `1.0.6` | | [sphinxcontrib-htmlhelp](https://github.com/sphinx-doc/sphinxcontrib-htmlhelp) | `2.0.4` | `2.0.5` | | [sphinxcontrib-qthelp](https://github.com/sphinx-doc/sphinxcontrib-qthelp) | `1.0.6` | `1.0.7` | | [sphinxcontrib-serializinghtml](https://github.com/sphinx-doc/sphinxcontrib-serializinghtml) | `1.1.9` | `1.1.10` | | [urllib3](https://github.com/urllib3/urllib3) | `2.1.0` | `2.2.1` | Updates `alabaster` from 0.7.13 to 0.7.16 - [Release notes](https://github.com/sphinx-doc/alabaster/releases) - [Changelog](https://github.com/sphinx-doc/alabaster/blob/master/docs/changelog.rst) - [Commits](https://github.com/sphinx-doc/alabaster/compare/0.7.13...0.7.16) Updates `babel` from 2.14.0 to 2.15.0 - [Release notes](https://github.com/python-babel/babel/releases) - [Changelog](https://github.com/python-babel/babel/blob/master/CHANGES.rst) - [Commits](https://github.com/python-babel/babel/compare/v2.14.0...v2.15.0) Updates `beautifulsoup4` from 4.12.2 to 4.12.3 Updates `certifi` from 2023.11.17 to 2024.6.2 - [Commits](https://github.com/certifi/python-certifi/compare/2023.11.17...2024.06.02) Updates `docutils` from 0.20.1 to 0.21.2 Updates `furo` from 2023.8.19 to 2024.5.6 - [Release notes](https://github.com/pradyunsg/furo/releases) - [Changelog](https://github.com/pradyunsg/furo/blob/main/docs/changelog.md) - [Commits](https://github.com/pradyunsg/furo/compare/2023.08.19...2024.05.06) Updates `idna` from 3.6 to 3.7 - [Release notes](https://github.com/kjd/idna/releases) - [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.rst) - [Commits](https://github.com/kjd/idna/compare/v3.6...v3.7) Updates `jinja2` from 3.1.2 to 3.1.4 - [Release notes](https://github.com/pallets/jinja/releases) - [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst) - [Commits](https://github.com/pallets/jinja/compare/3.1.2...3.1.4) Updates `markdown` from 3.5.1 to 3.6 - [Release notes](https://github.com/Python-Markdown/markdown/releases) - [Changelog](https://github.com/Python-Markdown/markdown/blob/master/docs/changelog.md) - [Commits](https://github.com/Python-Markdown/markdown/compare/3.5.1...3.6) Updates `markupsafe` from 2.1.3 to 2.1.5 - [Release notes](https://github.com/pallets/markupsafe/releases) - [Changelog](https://github.com/pallets/markupsafe/blob/main/CHANGES.rst) - [Commits](https://github.com/pallets/markupsafe/compare/2.1.3...2.1.5) Updates `mdit-py-plugins` from 0.4.0 to 0.4.1 - [Release notes](https://github.com/executablebooks/mdit-py-plugins/releases) - [Changelog](https://github.com/executablebooks/mdit-py-plugins/blob/master/CHANGELOG.md) - [Commits](https://github.com/executablebooks/mdit-py-plugins/compare/v0.4.0...v0.4.1) Updates `myst-parser` from 2.0.0 to 3.0.1 - [Release notes](https://github.com/executablebooks/MyST-Parser/releases) - [Changelog](https://github.com/executablebooks/MyST-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/executablebooks/MyST-Parser/compare/v2.0.0...v3.0.1) Updates `packaging` from 23.2 to 24.0 - [Release notes](https://github.com/pypa/packaging/releases) - [Changelog](https://github.com/pypa/packaging/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pypa/packaging/compare/23.2...24.0) Updates `pygments` from 2.17.2 to 2.18.0 - [Release notes](https://github.com/pygments/pygments/releases) - [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES) - [Commits](https://github.com/pygments/pygments/compare/2.17.2...2.18.0) Updates `requests` from 2.31.0 to 2.32.3 - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.31.0...v2.32.3) Updates `sphinx` from 7.1.2 to 7.3.7 - [Release notes](https://github.com/sphinx-doc/sphinx/releases) - [Changelog](https://github.com/sphinx-doc/sphinx/blob/master/CHANGES.rst) - [Commits](https://github.com/sphinx-doc/sphinx/compare/v7.1.2...v7.3.7) Updates `sphinx-automodapi` from 0.16.0 to 0.17.0 - [Release notes](https://github.com/astropy/sphinx-automodapi/releases) - [Changelog](https://github.com/astropy/sphinx-automodapi/blob/main/CHANGES.rst) - [Commits](https://github.com/astropy/sphinx-automodapi/compare/v0.16.0...v0.17.0) Updates `sphinxcontrib-applehelp` from 1.0.4 to 1.0.8 - [Release notes](https://github.com/sphinx-doc/sphinxcontrib-applehelp/releases) - [Changelog](https://github.com/sphinx-doc/sphinxcontrib-applehelp/blob/master/CHANGES) - [Commits](https://github.com/sphinx-doc/sphinxcontrib-applehelp/compare/1.0.4...1.0.8) Updates `sphinxcontrib-devhelp` from 1.0.5 to 1.0.6 - [Release notes](https://github.com/sphinx-doc/sphinxcontrib-devhelp/releases) - [Changelog](https://github.com/sphinx-doc/sphinxcontrib-devhelp/blob/1.0.6/CHANGES) - [Commits](https://github.com/sphinx-doc/sphinxcontrib-devhelp/compare/1.0.5...1.0.6) Updates `sphinxcontrib-htmlhelp` from 2.0.4 to 2.0.5 - [Release notes](https://github.com/sphinx-doc/sphinxcontrib-htmlhelp/releases) - [Changelog](https://github.com/sphinx-doc/sphinxcontrib-htmlhelp/blob/2.0.5/CHANGES) - [Commits](https://github.com/sphinx-doc/sphinxcontrib-htmlhelp/compare/2.0.4...2.0.5) Updates `sphinxcontrib-qthelp` from 1.0.6 to 1.0.7 - [Release notes](https://github.com/sphinx-doc/sphinxcontrib-qthelp/releases) - [Changelog](https://github.com/sphinx-doc/sphinxcontrib-qthelp/blob/1.0.7/CHANGES) - [Commits](https://github.com/sphinx-doc/sphinxcontrib-qthelp/compare/1.0.6...1.0.7) Updates `sphinxcontrib-serializinghtml` from 1.1.9 to 1.1.10 - [Release notes](https://github.com/sphinx-doc/sphinxcontrib-serializinghtml/releases) - [Changelog](https://github.com/sphinx-doc/sphinxcontrib-serializinghtml/blob/master/CHANGES) - [Commits](https://github.com/sphinx-doc/sphinxcontrib-serializinghtml/compare/1.1.9...1.1.10) Updates `urllib3` from 2.1.0 to 2.2.1 - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/2.1.0...2.2.1) --- updated-dependencies: - dependency-name: alabaster dependency-type: direct:production update-type: version-update:semver-patch dependency-group: llvm-docs-requirements - dependency-name: babel dependency-type: direct:production update-type: version-update:semver-minor dependency-group: llvm-docs-requirements - dependency-name: beautifulsoup4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: llvm-docs-requirements - dependency-name: certifi dependency-type: direct:production update-type: version-update:semver-major dependency-group: llvm-docs-requirements - dependency-name: docutils dependency-type: direct:production update-type: version-update:semver-minor dependency-group: llvm-docs-requirements - dependency-name: furo dependency-type: direct:production update-type: version-update:semver-major dependency-group: llvm-docs-requirements - dependency-name: idna dependency-type: direct:production update-type: version-update:semver-minor dependency-group: llvm-docs-requirements - dependency-name: jinja2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: llvm-docs-requirements - dependency-name: markdown dependency-type: direct:production update-type: version-update:semver-minor dependency-group: llvm-docs-requirements - dependency-name: markupsafe dependency-type: direct:production update-type: version-update:semver-patch dependency-group: llvm-docs-requirements - dependency-name: mdit-py-plugins dependency-type: direct:production update-type: version-update:semver-patch dependency-group: llvm-docs-requirements - dependency-name: myst-parser dependency-type: direct:production update-type: version-update:semver-major dependency-group: llvm-docs-requirements - dependency-name: packaging dependency-type: direct:production update-type: version-update:semver-major dependency-group: llvm-docs-requirements - dependency-name: pygments dependency-type: direct:production update-type: version-update:semver-minor dependency-group: llvm-docs-requirements - dependency-name: requests dependency-type: direct:production update-type: version-update:semver-minor dependency-group: llvm-docs-requirements - dependency-name: sphinx dependency-type: direct:production update-type: version-update:semver-minor dependency-group: llvm-docs-requirements - dependency-name: sphinx-automodapi dependency-type: direct:production update-type: version-update:semver-minor dependency-group: llvm-docs-requirements - dependency-name: sphinxcontrib-applehelp dependency-type: direct:production update-type: version-update:semver-patch dependency-group: llvm-docs-requirements - dependency-name: sphinxcontrib-devhelp dependency-type: direct:production update-type: version-update:semver-patch dependency-group: llvm-docs-requirements - dependency-name: sphinxcontrib-htmlhelp dependency-type: direct:production update-type: version-update:semver-patch dependency-group: llvm-docs-requirements - dependency-name: sphinxcontrib-qthelp dependency-type: direct:production update-type: version-update:semver-patch dependency-group: llvm-docs-requirements - dependency-name: sphinxcontrib-serializinghtml dependency-type: direct:production update-type: version-update:semver-patch dependency-group: llvm-docs-requirements - dependency-name: urllib3 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: llvm-docs-requirements ... Signed-off-by: dependabot[bot] * Bump the github-actions group with 8 updates Bumps the github-actions group with 8 updates: | Package | From | To | | --- | --- | --- | | [tj-actions/changed-files](https://github.com/tj-actions/changed-files) | `39` | `44` | | [actions/setup-python](https://github.com/actions/setup-python) | `4` | `5` | | [actions/download-artifact](https://github.com/actions/download-artifact) | `3` | `4` | | [actions/setup-node](https://github.com/actions/setup-node) | `3` | `4` | | [actions/github-script](https://github.com/actions/github-script) | `6` | `7` | | [actions/labeler](https://github.com/actions/labeler) | `4` | `5` | | [ossf/scorecard-action](https://github.com/ossf/scorecard-action) | `2.1.2` | `2.3.3` | | [github/codeql-action](https://github.com/github/codeql-action) | `2.2.4` | `3.25.8` | Updates `tj-actions/changed-files` from 39 to 44 - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](https://github.com/tj-actions/changed-files/compare/v39...v44) Updates `actions/setup-python` from 4 to 5 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v4...v5) Updates `actions/download-artifact` from 3 to 4 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v3...v4) Updates `actions/setup-node` from 3 to 4 - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v3...v4) Updates `actions/github-script` from 6 to 7 - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/v6...v7) Updates `actions/labeler` from 4 to 5 - [Release notes](https://github.com/actions/labeler/releases) - [Commits](https://github.com/actions/labeler/compare/v4...v5) Updates `ossf/scorecard-action` from 2.1.2 to 2.3.3 - [Release notes](https://github.com/ossf/scorecard-action/releases) - [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md) - [Commits](https://github.com/ossf/scorecard-action/compare/e38b1902ae4f44df626f11ba0734b14fb91f8f86...dc50aa9510b46c811795eb24b2f1ba02a914e534) Updates `github/codeql-action` from 2.2.4 to 3.25.8 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/17573ee1cc1b9d061760f3a006fc4aac4f944fd5...2e230e8fe0ad3a14a340ad0815ddb96d599d2aff) --- updated-dependencies: - dependency-name: tj-actions/changed-files dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: actions/github-script dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: actions/labeler dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: ossf/scorecard-action dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions ... Signed-off-by: dependabot[bot] * Bump black from 23.9.1 to 24.3.0 in /llvm/utils/git Bumps [black](https://github.com/psf/black) from 23.9.1 to 24.3.0. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/23.9.1...24.3.0) --- updated-dependencies: - dependency-name: black dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Bump requests from 2.31.0 to 2.32.2 in /llvm/utils/git Bumps [requests](https://github.com/psf/requests) from 2.31.0 to 2.32.2. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.31.0...v2.32.2) --- updated-dependencies: - dependency-name: requests dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Bump cryptography from 41.0.3 to 42.0.4 in /llvm/utils/git Bumps [cryptography](https://github.com/pyca/cryptography) from 41.0.3 to 42.0.4. - [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pyca/cryptography/compare/41.0.3...42.0.4) --- updated-dependencies: - dependency-name: cryptography dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Bump urllib3 from 2.0.4 to 2.0.7 in /llvm/utils/git Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.0.4 to 2.0.7. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/2.0.4...2.0.7) --- updated-dependencies: - dependency-name: urllib3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Bump idna from 3.4 to 3.7 in /llvm/utils/git Bumps [idna](https://github.com/kjd/idna) from 3.4 to 3.7. - [Release notes](https://github.com/kjd/idna/releases) - [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.rst) - [Commits](https://github.com/kjd/idna/compare/v3.4...v3.7) --- updated-dependencies: - dependency-name: idna dependency-type: direct:production ... Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * SDL fixes 2 (#43) * Bump braces from 3.0.2 to 3.0.3 in /mlir/utils/vscode Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3. - [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md) - [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3) --- updated-dependencies: - dependency-name: braces dependency-type: indirect ... Signed-off-by: dependabot[bot] * Bump packaging Bumps the llvm-docs-requirements group with 1 update in the /llvm/docs directory: [packaging](https://github.com/pypa/packaging). Updates `packaging` from 24.0 to 24.1 - [Release notes](https://github.com/pypa/packaging/releases) - [Changelog](https://github.com/pypa/packaging/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pypa/packaging/compare/24.0...24.1) --- updated-dependencies: - dependency-name: packaging dependency-type: direct:production update-type: version-update:semver-minor dependency-group: llvm-docs-requirements ... Signed-off-by: dependabot[bot] * Bump the github-actions group across 1 directory with 2 updates Bumps the github-actions group with 2 updates in the / directory: [actions/checkout](https://github.com/actions/checkout) and [github/codeql-action](https://github.com/github/codeql-action). Updates `actions/checkout` from 3.1.0 to 4.1.7 - [Release notes](https://github.com/actions/checkout/releases) - [Commits](https://github.com/actions/checkout/compare/v3.1.0...v4.1.7) Updates `github/codeql-action` from 3.25.8 to 3.25.10 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/2e230e8fe0ad3a14a340ad0815ddb96d599d2aff...23acc5c183826b7a8a97bce3cecc52db901f8251) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions ... Signed-off-by: dependabot[bot] * Bump urllib3 from 2.0.7 to 2.2.2 in /llvm/utils/git Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.0.7 to 2.2.2. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/2.0.7...2.2.2) --- updated-dependencies: - dependency-name: urllib3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Bump urllib3 from 2.2.1 to 2.2.2 in /llvm/docs Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.1 to 2.2.2. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/2.2.1...2.2.2) --- updated-dependencies: - dependency-name: urllib3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Bump minimatch from 3.0.4 to 3.1.2 in /mlir/utils/vscode Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2. - [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md) - [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2) --- updated-dependencies: - dependency-name: minimatch dependency-type: indirect ... Signed-off-by: dependabot[bot] * Bump semver from 5.7.1 to 5.7.2 in /llvm/utils/vscode/llvm Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2. - [Release notes](https://github.com/npm/node-semver/releases) - [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md) - [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2) --- updated-dependencies: - dependency-name: semver dependency-type: indirect ... Signed-off-by: dependabot[bot] * Bump gitpython from 3.1.32 to 3.1.41 in /llvm/utils/git Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.32 to 3.1.41. - [Release notes](https://github.com/gitpython-developers/GitPython/releases) - [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES) - [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.32...3.1.41) --- updated-dependencies: - dependency-name: gitpython dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Bump qs from 6.10.1 to 6.12.1 in /mlir/utils/vscode Bumps [qs](https://github.com/ljharb/qs) from 6.10.1 to 6.12.1. - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.10.1...v6.12.1) --- updated-dependencies: - dependency-name: qs dependency-type: indirect ... Signed-off-by: dependabot[bot] * cryptography version is bumped * Bump urllib3 version * Bump requests version * Bump idna version --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Port Ubunu-24 warning fixes to npu/release/18.x (#45) * Fix declared here * Fix Ubuntu24 (#33) * [mlir] Add --list-passes option to mlir-opt (#100420) (#52) Currently, the only way to see the passes that were registered is by calling “mlir-opt --help”. However, for compilers with 500+ passes, the help message becomes too long and sometimes hard to understand. In this PR I add a new "--list-passes" option to mlir-opt, which can be used for printing only the registered passes, a feature that would be extremely useful. * Extend Quant dialect with Quantile Quantization type (#53) * Expanding Quant dialect with Quantile Quantized type * Adding quantile mlir tests * Adding check on quantiles array size and updated mlir tests * Bump certifi from 2024.6.2 to 2024.7.4 in /llvm/docs (#48) Bumps [certifi](https://github.com/certifi/python-certifi) from 2024.6.2 to 2024.7.4. - [Commits](https://github.com/certifi/python-certifi/compare/2024.06.02...2024.07.04) --- updated-dependencies: - dependency-name: certifi dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump certifi from 2023.7.22 to 2024.7.4 in /llvm/utils/git (#47) Bumps [certifi](https://github.com/certifi/python-certifi) from 2023.7.22 to 2024.7.4. - [Commits](https://github.com/certifi/python-certifi/compare/2023.07.22...2024.07.04) --- updated-dependencies: - dependency-name: certifi dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Extending QuantileQuantizedType with quantileType mlir::Type member (#60) * [ADT] Require base equality in indexed_accessor_iterator::operator==() (#107856) (#64) Similarly to operator<(), equality-comparing iterators from different ranges must really be forbidden. The preconditions for being able to do `it1 < it2` and `it1 != it2` (or `it1 == it2` for the matter) ought to be the same. Thus, there's little sense in keeping explicit base object comparison in operator==() whilst having this is a precondition in operator<() and operator-() (e.g. used for std::distance() and such). Co-authored-by: Andrei Golubev * Bump cryptography from 42.0.4 to 43.0.1 in /llvm/utils/git (#59) Bumps [cryptography](https://github.com/pyca/cryptography) from 42.0.4 to 43.0.1. - [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pyca/cryptography/compare/42.0.4...43.0.1) --- updated-dependencies: - dependency-name: cryptography dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump cryptography and certifi versions (#65) * Relax negative scales conditions in Quant Dialect (#61) * relax negative scale conditions * adapt tests now handling negative scales * Adding missing check in QuantileQuantizedPerAxisType::verify (#66) * Adding missing check in QuantileQuantizedPerAxisType::verify * Adding minor test for illegal quantile array size for per axis type * Adding new quantileType types to mlir test (#85) * Add Value back to SideEffectInterfaces This reverses partially changed in commit 2c1ae801e1b66a09a15028ae4ba614e0911eec00 * Expose TimingManager OutputTextStrategy VPUx references directly. This was hidden on the LLVM side with commit 362aa434cc31ccca96749a6db8cd97f5b7d71206 * EISW-161791 Adding -D macro to avoid compilation failure of mlir-src-sharder Signed-off-by: Dhawal Srivastava * Revert "[mlir][Symbol] Add verification that symbol's parent is a SymbolTable (#80590)" This reverts commit 7d055af14b7dd7e782b87fb883205eda65e8bd44. * Disable TosaToTensor * Disable XeGPU * Linux precommit (#88) * GitHub Workflow changes * Update CMake configuration in Linux precommit workflow to enable custom crash diagnostics --------- Signed-off-by: dependabot[bot] Signed-off-by: Dhawal Srivastava Co-authored-by: Vladislav Vinogradov Co-authored-by: Nikita Kudriavtsev Co-authored-by: Jack Clarke Co-authored-by: istvan.szilveszter@intel.com Co-authored-by: Xin Zhang Co-authored-by: Jacenty Andruszkiewicz Co-authored-by: AndreiFilip <152861930+AndreiFilipIntel@users.noreply.github.com> Co-authored-by: Andrei Golubev Co-authored-by: Schondube, Jorn Co-authored-by: Maksim Doronin Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daria Mityagina Co-authored-by: Natan-GabrielTiutiuIntel <101411449+Natan-GabrielTiutiuIntel@users.noreply.github.com> Co-authored-by: Luca Sarti Co-authored-by: Zoran Zomborat Co-authored-by: Dhawal Srivastava Co-authored-by: Skrebkov, Artemy Co-authored-by: Surendar Rama Sitaraman --- .github/CODEOWNERS | 139 +-- .github/PULL_REQUEST_TEMPLATE.md | 15 + .github/dependabot.yml | 45 + .github/new-issues-labeler.yml | 29 - .github/new-prs-labeler.yml | 1003 ----------------- .github/workflows/build-ci-container.yml | 112 -- .../workflows/ci-post-commit-analyzer-run.py | 34 - .github/workflows/ci-post-commit-analyzer.yml | 95 -- .github/workflows/clang-tests.yml | 38 - .github/workflows/codeql.yml | 78 ++ .../containers/github-action-ci/Dockerfile | 48 + .../github-action-ci/bootstrap.patch | 13 - .../github-action-ci/stage1.Dockerfile | 44 - .../github-action-ci/stage2.Dockerfile | 29 - .../containers/github-action-ci/storage.conf | 4 - .github/workflows/dependency-review.yml | 27 + .github/workflows/docs.yml | 169 --- .github/workflows/email-check.yaml | 46 - .github/workflows/get-llvm-version/action.yml | 26 - .github/workflows/issue-release-workflow.yml | 69 -- .github/workflows/issue-subscriber.yml | 37 - .github/workflows/issue-write.yml | 157 --- .github/workflows/libclang-abi-tests.yml | 168 --- .github/workflows/libclang-python-tests.yml | 47 - .github/workflows/libclc-tests.yml | 39 - .github/workflows/libcxx-build-and-test.yaml | 234 ---- .../libcxx-check-generated-files.yml | 24 - .../libcxx-restart-preempted-jobs.yaml | 132 --- .github/workflows/linux-precommit.yml | 95 ++ .github/workflows/lld-tests.yml | 38 - .github/workflows/lldb-tests.yml | 39 - .github/workflows/llvm-bugs.yml | 63 -- .github/workflows/llvm-project-tests.yml | 154 --- .../workflows/llvm-project-workflow-tests.yml | 32 - .github/workflows/llvm-tests.yml | 192 ---- .github/workflows/merged-prs.yml | 41 - .github/workflows/new-issues.yml | 23 - .github/workflows/new-prs.yml | 75 -- .github/workflows/pr-code-format.yml | 48 +- .github/workflows/pr-request-release-note.yml | 49 - .github/workflows/pr-subscriber.yml | 34 - .github/workflows/release-binaries-all.yml | 98 -- .../release-binaries-save-stage/action.yml | 44 - .../release-binaries-setup-stage/action.yml | 59 - .github/workflows/release-binaries.yml | 492 -------- .github/workflows/release-documentation.yml | 91 -- .github/workflows/release-doxygen.yml | 72 -- .github/workflows/release-lit.yml | 79 -- .github/workflows/release-sources.yml | 108 -- .github/workflows/release-tasks.yml | 123 -- .github/workflows/scorecard.yml | 37 +- .../workflows/set-release-binary-outputs.sh | 34 - .github/workflows/spirv-tests.yml | 29 - .../unprivileged-download-artifact/action.yml | 81 -- .github/workflows/version-check.py | 36 - .github/workflows/version-check.yml | 31 - llvm/cmake/modules/TableGen.cmake | 2 +- llvm/docs/requirements-hashed.txt | 242 ++-- llvm/docs/requirements.txt | 8 +- llvm/include/llvm/ADT/FunctionExtras.h | 2 +- llvm/include/llvm/ADT/STLExtras.h | 3 +- llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp | 4 +- llvm/utils/git/requirements.txt | 56 +- llvm/utils/git/requirements_formatting.txt | 10 +- llvm/utils/git/requirements_formatting.txt.in | 2 +- llvm/utils/vscode/llvm/package-lock.json | 6 +- mlir/CMakeLists.txt | 4 + mlir/examples/toy/Ch5/toyc.cpp | 2 + mlir/examples/toy/Ch6/toyc.cpp | 2 + mlir/examples/toy/Ch7/toyc.cpp | 2 + mlir/include/mlir/Conversion/Passes.h | 2 +- mlir/include/mlir/Conversion/Passes.td | 24 +- .../Bufferization/Extensions/AllExtensions.h | 29 + .../Dialect/Bufferization/IR/Bufferization.h | 5 + .../Bufferization/IR/BufferizationOps.td | 4 +- mlir/include/mlir/Dialect/CMakeLists.txt | 6 +- .../Dialect/Quant/QuantDialectBytecode.td | 35 +- .../mlir/Dialect/Quant/QuantOpsBase.td | 30 + mlir/include/mlir/Dialect/Quant/QuantTypes.h | 160 +++ mlir/include/mlir/IR/BuiltinTypeInterfaces.td | 80 +- mlir/include/mlir/IR/BuiltinTypes.h | 110 -- mlir/include/mlir/IR/BuiltinTypes.td | 60 +- mlir/include/mlir/IR/OpImplementation.h | 34 +- mlir/include/mlir/IR/SymbolInterfaces.td | 7 +- mlir/include/mlir/IR/SymbolTable.h | 41 + mlir/include/mlir/InitAllDialects.h | 6 +- mlir/include/mlir/InitAllExtensions.h | 3 + mlir/include/mlir/InitAllPasses.h | 4 +- .../mlir/Interfaces/SideEffectInterfaces.h | 9 +- mlir/include/mlir/Pass/Pass.h | 4 + mlir/include/mlir/Pass/PassOptions.h | 5 +- mlir/include/mlir/Pass/PassRegistry.h | 3 + mlir/include/mlir/Support/Timing.h | 48 + .../include/mlir/Tools/mlir-opt/MlirOptMain.h | 31 +- .../mlir/Transforms/BufferizationUtils.h | 55 + mlir/include/mlir/Transforms/InliningUtils.h | 8 + mlir/lib/AsmParser/Parser.cpp | 26 +- mlir/lib/Conversion/CMakeLists.txt | 45 +- .../lib/Conversion/GPUToVulkan/CMakeLists.txt | 26 +- mlir/lib/Dialect/Arith/IR/CMakeLists.txt | 1 + mlir/lib/Dialect/Bufferization/CMakeLists.txt | 1 + .../Extensions/AllExtensions.cpp | 41 + .../Bufferization/Extensions/CMakeLists.txt | 11 + .../IR/BufferizableOpInterface.cpp | 3 +- .../Bufferization/IR/BufferizationOps.cpp | 8 + .../Dialect/Bufferization/IR/CMakeLists.txt | 1 + mlir/lib/Dialect/CMakeLists.txt | 6 +- mlir/lib/Dialect/LLVMIR/CMakeLists.txt | 1 + .../NVGPU/TransformOps/NVGPUTransformOps.cpp | 2 +- mlir/lib/Dialect/Quant/IR/QuantOps.cpp | 3 +- mlir/lib/Dialect/Quant/IR/QuantTypes.cpp | 230 +++- mlir/lib/Dialect/Quant/IR/TypeDetail.h | 154 +++ mlir/lib/Dialect/Quant/IR/TypeParser.cpp | 322 +++++- .../BufferizableOpInterfaceImpl.cpp | 14 +- mlir/lib/IR/AsmPrinter.cpp | 68 +- mlir/lib/IR/BuiltinTypes.cpp | 137 +-- mlir/lib/IR/SymbolTable.cpp | 63 +- mlir/lib/Pass/Pass.cpp | 6 + mlir/lib/Pass/PassRegistry.cpp | 39 + mlir/lib/Support/Timing.cpp | 47 - mlir/lib/Target/CMakeLists.txt | 4 +- mlir/lib/Tools/mlir-opt/MlirOptMain.cpp | 63 +- .../Transforms/Utils/BufferizationUtils.cpp | 25 + mlir/lib/Transforms/Utils/CMakeLists.txt | 1 + mlir/lib/Transforms/Utils/Inliner.cpp | 3 +- mlir/lib/Transforms/Utils/InliningUtils.cpp | 19 +- .../TosaToTensor/tosa-to-tensor-invalid.mlir | 8 - .../TosaToTensor/tosa-to-tensor.mlir | 660 ----------- mlir/test/Dialect/LLVMIR/global.mlir | 2 +- mlir/test/Dialect/LLVMIR/invalid.mlir | 14 - .../Dialect/Linalg/transform-op-replace.mlir | 6 +- mlir/test/Dialect/Quant/Bytecode/types.mlir | 55 + .../test/Dialect/Quant/parse-any-invalid.mlir | 4 +- .../Dialect/Quant/parse-quantile-invalid.mlir | 188 +++ mlir/test/Dialect/Quant/parse-quantile.mlir | 183 +++ .../Dialect/Quant/parse-uniform-invalid.mlir | 31 +- mlir/test/Dialect/Quant/parse-uniform.mlir | 63 ++ mlir/test/Dialect/Test/bufferize.mlir | 15 + mlir/test/Dialect/Transform/ops-invalid.mlir | 3 +- mlir/test/Dialect/XeGPU/XeGPUOps.mlir | 179 --- mlir/test/Dialect/XeGPU/invalid.mlir | 187 --- .../Dialect/XeGPU/xegpu-fold-alias-ops.mlir | 20 - mlir/test/IR/invalid-func-op.mlir | 4 +- mlir/test/IR/invalid.mlir | 16 + mlir/test/IR/parser.mlir | 10 + mlir/test/IR/region.mlir | 7 +- mlir/test/IR/test-symbol-rauw.mlir | 18 +- mlir/test/IR/traits.mlir | 33 +- mlir/test/Transforms/canonicalize-dce.mlir | 14 +- mlir/test/Transforms/canonicalize.mlir | 13 +- mlir/test/Transforms/constant-fold.mlir | 11 +- mlir/test/Transforms/cse.mlir | 11 +- mlir/test/Transforms/test-legalizer-full.mlir | 8 +- mlir/test/lib/Dialect/Test/CMakeLists.txt | 6 + mlir/test/lib/Dialect/Test/Passes.cpp | 55 + mlir/test/lib/Dialect/Test/Passes.h | 41 + mlir/test/lib/Dialect/Test/Passes.td | 25 + mlir/test/lib/Dialect/Test/TestAttrDefs.td | 6 + mlir/test/lib/Dialect/Test/TestAttributes.cpp | 28 + mlir/test/lib/Dialect/Test/TestDialect.cpp | 70 ++ mlir/test/lib/Dialect/Test/TestDialect.h | 2 + mlir/test/lib/Dialect/Test/TestOps.cpp | 1 + mlir/test/lib/Dialect/Test/TestOps.h | 1 + mlir/test/lib/Dialect/Test/TestOps.td | 30 + mlir/test/lib/Dialect/Test/TestOpsSyntax.cpp | 21 + mlir/test/lib/Dialect/Test/TestOpsSyntax.td | 3 + mlir/test/lib/Dialect/Test/TestTypeDefs.td | 53 + mlir/test/lib/Dialect/Test/TestTypes.cpp | 27 + .../mlir-tblgen/testdialect-attrdefs.mlir | 16 +- .../mlir-tblgen/testdialect-typedefs.mlir | 11 +- mlir/test/python/ir/value.py | 36 +- mlir/tools/mlir-opt/mlir-opt.cpp | 3 + .../tools/mlir-tblgen/AttrOrTypeFormatGen.cpp | 4 +- mlir/unittests/Pass/CMakeLists.txt | 1 + .../Pass/PassPipelineOptionsTest.cpp | 121 ++ .../Transforms/BufferizationUtils.cpp | 154 +++ mlir/unittests/Transforms/CMakeLists.txt | 5 +- mlir/utils/vscode/package-lock.json | 334 ++++-- 178 files changed, 3783 insertions(+), 6750 deletions(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/new-issues-labeler.yml delete mode 100644 .github/new-prs-labeler.yml delete mode 100644 .github/workflows/build-ci-container.yml delete mode 100644 .github/workflows/ci-post-commit-analyzer-run.py delete mode 100644 .github/workflows/ci-post-commit-analyzer.yml delete mode 100644 .github/workflows/clang-tests.yml create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/containers/github-action-ci/Dockerfile delete mode 100644 .github/workflows/containers/github-action-ci/bootstrap.patch delete mode 100644 .github/workflows/containers/github-action-ci/stage1.Dockerfile delete mode 100644 .github/workflows/containers/github-action-ci/stage2.Dockerfile delete mode 100644 .github/workflows/containers/github-action-ci/storage.conf create mode 100644 .github/workflows/dependency-review.yml delete mode 100644 .github/workflows/docs.yml delete mode 100644 .github/workflows/email-check.yaml delete mode 100644 .github/workflows/get-llvm-version/action.yml delete mode 100644 .github/workflows/issue-release-workflow.yml delete mode 100644 .github/workflows/issue-subscriber.yml delete mode 100644 .github/workflows/issue-write.yml delete mode 100644 .github/workflows/libclang-abi-tests.yml delete mode 100644 .github/workflows/libclang-python-tests.yml delete mode 100644 .github/workflows/libclc-tests.yml delete mode 100644 .github/workflows/libcxx-build-and-test.yaml delete mode 100644 .github/workflows/libcxx-check-generated-files.yml delete mode 100644 .github/workflows/libcxx-restart-preempted-jobs.yaml create mode 100644 .github/workflows/linux-precommit.yml delete mode 100644 .github/workflows/lld-tests.yml delete mode 100644 .github/workflows/lldb-tests.yml delete mode 100644 .github/workflows/llvm-bugs.yml delete mode 100644 .github/workflows/llvm-project-tests.yml delete mode 100644 .github/workflows/llvm-project-workflow-tests.yml delete mode 100644 .github/workflows/llvm-tests.yml delete mode 100644 .github/workflows/merged-prs.yml delete mode 100644 .github/workflows/new-issues.yml delete mode 100644 .github/workflows/new-prs.yml delete mode 100644 .github/workflows/pr-request-release-note.yml delete mode 100644 .github/workflows/pr-subscriber.yml delete mode 100644 .github/workflows/release-binaries-all.yml delete mode 100644 .github/workflows/release-binaries-save-stage/action.yml delete mode 100644 .github/workflows/release-binaries-setup-stage/action.yml delete mode 100644 .github/workflows/release-binaries.yml delete mode 100644 .github/workflows/release-documentation.yml delete mode 100644 .github/workflows/release-doxygen.yml delete mode 100644 .github/workflows/release-lit.yml delete mode 100644 .github/workflows/release-sources.yml delete mode 100644 .github/workflows/release-tasks.yml delete mode 100644 .github/workflows/set-release-binary-outputs.sh delete mode 100644 .github/workflows/spirv-tests.yml delete mode 100644 .github/workflows/unprivileged-download-artifact/action.yml delete mode 100755 .github/workflows/version-check.py delete mode 100644 .github/workflows/version-check.yml create mode 100644 mlir/include/mlir/Dialect/Bufferization/Extensions/AllExtensions.h create mode 100644 mlir/include/mlir/Transforms/BufferizationUtils.h create mode 100644 mlir/lib/Dialect/Bufferization/Extensions/AllExtensions.cpp create mode 100644 mlir/lib/Dialect/Bufferization/Extensions/CMakeLists.txt create mode 100644 mlir/lib/Transforms/Utils/BufferizationUtils.cpp delete mode 100644 mlir/test/Conversion/TosaToTensor/tosa-to-tensor-invalid.mlir delete mode 100644 mlir/test/Conversion/TosaToTensor/tosa-to-tensor.mlir create mode 100644 mlir/test/Dialect/Quant/parse-quantile-invalid.mlir create mode 100644 mlir/test/Dialect/Quant/parse-quantile.mlir create mode 100644 mlir/test/Dialect/Test/bufferize.mlir delete mode 100644 mlir/test/Dialect/XeGPU/XeGPUOps.mlir delete mode 100644 mlir/test/Dialect/XeGPU/invalid.mlir delete mode 100644 mlir/test/Dialect/XeGPU/xegpu-fold-alias-ops.mlir create mode 100644 mlir/test/lib/Dialect/Test/Passes.cpp create mode 100644 mlir/test/lib/Dialect/Test/Passes.h create mode 100644 mlir/test/lib/Dialect/Test/Passes.td create mode 100644 mlir/unittests/Pass/PassPipelineOptionsTest.cpp create mode 100644 mlir/unittests/Transforms/BufferizationUtils.cpp diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 02303c5e6cc5..8630f4dde230 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -12,141 +12,4 @@ # https://llvm.org/docs/DeveloperPolicy.html#code-owners, as well as the # CODE_OWNERS.txt files in the respective subproject directories. -/libcxx/ @llvm/reviewers-libcxx -/libcxxabi/ @llvm/reviewers-libcxxabi -/libunwind/ @llvm/reviewers-libunwind -/runtimes/ @llvm/reviewers-libcxx - -/llvm/lib/Analysis/BasicAliasAnalysis.cpp @nikic -/llvm/lib/Analysis/InstructionSimplify.cpp @nikic -/llvm/lib/Analysis/LazyValueInfo.cpp @nikic -/llvm/lib/Analysis/ScalarEvolution.cpp @nikic -/llvm/lib/Analysis/ValueTracking.cpp @nikic -/llvm/lib/IR/ConstantRange.cpp @nikic -/llvm/lib/IR/Core.cpp @nikic -/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp @nikic -/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp @nikic -/llvm/lib/Transforms/InstCombine/ @nikic - -/clang/include/clang/Sema/Sema.h @Endilll -/clang/test/CXX/drs/ @Endilll -/clang/www/cxx_dr_status.html @Endilll -/clang/www/make_cxx_dr_status @Endilll - -clang/lib/AST/Interp/ @tbaederr -clang/test/AST/Interp/ @tbaederr - -/clang/include/clang/CIR @lanza @bcardosolopes -/clang/lib/CIR @lanza @bcardosolopes -/clang/tools/cir-* @lanza @bcardosolopes - -/lldb/ @JDevlieghere - -# MLIR Interfaces. -/mlir/include/mlir/Interfaces/TilingInterface.* @MaheshRavishankar @nicolasvasilache -/mlir/lib/Interfaces/TilingInterface.* @MaheshRavishankar @nicolasvasilache -/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.* @matthias-springer -/mlir/lib/Interfaces/ValueBoundsOpInterface.* @matthias-springer -/mlir/**/ValueBoundsOpInterfaceImpl.* @matthias-springer -/mlir/include/mlir/Interfaces/RuntimeVerifiableOpInterface.* @matthias-springer -/mlir/lib/Interfaces/RuntimeVerifiableOpInterface.* @matthias-springer -/mlir/**/RuntimeVerifiableOpInterfaceImpl.* @matthias-springer -/mlir/include/mlir/Interfaces/SubsetOpInterface.* @matthias-springer -/mlir/lib/Interfaces/SubsetOpInterface.* @matthias-springer -/mlir/**/SubsetOpInterfaceImpl.* @matthias-springer -/mlir/include/mlir/Interfaces/DestinationStyleOpInterface.* @matthias-springer -/mlir/lib/Interfaces/DestinationStyleOpInterface.* @matthias-springer - -# Bufferization Dialect in MLIR. -/mlir/include/mlir/Dialect/Bufferization @matthias-springer -/mlir/lib/Dialect/Bufferization @matthias-springer -/mlir/**/BufferizableOpInterfaceImpl.* @matthias-springer -/mlir/Dialect/*/Transforms/Bufferize.cpp @matthias-springer - -# Linalg Dialect in MLIR. -/mlir/include/mlir/Dialect/Linalg @dcaballe @nicolasvasilache @rengolin -/mlir/lib/Dialect/Linalg @dcaballe @nicolasvasilache @rengolin -/mlir/lib/Dialect/Linalg/Transforms/DecomposeLinalgOps.cpp @MaheshRavishankar @nicolasvasilache -/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp @dcaballe @MaheshRavishankar @nicolasvasilache -/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp @MaheshRavishankar @nicolasvasilache -/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp @hanhanW @nicolasvasilache -/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp @dcaballe @hanhanW @nicolasvasilache -/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp @banach-space @dcaballe @hanhanW @nicolasvasilache - -# MemRef Dialect in MLIR. -/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp @MaheshRavishankar @nicolasvasilache - -# Vector Dialect in MLIR. -/mlir/**/*AMX* @aartbik @dcaballe -/mlir/**/*Neon* @banach-space @dcaballe @nicolasvasilache -/mlir/**/*SME* @banach-space @dcaballe @nicolasvasilache -/mlir/**/*SVE* @banach-space @dcaballe @nicolasvasilache -/mlir/**/*VectorInterfaces* @dcaballe @nicolasvasilache -/mlir/**/*VectorToSCF* @banach-space @dcaballe @matthias-springer @nicolasvasilache -/mlir/**/*VectorToLLVM* @banach-space @dcaballe @nicolasvasilache -/mlir/**/*X86Vector* @aartbik @dcaballe @nicolasvasilache -/mlir/include/mlir/Dialect/Vector @banach-space @dcaballe @nicolasvasilache -/mlir/include/mlir/Dialect/Vector/IR @kuhar -/mlir/lib/Dialect/Vector @banach-space @dcaballe @nicolasvasilache -/mlir/lib/Dialect/Vector/Transforms/* @banach-space @dcaballe @hanhanW @nicolasvasilache -/mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp @banach-space @dcaballe @MaheshRavishankar @nicolasvasilache -/mlir/**/*EmulateNarrowType* @dcaballe @hanhanW - -# Presburger library in MLIR -/mlir/**/*Presburger* @Groverkss @Superty - -# Tensor Dialect in MLIR. -/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp @hanhanW @nicolasvasilache -/mlir/lib/Dialect/Tensor/Transforms/* @hanhanW @nicolasvasilache - -# Transform Dialect in MLIR. -/mlir/include/mlir/Dialect/Transform/* @ftynse @nicolasvasilache -/mlir/lib/Dialect/Transform/* @ftynse @nicolasvasilache -/mlir/**/*TransformOps* @ftynse @nicolasvasilache - -# SPIR-V Dialect in MLIR. -/mlir/**/SPIRV/ @antiagainst @kuhar -/mlir/**/SPIRVTo*/ @antiagainst @kuhar -/mlir/**/*ToSPIRV/ @antiagainst @kuhar -/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp @antiagainst @kuhar - -# MLIR Sparsifier. -/mlir/**/*SparseTensor*/ @aartbik @PeimingLiu @yinying-lisa-li @matthias-springer - -# MLIR NVGPU Dialect -/mlir/**/NVGPU*/ @grypp -/mlir/test/**/CUDA/ @grypp - -# MLIR NVVM Dialect in MLIR -/mlir/**/LLVMIR/**/BasicPtxBuilderInterface* @grypp -/mlir/**/NVVM* @grypp - -# MLIR Index Dialect -/mlir/**/Index* @mogball - -# MLIR Python Bindings -/mlir/test/python/ @ftynse @makslevental @stellaraccident -/mlir/python/ @ftynse @makslevental @stellaraccident - -# MLIR Mem2Reg/SROA -/mlir/**/Transforms/Mem2Reg.* @moxinilian -/mlir/**/Transforms/SROA.* @moxinilian - -# BOLT -/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @dcci - -# Bazel build system. -/utils/bazel/ @rupprecht @keith - -# InstallAPI and TextAPI -/llvm/**/TextAPI/ @cyndyishida -/clang/**/InstallAPI/ @cyndyishida -/clang/tools/clang-installapi/ @cyndyishida - -# ExtractAPI -/clang/**/ExtractAPI @daniel-grumberg - -# DWARFLinker, dwarfutil, dsymutil -/llvm/**/DWARFLinker/ @JDevlieghere -/llvm/**/dsymutil/ @JDevlieghere -/llvm/**/llvm-dwarfutil/ @JDevlieghere +* @intel/npu-plugin-llvm-maintain diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000000..355ebf0ad697 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,15 @@ +## Summary +> Please add a short but exhaustive summary why you think your pull request is useful + +## JIRA ticket + +* E-xxxxx + +## Related PR in NPU Compiler and/or OpenVINO repository with sub-module update + +* PR-xxx + +### Other related tickets +> List tickets for additional work, eg, something was found during review but you agreed to address it in another Jira + +* E-xxxxx diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8c1dfd39b82c..028c0b2b74eb 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -16,3 +16,48 @@ updates: llvm-docs-requirements: patterns: - "*" + + - package-ecosystem: docker + directory: /.github/workflows/containers/github-action-ci + schedule: + interval: daily + + - package-ecosystem: docker + directory: /bolt/utils/docker + schedule: + interval: daily + + - package-ecosystem: nuget + directory: /clang/tools/clang-format-vs/ClangFormat + schedule: + interval: daily + + - package-ecosystem: docker + directory: /clang/tools/clang-fuzzer + schedule: + interval: daily + + - package-ecosystem: docker + directory: /clang/utils/analyzer + schedule: + interval: daily + + - package-ecosystem: pip + directory: /clang/utils/analyzer + schedule: + interval: daily + + - package-ecosystem: pip + directory: /flang/examples/FlangOmpReport + schedule: + interval: daily + + - package-ecosystem: docker + directory: /libc/utils/buildbot + schedule: + interval: daily + + - package-ecosystem: docker + directory: /libcxx/utils/ci + schedule: + interval: daily diff --git a/.github/new-issues-labeler.yml b/.github/new-issues-labeler.yml deleted file mode 100644 index a5933d7fc9b3..000000000000 --- a/.github/new-issues-labeler.yml +++ /dev/null @@ -1,29 +0,0 @@ -'clang': - - '/\bclang(?!\-)\b/i' - -'clang-format': - - '/\bclang-format/i' - -'clang-tidy': - - '/\bclang-tidy/i' - -'libc++': - - '/libc[+x]{2}(?!\-)/i' - -'libc++abi': - - '/libc[+x]{2}-?abi/i' - -'libc': - - '/\blibc(?![-+])\b/i' - -'flang': - - '/\bflang(?!\-)\b/i' - -'lld': - - '/\blld(?!\-)\b/i' - -'mlir': - - '/\bmlir(?!\-)\b/i' - -'bolt': - - '/\bbolt(?!\-)\b/i' diff --git a/.github/new-prs-labeler.yml b/.github/new-prs-labeler.yml deleted file mode 100644 index f79d1a9d2458..000000000000 --- a/.github/new-prs-labeler.yml +++ /dev/null @@ -1,1003 +0,0 @@ -BOLT: - - bolt/**/* - -ClangIR: - - clang/include/clang/CIR/**/* - - clang/lib/CIR/**/* - - clang/tools/cir-*/**/* - - clang/test/CIR/**/* - -clang:dataflow: - - clang/include/clang/Analysis/FlowSensitive/**/* - - clang/lib/Analysis/FlowSensitive/**/* - - clang/unittests/Analysis/FlowSensitive/**/* - - clang/docs/DataFlowAnalysisIntro.md - - clang/docs/DataFlowAnalysisIntroImages/**/* - -clang:frontend: - - clang/lib/AST/**/* - - clang/include/clang/AST/**/* - - clang/lib/Basic/**/* - - clang/include/clang/Basic/**/* - - clang/lib/Interpreter/**/* - - clang/include/clang/Interpreter/**/* - - clang/lib/Lex/**/* - - clang/include/clang/Lex/**/* - - clang/lib/Parse/**/* - - clang/include/clang/Parse/**/* - - clang/lib/Sema/**/* - - clang/include/clang/Sema/**/* - -clang:headers: - - clang/lib/Headers/**/* - -compiler-rt: - - compiler-rt/**/* - -flang: - - flang/**/* - -flang:frontend: - - flang/Parser/**/* - - flang/Evaluate/**/* - - flang/Semantics/**/* - -HLSL: - - clang/*HLSL*/**/* - - clang/**/*HLSL* - - llvm/**/Frontend/HLSL/**/* - -lld: - - lld/**/* - -llvm-lit: - - llvm/utils/lit/**/* - -PGO: - - llvm/**/ProfileData/**/* - - llvm/**/SampleProfile* - - llvm/**/CodeGen/MIRSampleProfile* - - llvm/lib/Transforms/Instrumentation/CGProfile.cpp - - llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp - - llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp - - llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp - - llvm/lib/Transforms/Instrumentation/PGO* - - llvm/lib/Transforms/Instrumentation/ValueProfile* - - llvm/test/Instrumentation/InstrProfiling/**/* - - llvm/test/Transforms/PGOProfile/**/* - - llvm/test/Transforms/SampleProfile/**/* - - llvm/**/llvm-profdata/**/* - - llvm/**/llvm-profgen/**/* - -vectorization: - - llvm/lib/Transforms/Vectorize/**/* - - llvm/include/llvm/Transforms/Vectorize/**/* - -# IMPORTED FROM CODEOWNERS -LTO: - - llvm/*/LTO/** - - llvm/*/Linker/** - - llvm/*/ThinLTO/** - - llvm/lib/Transforms/*/FunctionImport* - - llvm/tools/gold/** - -mc: - - llvm/*/MC/** - -clang:driver: - - clang/*/Driver/** - -compiler-rt:asan: - - compiler-rt/lib/asan/** - - compiler-rt/include/sanitizer/asan_interface.h - - compiler-rt/test/asan/** - - compiler-rt/lib/asan_abi/** - - compiler-rt/test/asan_abi/** - -compiler-rt:builtins: - - compiler-rt/lib/builtins/** - - compiler-rt/test/builtins/** - -compiler-rt:cfi: - - compiler-rt/lib/cfi/** - - compiler-rt/test/cfi/** - -compiler-rt:fuzzer: - - compiler-rt/lib/fuzzer/** - - compiler-rt/include/fuzzer/** - - compiler-rt/test/fuzzer/** - -compiler-rt:hwasan: - - compiler-rt/lib/hwasan/** - - compiler-rt/include/sanitizer/hwasan_interface.h - - compiler-rt/test/hwasan/** - -compiler-rt:lsan: - - compiler-rt/lib/lsan/** - - compiler-rt/include/sanitizer/lsan_interface.h - - compiler-rt/test/lsan/** - -compiler-rt:msan: - - compiler-rt/lib/msan/** - - compiler-rt/include/sanitizer/msan_interface.h - - compiler-rt/test/msan/** - -compiler-rt:sanitizer: - - llvm/lib/Transforms/Instrumentation/*Sanitizer* - - compiler-rt/lib/interception/** - - compiler-rt/lib/*san*/** - - compiler-rt/include/sanitizer/** - - compiler-rt/test/*san*/** - - compiler-rt/lib/fuzzer/** - - compiler-rt/include/fuzzer/** - - compiler-rt/test/fuzzer/** - - compiler-rt/lib/scudo/** - - compiler-rt/test/scudo/** - -compiler-rt:scudo: - - compiler-rt/lib/scudo/** - - compiler-rt/test/scudo/** - -compiler-rt:tsan: - - compiler-rt/lib/tsan/** - - compiler-rt/include/sanitizer/tsan_interface.h - - compiler-rt/include/sanitizer/tsan_interface_atomic.h - - compiler-rt/test/tsan/** - -compiler-rt:ubsan: - - compiler-rt/lib/ubsan/** - - compiler-rt/include/sanitizer/ubsan_interface.h - - compiler-rt/test/ubsan/** - - compiler-rt/lib/ubsan_minimal/** - - compiler-rt/test/ubsan_minimal/** - -xray: - - llvm/tools/llvm-xray/** - - compiler-rt/*/xray/** - - clang/include/clang/Basic/XRay* - - clang/lib/Basic/XRay* - - compiler-rt/*/xray/** - - llvm/include/llvm/XRay/** - - llvm/lib/XRay/** - - llvm/tools/llvm-xray/** - - llvm/unittests/XRay/** - - compiler-rt/*/xray/** - -clang:codegen: - - clang/lib/CodeGen/** - - clang/include/clang/CodeGen/** - -mlir: - - mlir/** - -mlir:core: - - mlir/include/mlir/Support/** - - mlir/lib/Support/** - - mlir/include/mlir/Parser/** - - mlir/lib/Parser/** - - mlir/include/mlir/IR/** - - mlir/lib/IR/** - - mlir/include/mlir/Bytecode/** - - mlir/lib/Bytecode/** - - mlir/include/mlir/AsmParser/** - - mlir/lib/AsmParser/** - - mlir/include/mlir/Pass/** - - mlir/lib/Pass/** - - mlir/include/mlir/Tools/** - - mlir/lib/Tools/** - - mlir/include/mlir/Reducer/** - - mlir/lib/Reducer/** - - mlir/include/mlir/Transforms/** - - mlir/lib/Transforms/** - - mlir/include/mlir/Debug/** - - mlir/lib/Debug/** - - mlir/tools/** - -mlir:ods: - - mlir/TableGen/** - - mlir/tblgen/** - - mlir/include/mlir/IR/*.td - -mlir:bindings: - - mlir/Bindings/** - -mlir:gpu: - - mlir/**/*GPU*/** - -mlir:amdgpu: - - mlir/**/AMDGPU/** - -mlir:amx: - - mlir/**/AMX/** - -mlir:affine: - - mlir/**/Affine/** - -mlir:arith: - - mlir/**/Arith/** - -mlir:neon: - - mlir/**/ArmNeon/** - -mlir:sme: - - mlir/**/ArmSME/** - -mlir:sve: - - mlir/**/ArmSVE/** - -mlir:async: - - mlir/**/Async/** - - mlir/**/Async/** - -mlir:bufferization: - - mlir/**/Bufferization/** - -mlir:complex: - - mlir/**/Complex/** - -mlir:cf: - - mlir/**/ControlFlow/** - -mlir:dlti: - - mlir/**/DLTI/** - -mlir:emitc: - - mlir/**/*EmitC*/** - - mlir/lib/Target/Cpp/** - -mlir:func: - - mlir/**/Func/** - -mlir:irdl: - - mlir/**/IRDL/** - -mlir:index: - - mlir/**/Index/** - -mlir:llvm: - - mlir/**/LLVM* - - mlir/**/LLVM*/** - -mlir:linalg: - - mlir/**/*linalg/** - - mlir/**/*Linalg/** - -mlir:mlprogram: - - mlir/**/MLProgram/** - -mlir:math: - - mlir/**/Math/** - -mlir:memref: - - mlir/**/MemRef/** - -mlir:nvgpu: - - mlir/**/NVGPU/** - -mlir:openacc: - - mlir/**/*OpenACC* - - mlir/**/*OpenACC*/** - -mlir:openmp: - - mlir/**/*OpenMP* - - mlir/**/*OpenMP*/** - -mlir:pdl: - - mlir/**/PDL/** - -mlir:quant: - - mlir/**/Quant/** - -mlir:scf: - - mlir/**/SCF/** - -mlir:spirv: - - mlir/**/SPIRV/** - - mlir/**/SPIRVTo*/** - - mlir/**/*ToSPIRV/** - - mlir/tools/mlir-spirv-cpu-runner/** - - mlir/tools/mlir-vulkan-runner/** - - mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp - -mlir:shape: - - mlir/**/Shape/** - -mlir:sparse: - - mlir/**/SparseTensor/** - -mlir:tensor: - - mlir/**/Tensor/** - -mlir:tosa: - - mlir/**/*Tosa*/** - -mlir:ub: - - mlir/**/UB/** - -mlir:vector: - - mlir/**/*Vector/** - -mlir:execution-engine: - - mlir/**/ExecutionEngine/** - -mlir:presburger: - - mlir/**/*Presburger*/** - -mlir:python: - - mlir/python/**/* - -mlir:vectorops: - - mlir/**/Vector/**/* - -coroutines: - - clang/docs/DebuggingCoroutines.rst - - clang/lib/Sema/SemaCoroutine.cpp - - clang/lib/CodeGen/CGCoroutine.cpp - - clang/test/CodeGenCoroutines/** - - llvm/docs/Coroutines.rst - - llvm/include/llvm/Transforms/Coroutines/** - - llvm/lib/Transforms/Coroutines/** - - llvm/test/Transforms/Coroutines/* - -clang:modules: - - clang/docs/StandardCPlusPlusModules.rst - - clang/include/clang/AST/AbstractBasicReader.h - - clang/include/clang/AST/AbstractBasicWriter.h - - clang/include/clang/AST/AbstractTypeReader.h - - clang/include/clang/AST/AbstractTypeWriter.h - - clang/include/clang/AST/PropertiesBase.td - - clang/include/clang/AST/ODRHash.h - - clang/include/clang/AST/TypeProperties.td - - clang/include/clang/Basic/Module.h - - clang/include/clang/Frontend/PrecompiledPreamble.h - - clang/include/clang/Lex/ModuleLoader.h - - clang/include/clang/Lex/ModuleMap.h - - clang/include/clang/Serialization/** - - clang/lib/AST/ODRHash.cpp - - clang/lib/AST/StmtProfile.cpp - - clang/lib/Basic/Module.cpp - - clang/lib/Frontend/ModuleDependencyCollector.cpp - - clang/lib/Frontend/PrecompiledPreamble.cpp - - clang/lib/Lex/ModuleMap.cpp - - clang/lib/Sema/SemaModule.cpp - - clang/lib/Serialization/** - - clang/test/CXX/module/** - - clang/test/Modules/** - - clang/unittests/Serialization/* - -clang-tidy: - - clang-tools-extra/clang-tidy/** - - clang-tools-extra/docs/clang-tidy/** - - clang-tools-extra/test/clang-tidy/** - -clang-tools-extra: - - clang-tools-extra/** - -tools:llvm-mca: - - llvm/tools/llvm-mca/** - - llvm/include/llvm/MCA/** - - llvm/lib/MCA/** - -clang: - - any: - - clang/** - - '!clang/**/Format/**' - - '!clang/tools/clang-format/**' - -testing-tools: - - llvm/include/llvm/FileCheck/** - - llvm/lib/FileCheck/** - - llvm/test/FileCheck/** - - llvm/unittests/FileCheck/** - - llvm/utils/lit/** - - llvm/utils/split-file/** - - llvm/utils/not/** - - llvm/utils/count/** - - llvm/utils/FileCheck/** - - llvm/docs/CommandGuide/FileCheck.rst - - llvm/docs/CommandGuide/lit.rst - - llvm/docs/TestingGuide.rst - - llvm/test/Other/FileCheck-space.txt - - llvm/utils/UpdateTestChecks/** - - llvm/utils/update*_test_checks.py - -debuginfo: - - clang/lib/CodeGen/CGDebugInfo.* - - llvm/include/llvm/BinaryFormat/Dwarf.* - - llvm/include/llvm/CodeGen/*Debug*.* - - llvm/include/llvm/DebugInfo/** - - llvm/include/llvm/Debuginfod/** - - llvm/include/llvm/Frontend/Debug/** - - llvm/include/llvm/IR/Debug*.* - - llvm/include/llvm/Object/*Debug*.* - - llvm/include/llvm/ObjectYAML/*Debug*.* - - llvm/include/llvm/Transforms/Utils/*Debug*.* - - llvm/include/llvm-c/DebugInfo.h - - llvm/lib/BinaryFormat/Dwarf.cpp - - llvm/lib/CodeGen/AsmPrinter/*Debug*.* - - llvm/lib/CodeGen/AsmPrinter/Dwarf*.* - - llvm/lib/CodeGen/AsmPrinter/DIE*.* - - llvm/lib/CodeGen/LiveDebugValues/** - - llvm/lib/CodeGen/*Debug*.* - - llvm/lib/CodeGen/DwarfEHPrepare.cpp - - llvm/lib/DebugInfo/** - - llvm/lib/Debuginfod/** - - llvm/lib/DWARFLinkerParallel/** - - llvm/lib/IR/Debug*.cpp - - llvm/lib/MC/MCDwarf.cpp - - llvm/lib/Transforms/Utils/*Debug*.* - - llvm/test/DebugInfo/** - - llvm/test/tools/dsymutil/** - - llvm/test/tools/llvm-debuginfo-analyzer/** - - llvm/test/tools/llvm-debuginfod/** - - llvm/test/tools/llvm-debuginfod-find/** - - llvm/test/tools/llvm-dwarfdump/** - - llvm/test/tools/llvm-dwarfutil/** - - llvm/test/tools/llvm-dwp/** - - llvm/test/tools/llvm-gsymutil/** - - llvm/test/tools/llvm-pdbuti/** - - llvm/tools/dsymutil/** - - llvm/tools/llvm-debuginfo-analyzer/** - - llvm/tools/llvm-debuginfod/** - - llvm/tools/llvm-debuginfod-find/** - - llvm/tools/llvm-dwarfdump/** - - llvm/tools/llvm-dwarfutil/** - - llvm/tools/llvm-dwp/** - - llvm/tools/llvm-gsymutil/** - - llvm/tools/llvm-pdbutil/** - -github:workflow: - - .github/workflows/** - -cmake: - - cmake/** - - llvm/cmake/** - - runtimes/** - -flang:driver: - - flang/tools/flang-driver/** - - flang/unittests/Frontend/** - - flang/lib/FrontendTool/** - - flang/lib/Frontend/** - - flang/include/flang/Frontend/** - - flang/include/flang/FrontendTool/** - - flang/test/Driver/** - -backend:m68k: - - llvm/lib/Target/M68k/** - - clang/lib/Basic/Targets/M68k.* - - clang/lib/CodeGen/Targets/M68k.cpp - - llvm/test/CodeGen/M68k/** - - llvm/test/MC/Disassembler/M68k/** - - llvm/test/MC/M68k/** - -libc++: - - libcxx/** - - .github/workflows/libcxx-* - -libc++abi: - - libcxxabi/** - -libunwind: - - libunwind/** - -objectyaml: - - llvm/include/llvm/ObjectYAML/** - - llvm/lib/ObjectYAML/** - - llvm/test/tools/obj2yaml/** - - llvm/test/tools/yaml2obj/** - - llvm/tools/obj2yaml/** - - llvm/tools/yaml2obj/** - -clang:analysis: - - clang/include/clang/Analysis/** - - clang/lib/Analysis/** - -clang:static analyzer: - - clang/include/clang/StaticAnalyzer/** - - clang/lib/StaticAnalyzer/** - - clang/tools/scan-build/** - - clang/utils/analyzer/** - - clang/docs/analyzer/** - -pgo: - - llvm/lib/Transforms/Instrumentation/CGProfile.cpp - - llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp - - llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp - - llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp - - llvm/lib/Transforms/Instrumentation/PGO* - - llvm/lib/Transforms/Instrumentation/ValueProfile* - - llvm/test/Instrumentation/InstrProfiling/** - - llvm/test/Transforms/PGOProfile/** - - compiler-rt/lib/profile/** - - compiler-rt/lib/memprof/** - - compiler-rt/test/profile/** - - compiler-rt/test/memprof/** - - llvm/tools/llvm-profdata/** - - llvm/tools/llvm-profgen/** - - llvm/test/tools/llvm-profdata/** - - llvm/test/tools/llvm-profgen/** - - llvm/unittests/ProfileData/* - -openacc: - - flang/**/OpenACC/** - - flang/include/flang/Lower/OpenACC.h - - flang/docs/OpenACC.md - - flang/lib/Parser/openacc-parsers.cpp - - flang/lib/Lower/OpenACC.cpp - - llvm/**/Frontend/OpenACC/** - - llvm/unittests/Frontend/OpenACCTest.cpp - - mlir/test/Target/LLVMIR/openacc-llvm.mlir - - mlir/**/*OpenACC/** - -flang:runtime: - - flang/runtime/** - -flang:parser: - - flang/**/Parser/** - -flang:semantics: - - flang/**/Evaluate/** - - flang/**/Semantics/** - -flang:fir-hlfir: - - flang/**/Lower/** - - flang/**/Optimizer/** - -flang:codegen: - - flang/**/CodeGen/** - -llvm:globalisel: - - llvm/**/GlobalISel/** - - llvm/utils/TableGen/GlobalISel* - -function-specialization: - - llvm/include/llvm/Transforms/Utils/SCCPSolver.h - - llvm/lib/Transforms/Utils/SCCPSolver.cpp - - llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h - - llvm/lib/Transforms/IPO/FunctionSpecialization.cpp - - llvm/test/Transforms/FunctionSpecialization/* - -libc: - - libc/** - - utils/bazel/llvm-project-overlay/libc/** - -clang-format: - - clang/**/Format/** - - clang/tools/clang-format/** - -flang:openmp: - - flang/test/**/OpenMP/** - - flang/lib/Lower/OpenMP.cpp - - flang/lib/Semantics/resolve-directives.cpp - - flang/lib/Semantics/check-omp-structure.cpp - - flang/lib/Optimizer/Transforms/OMP* - - flang/test/Fir/convert-to-llvm-openmp-and-fir.fir - - flang/test/Lower/OpenMP/** - - flang/test/Transforms/omp* - - mlir/**/*OpenMP* - - mlir/test/Target/LLVMIR/openmp* - - llvm/lib/Frontend/OpenMP/** - - llvm/include/llvm/Frontend/OpenMP/** - - llvm/unittests/Frontend/OpenMP* - -llvm:ir: - - llvm/lib/IR/** - - llvm/include/llvm/IR/** - - llvm/docs/LangRef.rst - - llvm/unittests/IR/** - -llvm:analysis: - - llvm/lib/Analysis/** - - llvm/include/llvm/Analysis/** - - llvm/test/Analysis/** - - llvm/unittests/Analysis/** - -llvm:adt: - - llvm/**/ADT/* - -llvm:support: - - llvm/**/Support/** - -llvm:transforms: - - llvm/lib/Transforms/** - - llvm/include/llvm/Transforms/** - - llvm/test/Transforms/** - - llvm/unittests/Transforms/** - -clangd: - - clang-tools-extra/clangd/** - -hlsl: - - clang/test/ParserHLSL/** - - clang/test/SemaHLSL/** - - clang/test/AST/HLSL/** - - clang/test/CodeGenHLSL/** - - clang/cmake/caches/HLSL.cmake - - clang/include/clang/Basic/HLSL*.h - - clang/include/clang/Sema/HLSL*.h - - clang/docs/HLSL/** - - clang/lib/Driver/ToolChains/HLSL* - - clang/lib/Parse/ParseHLSL.cpp - - clang/lib/Sema/HLSLExternalSemaSource.cpp - - clang/lib/Sema/SemaHLSL.cpp - - clang/lib/CodeGen/CGHLSLRuntime.* - - llvm/include/llvm/Frontend/HLSL/** - - llvm/lib/Frontend/HLSL/** - -llvm:SelectionDAG: - - llvm/include/llvm/CodeGen/SelectionDAG*.h - - llvm/include/llvm/CodeGen/SDNodeProperties.td - - llvm/include/llvm/Target/TargetSelectionDAG.td - - llvm/lib/CodeGen/SelectionDAG/** - - llvm/utils/TableGen/CodeGenDAG* - - llvm/utils/TableGen/DAGISel* - - llvm/include/llvm/CodeGen/DAGCombine.h - - llvm/include/llvm/CodeGen/ISDOpcodes.h - -backend:DirectX: - - '**/*DirectX*' - - '**/*DXIL*' - - '**/*dxil*' - - '**/*DirectX*/**' - - '**/*DXIL*/**' - - '**/*dxil*/**' - - '**/*DXContainer*' - - '**/*DXContainer*/**' - -backend:SPIR-V: - - clang/lib/Driver/ToolChains/SPIRV.* - - llvm/lib/Target/SPIRV/** - - llvm/test/CodeGen/SPIRV/** - - llvm/test/Frontend/HLSL/** - - llvm/docs/SPIRVUsage.rst - -mlgo: - - llvm/lib/Analysis/ML* - - llvm/include/llvm/Analysis/ML* - - llvm/lib/Analysis/*Runner.cpp - - llvm/include/llvm/Analysis/*Runner.h - - llvm/unittests/Analysis/ML* - - llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp - - llvm/lib/Analysis/TrainingLogger.cpp - - llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h - - llvm/include/llvm/Analysis/Utils/TrainingLogger.h - - llvm/test/Analysis/FunctionPropertiesAnalysis/* - - llvm/unittests/Analysis/FunctionPropertiesAnalysisTest.cpp - - llvm/test/Transforms/inline/ML/** - - llvm/lib/CodeGen/ML* - - llvm/unittests/CodeGen/ML* - - llvm/test/CodeGen/MLRegAlloc/** - - llvm/utils/mlgo-utils/* - -tools:llvm-exegesis: - - llvm/tools/llvm-exegesis/** - - llvm/test/tools/llvm-exegesis/** - - llvm/unittests/tools/llvm-exegesis/** - -platform:windows: - - lld/COFF/** - - clang/lib/Driver/MSVC.cpp - - clang/lib/Driver/MinGW.cpp - - llvm/lib/DebugInfo/CodeView/** - - llvm/lib/DebugInfo/PDB/** - - llvm/lib/WindowsDriver/** - - llvm/lib/Support/Windows/** - - llvm/lib/BinaryFormat/COFF.cpp - -llvm:regalloc: - - llvm/**/CodeGen/CalcSpillWeights* - - llvm/**/CodeGen/InlineSpiller* - - llvm/**/CodeGen/InterferenceCache* - - llvm/**/CodeGen/LiveInterval* - - llvm/**/CodeGen/LiveRange* - - llvm/**/CodeGen/LiveReg* - - llvm/**/CodeGen/LiveVariables* - - llvm/**/CodeGen/MachineCopyPropagation* - - llvm/**/CodeGen/PHIElimination* - - llvm/**/CodeGen/ProcessImplicitDefs.cpp - - llvm/**/CodeGen/Register* - - llvm/**/CodeGen/RegUsage* - - llvm/**/CodeGen/RenameIndependentSubregs.cpp - - llvm/**/CodeGen/SlotIndexes.h - - llvm/**/CodeGen/SpillPlacement* - - llvm/**/CodeGen/SplitKit* - - llvm/**/CodeGen/VirtRegMap.h - - llvm/include/PBQP/** - - llvm/include/PBQPRAConstraint.h - - llvm/include/llvm/CodeGen/Spiller.h - - llvm/**/*RegAlloc - -lldb: - - lldb/** - -backend:AMDGPU: - - '**/*amdgpu*' - - '**/*AMDGPU*' - - '**/*amdgpu*/**' - - '**/*AMDGPU*/**' - -backend:NVPTX: - - 'llvm/**/*nvvm*' - - 'llvm/**/*NVVM*' - - 'llvm/**/*nvptx*' - - 'llvm/**/*NVPTX*' - - 'llvm/**/*nvvm*/**' - - 'llvm/**/*NVVM*/**' - - 'llvm/**/*nvptx*/**' - - 'llvm/**/*NVPTX*/**' - -backend:RISC-V: - - clang/**/*riscv* - - clang/**/*RISCV* - - llvm/**/*riscv* - - llvm/**/*RISCV* - -lld:coff: - - lld/**/COFF/** - - lld/Common/** - -lld:elf: - - lld/**/ELF/** - - lld/Common/** - -lld:macho: - - lld/**/MachO/** - - lld/Common/** - -lld:wasm: - - lld/**/wasm/** - - lld/Common/** - -backend:ARM: - - llvm/include/llvm/IR/IntrinsicsARM.td - - llvm/test/MC/ARM/** - - llvm/lib/Target/ARM/** - - llvm/test/CodeGen/ARM/** - - clang/lib/Basic/Targets/ARM* - - clang/lib/Driver/ToolChains/Arch/ARM.* - - clang/lib/CodeGen/Targets/ARM.cpp - - clang/include/clang/Basic/BuiltinsARM* - - llvm/test/MC/DisasemblerARM/** - - clang/include/clang/Sema/SemaARM.h - - clang/lib/Sema/SemaARM.cpp - -backend:AArch64: - - llvm/include/llvm/IR/IntrinsicsAArch64.td - - llvm/test/MC/AArch64/** - - llvm/lib/Target/AArch64/** - - llvm/test/CodeGen/AArch64/** - - clang/lib/Basic/Targets/AArch64* - - clang/lib/Driver/ToolChains/Arch/AArch64.* - - clang/lib/CodeGen/Targets/AArch64.cpp - - clang/include/clang/Basic/BuiltinsAArch64* - - llvm/test/MC/Disassembler/AArch64/** - - clang/include/clang/Sema/SemaARM.h - - clang/lib/Sema/SemaARM.cpp - -backend:Hexagon: - - clang/include/clang/Basic/BuiltinsHexagon*.def - - clang/include/clang/Sema/SemaHexagon.h - - clang/lib/Basic/Targets/Hexagon.* - - clang/lib/CodeGen/Targets/Hexagon.cpp - - clang/lib/Driver/ToolChains/Hexagon.* - - clang/lib/Sema/SemaHexagon.cpp - - lld/ELF/Arch/Hexagon.cpp - - lldb/source/Plugins/ABI/Hexagon/** - - lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/** - - llvm/include/llvm/BinaryFormat/ELFRelocs/Hexagon.def - - llvm/include/llvm/IR/IntrinsicsHexagon* - - llvm/include/llvm/Support/Hexagon* - - llvm/lib/Support/Hexagon* - - llvm/lib/Target/Hexagon/** - - llvm/test/CodeGen/Hexagon/** - - llvm/test/CodeGen/*/Hexagon/** - - llvm/test/DebugInfo/*/Hexagon/** - - llvm/test/Transforms/*/Hexagon - - llvm/test/MC/Disassembler/Hexagon/** - - llvm/test/MC/Hexagon/** - - llvm/test/tools/llvm-objdump/ELF/Hexagon/** - -backend:loongarch: - - llvm/include/llvm/IR/IntrinsicsLoongArch.td - - llvm/test/MC/LoongArch/** - - llvm/lib/Target/LoongArch/** - - llvm/test/CodeGen/LoongArch/** - - clang/lib/Basic/Targets/LoongArch* - - clang/lib/Driver/ToolChains/Arch/LoongArch.* - - clang/lib/CodeGen/Targets/LoongArch.cpp - - clang/include/clang/Basic/BuiltinsLoongArch* - - clang/include/clang/Sema/SemaLoongArch.h - - clang/lib/Sema/SemaLoongArch.cpp - -backend:MSP430: - - llvm/include/llvm/IR/IntrinsicsMSP430.td - - llvm/test/MC/MSP430/** - - llvm/lib/Target/MSP430/** - - llvm/test/CodeGen/MSP430/** - - clang/lib/Basic/Targets/MSP430* - - clang/lib/Driver/ToolChains/Arch/MSP430.* - - clang/lib/CodeGen/Targets/MSP430.cpp - - clang/include/clang/Basic/BuiltinsMSP430* - - llvm/test/MC/Disassembler/MSP430/** - -backend:Sparc: - - llvm/include/llvm/IR/IntrinsicsSparc.td - - llvm/test/MC/Sparc/** - - llvm/lib/Target/Sparc/** - - llvm/test/CodeGen/Sparc/** - - clang/lib/Basic/Targets/Sparc* - - clang/lib/Driver/ToolChains/Arch/Sparc.* - - clang/lib/CodeGen/Targets/Sparc.cpp - - clang/include/clang/Basic/BuiltinsSparc* - - llvm/test/MC/Disassembler/Sparc/** - -backend:WebAssembly: - - llvm/lib/Target/WebAssembly/** - - llvm/test/CodeGen/WebAssembly/** - - clang/lib/Basic/Targets/WebAssembly* - - clang/include/clang/Basic/BuiltinsWebAssembly.def - - clang/include/clang/Basic/WebAssemblyReferenceTypes.def - - clang/lib/CodeGen/Targets/WebAssembly* - - llvm/include/llvm/IR/IntinsicsWebAssembly.td - - llvm/include/llvm/Object/Wasm* - - llvm/lib/CodeGen/AsmPrinter/Wasm* - - llvm/lib/CodeGen/Wasm* - - llvm/lib/MC/MCParser/Wasm* - - llvm/lib/MC/Wasm* - - llvm/lib/ObjCopy/wasm/** - - llvm/lib/Object/Wasm* - - clang/lib/Driver/Toolchains/WebAssembly* - - clang/lib/Headers/wasm_simd128.h - - clang/test/CodeGen/WebAssembly/** - - clang/test/SemaCXX/*wasm* - - clang/test/Sema/*wasm* - - llvm/include/llvm/BinaryFormat/Wasm.h - - llvm/unittests/Target/WebAssembly/** - - llvm/test/DebugInfo/WebAssembly/** - - llvm/test/MC/WebAssembly/** - - clang/include/clang/Sema/SemaWasm.h - - clang/lib/Sema/SemaLoongWasm.cpp - -backend:X86: - - llvm/include/llvm/IR/IntrinsicsX86.td - - llvm/lib/Target/X86/** - - llvm/test/CodeGen/X86/** - - llvm/test/MC/X86/** - - llvm/test/MC/Disassembler/X86/** - - llvm/test/Analysis/CostModel/X86/** - - llvm/test/tools/llvm-mca/X86/** - - clang/lib/Basic/Targets/X86/** - - clang/lib/Driver/ToolChains/Arch/X86.* - - clang/lib/CodeGen/Targets/X86.* - - clang/lib/Headers/** - - clang/test/CodeGen/X86/** - - clang/include/clang/Basic/BuiltinsX86* - - llvm/include/llvm/Support/X86DisassemblerDecoderCommon.h - - llvm/include/llvm/TargetParser/X86* - - llvm/lib/TargetParser/X86* - - llvm/utils/TableGen/X86* - - clang/include/clang/Sema/SemaX86.h - - clang/lib/Sema/SemaX86.cpp - -backend:PowerPC: - - llvm/include/llvm/BinaryFormat/ELFRelocs/PowerPC* - - llvm/include/llvm/BinaryFormat/XCOFF.h - - llvm/include/llvm/IR/IntrinsicsPowerPC.td - - llvm/lib/CodeGen/AsmPrinter/AIXException.cpp - - llvm/lib/Target/PowerPC/** - - llvm/test/Analysis/**/PowerPC/** - - llvm/test/CodeGen/PowerPC/** - - llvm/test/CodeGen/MIR/PowerPC/** - - llvm/test/DebugInfo/XCOFF/** - - llvm/test/DebugInfo/PowerPC/** - - llvm/test/LTO/PowerPC/** - - llvm/test/MC/Disassembler/PowerPC/** - - llvm/test/MC/PowerPC/** - - llvm/test/MC/XCOFF/** - - llvm/test/Transforms/**/PowerPC/** - - clang/include/clang/Basic/BuiltinsPPC.* - - clang/lib/Basic/Targets/PPC.* - - clang/lib/CodeGen/Targets/PPC.cpp - - clang/lib/Driver/ToolChains/PPC* - - clang/lib/Driver/ToolChains/AIX* - - clang/lib/Driver/ToolChains/Arch/PPC.* - - clang/test/CodeGen/PowerPC/** - - clang/include/clang/Sema/SemaPPC.h - - clang/lib/Sema/SemaPPC.cpp - -backend:SystemZ: - - llvm/include/llvm/BinaryFormat/ELFRelocs/SystemZ* - - llvm/include/llvm/BinaryFormat/GOFF.h - - llvm/include/llvm/IR/IntrinsicsSystemZ.td - - llvm/lib/Target/SystemZ/** - - llvm/test/Analysis/**/SystemZ/** - - llvm/test/CodeGen/SystemZ/** - - llvm/test/DebugInfo/SystemZ/** - - llvm/test/ExecutionEngine/**/SystemZ/** - - llvm/test/MC/Disassembler/SystemZ/** - - llvm/test/MC/GOFF/** - - llvm/test/MC/SystemZ/** - - llvm/test/Transforms/**/SystemZ/** - - clang/include/clang/Basic/BuiltinsSystemZ.* - - clang/lib/Basic/Targets/SystemZ.* - - clang/lib/CodeGen/Targets/SystemZ.cpp - - clang/lib/Driver/ToolChains/ZOS* - - clang/lib/Driver/ToolChains/Arch/SystemZ.* - - clang/test/CodeGen/SystemZ/** - - clang/include/clang/Sema/SemaSystemZ.h - - clang/lib/Sema/SemaSystemZ.cpp - -third-party:unittests: - - third-party/unittests/** - -third-party:benchmark: - - third-party/benchmark/** - -llvm:binary-utilities: - - llvm/docs/CommandGuide/llvm-* - - llvm/include/llvm/BinaryFormat/** - - llvm/include/llvm/DebugInfo/Symbolize/** - - llvm/include/llvm/ObjCopy/** - - llvm/include/llvm/Object/** - - llvm/lib/BinaryFormat/** - - llvm/lib/DebugInfo/Symbolize/** - - llvm/lib/ObjCopy/** - - llvm/lib/Object/** - - llvm/test/Object/** - - llvm/test/tools/llvm-ar/** - - llvm/test/tools/llvm-cxxfilt/** - - llvm/test/tools/llvm-nm/** - - llvm/test/tools/llvm-objcopy/** - - llvm/test/tools/llvm-objdump/** - - llvm/test/tools/llvm-readobj/** - - llvm/test/tools/llvm-size/** - - llvm/test/tools/llvm-strings/** - - llvm/test/tools/llvm-symbolizer/** - - llvm/tools/llvm-ar/** - - llvm/tools/llvm-cxxfilt/** - - llvm/tools/llvm-nm/** - - llvm/tools/llvm-objcopy/** - - llvm/tools/llvm-objdump/** - - llvm/tools/llvm-readobj/** - - llvm/tools/llvm-size/** - - llvm/tools/llvm-strings/** - - llvm/tools/llvm-symbolizer/** - -clang:openmp: - - clang/include/clang/Basic/OpenMP* - - clang/include/clang/AST/OpenMPClause.h - - clang/include/clang/AST/DeclOpenMP.h - - clang/include/clang/AST/ExprOpenMP.h - - clang/include/clang/AST/StmtOpenMP.h - - clang/lib/AST/DeclOpenMP.cpp - - clang/lib/AST/OpenMPClause.cpp - - clang/lib/AST/StmtOpenMP.cpp - - clang/lib/Headers/openmp_wrappers/** - - clang/lib/Parse/ParseOpenMP.cpp - - clang/lib/Basic/OpenMPKinds.cpp - - clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp - - clang/lib/Driver/ToolChains/AMDGPUOpenMP.h - - clang/lib/CodeGen/CgStmtOpenMP.cpp - - clang/lib/CodeGen/CGOpenMP* - - clang/lib/Sema/SemaOpenMP.cpp - - clang/test/OpenMP/** - - clang/test/AST/ast-dump-openmp-* - - llvm/lib/Frontend/OpenMP/** - - llvm/lib/Transforms/IPO/OpenMPOpt.cpp - - llvm/include/llvm/Frontend/OpenMP/** - - llvm/include/llvm/Transforms/IPO/OpenMPOpt.h - - llvm/unittests/Frontend/OpenMP* - - llvm/test/Transforms/OpenMP/** - -openmp:libomp: - - any: ['openmp/**', '!openmp/libomptarget/**'] - -openmp:libomptarget: - - any: ['openmp/**', '!openmp/runtime/**'] - -bazel: - - utils/bazel/** - -offload: - - offload/** diff --git a/.github/workflows/build-ci-container.yml b/.github/workflows/build-ci-container.yml deleted file mode 100644 index 28fc7de2ee06..000000000000 --- a/.github/workflows/build-ci-container.yml +++ /dev/null @@ -1,112 +0,0 @@ -name: Build CI Container - -permissions: - contents: read - -on: - push: - branches: - - main - paths: - - .github/workflows/build-ci-container.yml - - '.github/workflows/containers/github-action-ci/**' - pull_request: - branches: - - main - paths: - - .github/workflows/build-ci-container.yml - - '.github/workflows/containers/github-action-ci/**' - -jobs: - # TODO(boomanaiden154): Switch this back to a single stage build when we can - # run this on the self-hosted runners and don't have to do it this way to - # avoid timeouts. - build-ci-container-stage1: - if: github.repository_owner == 'llvm' - runs-on: ubuntu-latest - steps: - - name: Checkout LLVM - uses: actions/checkout@v4 - with: - sparse-checkout: .github/workflows/containers/github-action-ci/ - - name: Change podman Root Direcotry - run: | - mkdir -p ~/.config/containers - sudo mkdir -p /mnt/podman - sudo chown `whoami`:`whoami` /mnt/podman - cp ./.github/workflows/containers/github-action-ci/storage.conf ~/.config/containers/storage.conf - podman info - - name: Build container stage1 - working-directory: ./.github/workflows/containers/github-action-ci/ - run: | - podman build -t stage1-toolchain --target stage1-toolchain -f stage1.Dockerfile . - - name: Save container image - run: | - podman save stage1-toolchain > stage1-toolchain.tar - - name: Upload container image - uses: actions/upload-artifact@v4 - with: - name: stage1-toolchain - path: stage1-toolchain.tar - retention-days: 1 - build-ci-container-stage2: - if: github.repository_owner == 'llvm' - runs-on: ubuntu-latest - needs: build-ci-container-stage1 - permissions: - packages: write - steps: - - name: Write Variables - id: vars - run: | - tag=`date +%s` - container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/ci-ubuntu-22.04" - echo "container-name=$container_name" >> $GITHUB_OUTPUT - echo "container-name-tag=$container_name:$tag" >> $GITHUB_OUTPUT - - - name: Checkout LLVM - uses: actions/checkout@v4 - with: - sparse-checkout: .github/workflows/containers/github-action-ci/ - - - name: Change podman Root Direcotry - run: | - mkdir -p ~/.config/containers - sudo mkdir -p /mnt/podman - sudo chown `whoami`:`whoami` /mnt/podman - cp ./.github/workflows/containers/github-action-ci/storage.conf ~/.config/containers/storage.conf - podman info - - # Download the container image into /mnt/podman rather than - # $GITHUB_WORKSPACE to avoid space limitations on the default drive - # and use the permissions setup for /mnt/podman. - - name: Download stage1-toolchain - uses: actions/download-artifact@v4 - with: - name: stage1-toolchain - path: /mnt/podman - - - name: Load stage1-toolchain - run: | - podman load -i /mnt/podman/stage1-toolchain.tar - - - name: Build Container - working-directory: ./.github/workflows/containers/github-action-ci/ - run: | - podman build -t ${{ steps.vars.outputs.container-name-tag }} -f stage2.Dockerfile . - podman tag ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name }}:latest - - - name: Test Container - run: | - for image in ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name }}; do - podman run --rm -it $image /usr/bin/bash -x -c 'printf '\''#include \nint main(int argc, char **argv) { std::cout << "Hello\\n"; }'\'' | clang++ -x c++ - && ./a.out | grep Hello' - done - - - name: Push Container - if: github.event_name == 'push' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - podman login -u ${{ github.actor }} -p $GITHUB_TOKEN ghcr.io - podman push ${{ steps.vars.outputs.container-name-tag }} - podman push ${{ steps.vars.outputs.container-name }}:latest diff --git a/.github/workflows/ci-post-commit-analyzer-run.py b/.github/workflows/ci-post-commit-analyzer-run.py deleted file mode 100644 index e5f52d3b2fa6..000000000000 --- a/.github/workflows/ci-post-commit-analyzer-run.py +++ /dev/null @@ -1,34 +0,0 @@ -import json -import multiprocessing -import os -import re -import subprocess -import sys - - -def run_analyzer(data): - os.chdir(data["directory"]) - command = ( - data["command"] - + f" --analyze --analyzer-output html -o analyzer-results -Xclang -analyzer-config -Xclang max-nodes=75000" - ) - print(command) - subprocess.run(command, shell=True, check=True) - - -def pool_error(e): - print("Error analyzing file:", e) - - -def main(): - db_path = sys.argv[1] - database = json.load(open(db_path)) - - with multiprocessing.Pool() as pool: - pool.map_async(run_analyzer, [k for k in database], error_callback=pool_error) - pool.close() - pool.join() - - -if __name__ == "__main__": - main() diff --git a/.github/workflows/ci-post-commit-analyzer.yml b/.github/workflows/ci-post-commit-analyzer.yml deleted file mode 100644 index d614dd07b3a4..000000000000 --- a/.github/workflows/ci-post-commit-analyzer.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: Post-Commit Static Analyzer - -permissions: - contents: read - -on: - push: - branches: - - 'release/**' - paths: - - 'clang/**' - - 'llvm/**' - - '.github/workflows/ci-post-commit-analyzer.yml' - pull_request: - types: - - opened - - synchronize - - reopened - - closed - paths: - - '.github/workflows/ci-post-commit-analyzer.yml' - - '.github/workflows/ci-post-commit-analyzer-run.py' - schedule: - - cron: '30 0 * * *' - -concurrency: - group: >- - llvm-project-${{ github.workflow }}-${{ github.event_name == 'pull_request' && - ( github.event.pull_request.number || github.ref) }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} - -jobs: - post-commit-analyzer: - if: >- - github.repository_owner == 'llvm' && - github.event.action != 'closed' - runs-on: ubuntu-22.04 - container: - image: 'ghcr.io/llvm/ci-ubuntu-22.04:latest' - env: - LLVM_VERSION: 18 - steps: - - name: Checkout Source - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1 - with: - # A full build of llvm, clang, lld, and lldb takes about 250MB - # of ccache space. There's not much reason to have more than this, - # because we usually won't need to save cache entries from older - # builds. Also, there is an overall 10GB cache limit, and each - # run creates a new cache entry so we want to ensure that we have - # enough cache space for all the tests to run at once and still - # fit under the 10 GB limit. - # Default to 2G to workaround: https://github.com/hendrikmuhs/ccache-action/issues/174 - max-size: 2G - key: post-commit-analyzer - variant: sccache - - - name: Configure - run: | - cmake -B build -S llvm -G Ninja \ - -DLLVM_ENABLE_ASSERTIONS=ON \ - -DLLVM_ENABLE_PROJECTS=clang \ - -DLLVM_BUILD_LLVM_DYLIB=ON \ - -DLLVM_LINK_LLVM_DYLIB=ON \ - -DCMAKE_CXX_COMPILER=clang++ \ - -DCMAKE_C_COMPILER=clang \ - -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ - -DCMAKE_C_COMPILER_LAUNCHER=sccache \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ - -DLLVM_INCLUDE_TESTS=OFF \ - -DCLANG_INCLUDE_TESTS=OFF \ - -DCMAKE_BUILD_TYPE=Release - - - name: Build - run: | - # FIXME: We need to build all the generated header files in order to be able to run - # the analyzer on every file. Building libLLVM and libclang is probably overkill for - # this, but it's better than building every target. - ninja -v -C build libLLVM.so libclang.so - - # Run the analyzer. - python3 .github/workflows/ci-post-commit-analyzer-run.py build/compile_commands.json - - scan-build --generate-index-only build/analyzer-results - - - name: Upload Results - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0 - if: always() - with: - name: analyzer-results - path: 'build/analyzer-results/*' - diff --git a/.github/workflows/clang-tests.yml b/.github/workflows/clang-tests.yml deleted file mode 100644 index 2569ce19518e..000000000000 --- a/.github/workflows/clang-tests.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Clang Tests - -permissions: - contents: read - -on: - workflow_dispatch: - push: - branches: - - 'release/**' - paths: - - 'clang/**' - - '.github/workflows/clang-tests.yml' - - '.github/workflows/llvm-project-tests.yml' - - '!llvm/**' - pull_request: - branches: - - 'release/**' - paths: - - 'clang/**' - - '.github/workflows/clang-tests.yml' - - '.github/workflows/llvm-project-tests.yml' - - '!llvm/**' - -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} - -jobs: - check_clang: - if: github.repository_owner == 'llvm' - name: Test clang,lldb,libclc - uses: ./.github/workflows/llvm-project-tests.yml - with: - build_target: check-clang - projects: clang;lldb;libclc diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000000..8bb0fd95f1f2 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,78 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: ["npu/release/19.x"] + pull_request: + # The branches below must be a subset of the branches above + branches: ["npu/release/19.x"] + schedule: + - cron: "0 0 * * 1" + +permissions: + contents: read + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ["javascript", "python", "typescript"] + # CodeQL supports [ $supported-codeql-languages ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/containers/github-action-ci/Dockerfile b/.github/workflows/containers/github-action-ci/Dockerfile new file mode 100644 index 000000000000..dc80159443d5 --- /dev/null +++ b/.github/workflows/containers/github-action-ci/Dockerfile @@ -0,0 +1,48 @@ +FROM docker.io/library/ubuntu:22.04@sha256:0e5e4a57c2499249aafc3b40fcd541e9a456aab7296681a3994d631587203f97 as base +ENV LLVM_SYSROOT=/opt/llvm/ + +FROM base as toolchain +ENV LLVM_MAJOR=17 +ENV LLVM_VERSION=${LLVM_MAJOR}.0.6 +ENV LLVM_DIRNAME=clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-22.04 +ENV LLVM_FILENAME=${LLVM_DIRNAME}.tar.xz + +RUN apt-get update && \ + apt-get install -y \ + curl \ + xz-utils + +RUN mkdir -p $LLVM_SYSROOT/bin/ $LLVM_SYSROOT/lib/ + +RUN curl -O -L https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_VERSION/$LLVM_FILENAME + +RUN tar -C $LLVM_SYSROOT --strip-components=1 -xJf $LLVM_FILENAME \ + $LLVM_DIRNAME/bin/clang \ + $LLVM_DIRNAME/bin/clang++ \ + $LLVM_DIRNAME/bin/clang-cl \ + $LLVM_DIRNAME/bin/clang-$LLVM_MAJOR \ + $LLVM_DIRNAME/bin/lld \ + $LLVM_DIRNAME/bin/ld.lld \ + $LLVM_DIRNAME/lib/clang/ + + +FROM base + +COPY --from=toolchain $LLVM_SYSROOT $LLVM_SYSROOT + +# Need to install curl for hendrikmuhs/ccache-action +# Need nodejs for some of the GitHub actions. +# Need perl-modules for clang analyzer tests. +RUN apt-get update && \ + apt-get install -y \ + binutils \ + cmake \ + curl \ + libstdc++-11-dev \ + ninja-build \ + nodejs \ + perl-modules \ + python3-psutil + +ENV LLVM_SYSROOT=$LLVM_SYSROOT +ENV PATH=${LLVM_SYSROOT}/bin:${PATH} diff --git a/.github/workflows/containers/github-action-ci/bootstrap.patch b/.github/workflows/containers/github-action-ci/bootstrap.patch deleted file mode 100644 index 55631c54a396..000000000000 --- a/.github/workflows/containers/github-action-ci/bootstrap.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/clang/cmake/caches/BOLT-PGO.cmake b/clang/cmake/caches/BOLT-PGO.cmake -index 1a04ca9a74e5..d092820e4115 100644 ---- a/clang/cmake/caches/BOLT-PGO.cmake -+++ b/clang/cmake/caches/BOLT-PGO.cmake -@@ -4,6 +4,8 @@ set(CLANG_BOOTSTRAP_TARGETS - stage2-clang-bolt - stage2-distribution - stage2-install-distribution -+ clang -+ lld - CACHE STRING "") - set(BOOTSTRAP_CLANG_BOOTSTRAP_TARGETS - clang-bolt diff --git a/.github/workflows/containers/github-action-ci/stage1.Dockerfile b/.github/workflows/containers/github-action-ci/stage1.Dockerfile deleted file mode 100644 index 8c6bcf463841..000000000000 --- a/.github/workflows/containers/github-action-ci/stage1.Dockerfile +++ /dev/null @@ -1,44 +0,0 @@ -FROM docker.io/library/ubuntu:22.04 as base -ENV LLVM_SYSROOT=/opt/llvm - -FROM base as stage1-toolchain -ENV LLVM_VERSION=17.0.6 - -RUN apt-get update && \ - apt-get install -y \ - wget \ - gcc \ - g++ \ - cmake \ - ninja-build \ - python3 \ - git \ - curl - -RUN curl -O -L https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-$LLVM_VERSION.tar.gz && tar -xf llvmorg-$LLVM_VERSION.tar.gz - -WORKDIR /llvm-project-llvmorg-$LLVM_VERSION - -COPY bootstrap.patch / - -# TODO(boomanaiden154): Remove the patch pulled from a LLVM PR once we bump -# the toolchain to version 18 and the patch is in-tree. -# TODO(boomanaiden154): Remove the bootstrap patch once we unsplit the build -# and no longer need to explicitly build the stage2 dependencies. -RUN curl https://github.com/llvm/llvm-project/commit/dd0356d741aefa25ece973d6cc4b55dcb73b84b4.patch | patch -p1 && cat /bootstrap.patch | patch -p1 - -RUN mkdir build - -RUN cmake -B ./build -G Ninja ./llvm \ - -C ./clang/cmake/caches/BOLT-PGO.cmake \ - -DBOOTSTRAP_LLVM_ENABLE_LLD=ON \ - -DBOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LLD=ON \ - -DPGO_INSTRUMENT_LTO=Thin \ - -DLLVM_ENABLE_RUNTIMES="compiler-rt" \ - -DCMAKE_INSTALL_PREFIX="$LLVM_SYSROOT" \ - -DLLVM_ENABLE_PROJECTS="bolt;clang;lld;clang-tools-extra" \ - -DLLVM_DISTRIBUTION_COMPONENTS="lld;compiler-rt;clang-format;scan-build" \ - -DCLANG_DEFAULT_LINKER="lld" \ - -DBOOTSTRAP_CLANG_PGO_TRAINING_DATA_SOURCE_DIR=/llvm-project-llvmorg-$LLVM_VERSION/llvm - -RUN ninja -C ./build stage2-instrumented-clang stage2-instrumented-lld diff --git a/.github/workflows/containers/github-action-ci/stage2.Dockerfile b/.github/workflows/containers/github-action-ci/stage2.Dockerfile deleted file mode 100644 index 0ca0da87734c..000000000000 --- a/.github/workflows/containers/github-action-ci/stage2.Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM docker.io/library/ubuntu:22.04 as base -ENV LLVM_SYSROOT=/opt/llvm - -FROM stage1-toolchain AS stage2-toolchain - -RUN ninja -C ./build stage2-clang-bolt stage2-install-distribution && ninja -C ./build install-distribution && rm -rf ./build - -FROM base - -COPY --from=stage2-toolchain $LLVM_SYSROOT $LLVM_SYSROOT - -# Need to install curl for hendrikmuhs/ccache-action -# Need nodejs for some of the GitHub actions. -# Need perl-modules for clang analyzer tests. -# Need git for SPIRV-Tools tests. -RUN apt-get update && \ - apt-get install -y \ - binutils \ - cmake \ - curl \ - git \ - libstdc++-11-dev \ - ninja-build \ - nodejs \ - perl-modules \ - python3-psutil - -ENV LLVM_SYSROOT=$LLVM_SYSROOT -ENV PATH=${LLVM_SYSROOT}/bin:${PATH} diff --git a/.github/workflows/containers/github-action-ci/storage.conf b/.github/workflows/containers/github-action-ci/storage.conf deleted file mode 100644 index 60f295ff1e96..000000000000 --- a/.github/workflows/containers/github-action-ci/storage.conf +++ /dev/null @@ -1,4 +0,0 @@ -[storage] - driver = "overlay" - runroot = "/mnt/podman/container" - graphroot = "/mnt/podman/image" diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 000000000000..1b495dbce772 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,27 @@ +# Dependency Review Action +# +# This Action will scan dependency manifest files that change as part of a Pull Request, +# surfacing known-vulnerable versions of the packages declared or updated in the PR. +# Once installed, if the workflow run is marked as required, +# PRs introducing known-vulnerable packages will be blocked from merging. +# +# Source repository: https://github.com/actions/dependency-review-action +name: 'Dependency Review' +on: [pull_request] + +permissions: + contents: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit + + - name: 'Checkout Repository' + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: 'Dependency Review' + uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 800e92915735..000000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,169 +0,0 @@ -# LLVM Documentation CI -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -name: "Test documentation build" - -permissions: - contents: read - -on: - push: - branches: - - 'main' - paths: - - 'llvm/docs/**' - - 'clang/docs/**' - - 'clang/include/clang/Basic/AttrDocs.td' - - 'clang/include/clang/Driver/ClangOptionDocs.td' - - 'clang/include/clang/Basic/DiagnosticDocs.td' - - 'clang-tools-extra/docs/**' - - 'lldb/docs/**' - - 'libunwind/docs/**' - - 'libcxx/docs/**' - - 'libc/docs/**' - - 'lld/docs/**' - - 'openmp/docs/**' - - 'polly/docs/**' - - 'flang/docs/**' - - 'flang/include/flang/Optimizer/Dialect/FIROps.td' - - '.github/workflows/docs.yml' - pull_request: - paths: - - 'llvm/docs/**' - - 'clang/docs/**' - - 'clang/include/clang/Basic/AttrDocs.td' - - 'clang/include/clang/Driver/ClangOptionDocs.td' - - 'clang/include/clang/Basic/DiagnosticDocs.td' - - 'clang-tools-extra/docs/**' - - 'lldb/docs/**' - - 'libunwind/docs/**' - - 'libcxx/docs/**' - - 'libc/docs/**' - - 'lld/docs/**' - - 'openmp/docs/**' - - 'polly/docs/**' - - 'flang/docs/**' - - 'flang/include/flang/Optimizer/Dialect/FIROps.td' - - '.github/workflows/docs.yml' - -jobs: - check-docs-build: - name: "Test documentation build" - runs-on: ubuntu-latest - if: github.repository == 'llvm/llvm-project' - steps: - # Don't fetch before checking for file changes to force the file changes - # action to use the Github API in pull requests. If it's a push to a - # branch we can't use the Github API to get the diff, so we need to have - # a local checkout beforehand. - - name: Fetch LLVM sources (Push) - if: ${{ github.event_name == 'push' }} - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - name: Get subprojects that have doc changes - id: docs-changed-subprojects - uses: tj-actions/changed-files@v39 - with: - files_yaml: | - llvm: - - 'llvm/docs/**' - clang: - - 'clang/docs/**' - - 'clang/include/clang/Basic/AttrDocs.td' - - 'clang/include/clang/Driver/ClangOptionDocs.td' - - 'clang/include/clang/Basic/DiagnosticDocs.td' - clang-tools-extra: - - 'clang-tools-extra/docs/**' - lldb: - - 'lldb/docs/**' - libunwind: - - 'libunwind/docs/**' - libcxx: - - 'libcxx/docs/**' - libc: - - 'libc/docs/**' - lld: - - 'lld/docs/**' - openmp: - - 'openmp/docs/**' - polly: - - 'polly/docs/**' - flang: - - 'flang/docs/**' - - 'flang/include/flang/Optimizer/Dialect/FIROps.td' - - name: Fetch LLVM sources (PR) - if: ${{ github.event_name == 'pull_request' }} - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - name: Setup Python env - uses: actions/setup-python@v5 - with: - python-version: '3.11' - cache: 'pip' - cache-dependency-path: 'llvm/docs/requirements.txt' - - name: Install python dependencies - run: pip install -r llvm/docs/requirements.txt - - name: Install system dependencies - run: | - sudo apt-get update - # swig and graphviz are lldb specific dependencies - sudo apt-get install -y cmake ninja-build swig graphviz - - name: Build LLVM docs - if: steps.docs-changed-subprojects.outputs.llvm_any_changed == 'true' - run: | - cmake -B llvm-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_SPHINX=ON ./llvm - TZ=UTC ninja -C llvm-build docs-llvm-html docs-llvm-man - - name: Build Clang docs - if: steps.docs-changed-subprojects.outputs.clang_any_changed == 'true' - run: | - cmake -B clang-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_SPHINX=ON ./llvm - TZ=UTC ninja -C clang-build docs-clang-html docs-clang-man - - name: Build clang-tools-extra docs - if: steps.docs-changed-subprojects.outputs.clang-tools-extra_any_changed == 'true' - run: | - cmake -B clang-tools-extra-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DLLVM_ENABLE_SPHINX=ON ./llvm - TZ=UTC ninja -C clang-tools-extra-build docs-clang-tools-html docs-clang-tools-man - - name: Build LLDB docs - if: steps.docs-changed-subprojects.outputs.lldb_any_changed == 'true' - run: | - cmake -B lldb-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lldb" -DLLVM_ENABLE_SPHINX=ON ./llvm - TZ=UTC ninja -C lldb-build docs-lldb-html docs-lldb-man - - name: Build libunwind docs - if: steps.docs-changed-subprojects.outputs.libunwind_any_changed == 'true' - run: | - cmake -B libunwind-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libunwind" -DLLVM_ENABLE_SPHINX=ON ./runtimes - TZ=UTC ninja -C libunwind-build docs-libunwind-html - - name: Build libcxx docs - if: steps.docs-changed-subprojects.outputs.libcxx_any_changed == 'true' - run: | - cmake -B libcxx-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libcxxabi;libcxx;libunwind" -DLLVM_ENABLE_SPHINX=ON ./runtimes - TZ=UTC ninja -C libcxx-build docs-libcxx-html - - name: Build libc docs - if: steps.docs-changed-subprojects.outputs.libc_any_changed == 'true' - run: | - cmake -B libc-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libc" -DLLVM_ENABLE_SPHINX=ON ./runtimes - TZ=UTC ninja -C libc-build docs-libc-html - - name: Build LLD docs - if: steps.docs-changed-subprojects.outputs.lld_any_changed == 'true' - run: | - cmake -B lld-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="lld" -DLLVM_ENABLE_SPHINX=ON ./llvm - TZ=UTC ninja -C lld-build docs-lld-html - - name: Build OpenMP docs - if: steps.docs-changed-subprojects.outputs.openmp_any_changed == 'true' - run: | - cmake -B openmp-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;openmp" -DLLVM_ENABLE_SPHINX=ON ./llvm - TZ=UTC ninja -C openmp-build docs-openmp-html - - name: Build Polly docs - if: steps.docs-changed-subprojects.outputs.polly_any_changed == 'true' - run: | - cmake -B polly-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="polly" -DLLVM_ENABLE_SPHINX=ON ./llvm - TZ=UTC ninja -C polly-build docs-polly-html docs-polly-man - - name: Build Flang docs - if: steps.docs-changed-subprojects.outputs.flang_any_changed == 'true' - run: | - cmake -B flang-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;mlir;flang" -DLLVM_ENABLE_SPHINX=ON ./llvm - TZ=UTC ninja -C flang-build docs-flang-html diff --git a/.github/workflows/email-check.yaml b/.github/workflows/email-check.yaml deleted file mode 100644 index 8f32d020975f..000000000000 --- a/.github/workflows/email-check.yaml +++ /dev/null @@ -1,46 +0,0 @@ -name: "Check for private emails used in PRs" - -on: - pull_request: - types: - - opened - -permissions: - contents: read - -jobs: - validate_email: - runs-on: ubuntu-latest - if: github.repository == 'llvm/llvm-project' - steps: - - name: Fetch LLVM sources - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Extract author email - id: author - run: | - git log -1 - echo "EMAIL=$(git show -s --format='%ae' HEAD~0)" >> $GITHUB_OUTPUT - # Create empty comment file - echo "[]" > comments - - - name: Validate author email - if: ${{ endsWith(steps.author.outputs.EMAIL, 'noreply.github.com') }} - env: - COMMENT: >- - ⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
- Please turn off [Keep my email addresses private](https://github.com/settings/emails) setting in your account.
- See [LLVM Discourse](https://discourse.llvm.org/t/hidden-emails-on-github-should-we-do-something-about-it) for more information. - run: | - cat << EOF > comments - [{"body" : "$COMMENT"}] - EOF - - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0 - if: always() - with: - name: workflow-args - path: | - comments diff --git a/.github/workflows/get-llvm-version/action.yml b/.github/workflows/get-llvm-version/action.yml deleted file mode 100644 index 2218d926fc13..000000000000 --- a/.github/workflows/get-llvm-version/action.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Get LLVM Version -description: >- - Get the LLVM version from the llvm-project source tree. This action assumes - the llvm-project sources have already been checked out into GITHUB_WORKSPACE. - -outputs: - major: - description: LLVM major version - value: ${{ steps.version.outputs.major }} - minor: - description: LLVM minor version - value: ${{ steps.version.outputs.minor }} - patch: - description: LLVM patch version - value: ${{ steps.version.outputs.patch }} - -runs: - using: "composite" - steps: - - name: Get Version - shell: bash - id: version - run: | - for v in major minor patch; do - echo "$v=`llvm/utils/release/get-llvm-version.sh --$v`" >> $GITHUB_OUTPUT - done diff --git a/.github/workflows/issue-release-workflow.yml b/.github/workflows/issue-release-workflow.yml deleted file mode 100644 index 5027d4f3ea6f..000000000000 --- a/.github/workflows/issue-release-workflow.yml +++ /dev/null @@ -1,69 +0,0 @@ -# This contains the workflow definitions that allow users to test backports -# to the release branch using comments on issues. -# -# /cherry-pick <...> -# -# This comment will attempt to cherry-pick the given commits to the latest -# release branch (release/Y.x) and if successful, push the result to a branch -# on github. -# -# /branch // -# -# This comment will create a pull request from to the latest release -# branch. - -name: Issue Release Workflow - -permissions: - contents: read - -on: - issue_comment: - types: - - created - - edited - issues: - types: - - opened - -env: - COMMENT_BODY: ${{ github.event.action == 'opened' && github.event.issue.body || github.event.comment.body }} - -jobs: - backport-commits: - name: Backport Commits - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - if: >- - (github.repository == 'llvm/llvm-project') && - !startswith(github.event.comment.body, '') && - contains(github.event.action == 'opened' && github.event.issue.body || github.event.comment.body, '/cherry-pick') - steps: - - name: Fetch LLVM sources - uses: actions/checkout@v4 - with: - repository: llvm/llvm-project - # GitHub stores the token used for checkout and uses it for pushes - # too, but we want to use a different token for pushing, so we need - # to disable persist-credentials here. - persist-credentials: false - fetch-depth: 0 - - - name: Setup Environment - run: | - pip install --require-hashes -r ./llvm/utils/git/requirements.txt - ./llvm/utils/git/github-automation.py --token ${{ github.token }} setup-llvmbot-git - - - name: Backport Commits - run: | - printf "%s" "$COMMENT_BODY" | - ./llvm/utils/git/github-automation.py \ - --repo "$GITHUB_REPOSITORY" \ - --token "${{ secrets.RELEASE_WORKFLOW_PR_CREATE }}" \ - release-workflow \ - --branch-repo-token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \ - --issue-number ${{ github.event.issue.number }} \ - --requested-by ${{ (github.event.action == 'opened' && github.event.issue.user.login) || github.event.comment.user.login }} \ - auto diff --git a/.github/workflows/issue-subscriber.yml b/.github/workflows/issue-subscriber.yml deleted file mode 100644 index ef4fdf441819..000000000000 --- a/.github/workflows/issue-subscriber.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Issue Subscriber - -on: - issues: - types: - - labeled - -permissions: - contents: read - -jobs: - auto-subscribe: - runs-on: ubuntu-latest - if: github.repository == 'llvm/llvm-project' - steps: - - name: Checkout Automation Script - uses: actions/checkout@v4 - with: - sparse-checkout: llvm/utils/git/ - ref: main - - - name: Setup Automation Script - working-directory: ./llvm/utils/git/ - run: | - pip install --require-hashes -r requirements.txt - - - name: Update watchers - working-directory: ./llvm/utils/git/ - # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable - env: - LABEL_NAME: ${{ github.event.label.name }} - run: | - python3 ./github-automation.py \ - --token '${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}' \ - issue-subscriber \ - --issue-number '${{ github.event.issue.number }}' \ - --label-name "$LABEL_NAME" diff --git a/.github/workflows/issue-write.yml b/.github/workflows/issue-write.yml deleted file mode 100644 index 5334157a7fd2..000000000000 --- a/.github/workflows/issue-write.yml +++ /dev/null @@ -1,157 +0,0 @@ -name: Comment on an issue - -on: - workflow_run: - workflows: - - "Check code formatting" - - "Check for private emails used in PRs" - - "PR Request Release Note" - types: - - completed - -permissions: - contents: read - -jobs: - pr-comment: - runs-on: ubuntu-latest - permissions: - pull-requests: write - if: > - github.event.workflow_run.event == 'pull_request' && - ( - github.event.workflow_run.conclusion == 'success' || - github.event.workflow_run.conclusion == 'failure' - ) - steps: - - name: Fetch Sources - uses: actions/checkout@v4 - with: - sparse-checkout: | - .github/workflows/unprivileged-download-artifact/action.yml - sparse-checkout-cone-mode: false - - name: 'Download artifact' - uses: ./.github/workflows/unprivileged-download-artifact - id: download-artifact - with: - run-id: ${{ github.event.workflow_run.id }} - artifact-name: workflow-args - - - name: 'Comment on PR' - if: steps.download-artifact.outputs.artifact-id != '' - uses: actions/github-script@v3 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - var fs = require('fs'); - const comments = JSON.parse(fs.readFileSync('./comments')); - if (!comments || comments.length == 0) { - return; - } - - let runInfo = await github.actions.getWorkflowRun({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id - }); - - console.log(runInfo); - - - // Query to find the number of the pull request that triggered this job. - // The associated pull requests are based off of the branch name, so if - // you create a pull request for a branch, close it, and then create - // another pull request with the same branch, then this query will return - // two associated pull requests. This is why we have to fetch all the - // associated pull requests and then iterate through them to find the - // one that is open. - const gql_query = ` - query($repo_owner : String!, $repo_name : String!, $branch: String!) { - repository(owner: $repo_owner, name: $repo_name) { - ref (qualifiedName: $branch) { - associatedPullRequests(first: 100) { - nodes { - baseRepository { - owner { - login - } - } - number - state - } - } - } - } - } - ` - const gql_variables = { - repo_owner: runInfo.data.head_repository.owner.login, - repo_name: runInfo.data.head_repository.name, - branch: runInfo.data.head_branch - } - const gql_result = await github.graphql(gql_query, gql_variables); - console.log(gql_result); - // If the branch for the PR was deleted before this job has a chance - // to run, then the ref will be null. This can happen if someone: - // 1. Rebase the PR, which triggers some workflow. - // 2. Immediately merges the PR and deletes the branch. - // 3. The workflow finishes and triggers this job. - if (!gql_result.repository.ref) { - console.log("Ref has been deleted"); - return; - } - console.log(gql_result.repository.ref.associatedPullRequests.nodes); - - var pr_number = 0; - gql_result.repository.ref.associatedPullRequests.nodes.forEach((pr) => { - - // The largest PR number is the one we care about. The only way - // to have more than one associated pull requests is if all the - // old pull requests are in the closed state. - if (pr.baseRepository.owner.login = context.repo.owner && pr.number > pr_number) { - pr_number = pr.number; - } - }); - if (pr_number == 0) { - console.log("Error retrieving pull request number"); - return; - } - - await comments.forEach(function (comment) { - if (comment.id) { - // Security check: Ensure that this comment was created by - // the github-actions bot, so a malicious input won't overwrite - // a user's comment. - github.issues.getComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: comment.id - }).then((old_comment) => { - console.log(old_comment); - if (old_comment.data.user.login != "github-actions[bot]") { - console.log("Invalid comment id: " + comment.id); - return; - } - github.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: pr_number, - comment_id: comment.id, - body: comment.body - }); - }); - } else { - github.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: pr_number, - body: comment.body - }); - } - }); - - - name: Dump comments file - if: >- - always() && - steps.download-artifact.outputs.artifact-id != '' - run: cat comments diff --git a/.github/workflows/libclang-abi-tests.yml b/.github/workflows/libclang-abi-tests.yml deleted file mode 100644 index 9e839ff49e28..000000000000 --- a/.github/workflows/libclang-abi-tests.yml +++ /dev/null @@ -1,168 +0,0 @@ -name: libclang ABI Tests - -permissions: - contents: read - -on: - workflow_dispatch: - push: - branches: - - 'release/**' - paths: - - 'clang/**' - - '.github/workflows/libclang-abi-tests.yml' - pull_request: - branches: - - 'release/**' - paths: - - 'clang/**' - - '.github/workflows/libclang-abi-tests.yml' - -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} - -jobs: - abi-dump-setup: - if: github.repository_owner == 'llvm' - runs-on: ubuntu-latest - outputs: - BASELINE_REF: ${{ steps.vars.outputs.BASELINE_REF }} - ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }} - ABI_LIBS: ${{ steps.vars.outputs.ABI_LIBS }} - BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }} - LLVM_VERSION_MAJOR: ${{ steps.version.outputs.major }} - LLVM_VERSION_MINOR: ${{ steps.version.outputs.minor }} - LLVM_VERSION_PATCH: ${{ steps.version.outputs.patch }} - steps: - - name: Checkout source - uses: actions/checkout@v4 - with: - fetch-depth: 250 - - - name: Get LLVM version - id: version - uses: ./.github/workflows/get-llvm-version - - - name: Setup Variables - id: vars - run: | - remote_repo='https://github.com/llvm/llvm-project' - if [ ${{ steps.version.outputs.patch }} -eq 0 ]; then - major_version=$(( ${{ steps.version.outputs.major }} - 1)) - baseline_ref="llvmorg-$major_version.1.0" - - # If there is a minor release, we want to use that as the base line. - minor_ref=$(git ls-remote --refs -t "$remote_repo" llvmorg-"$major_version".[1-9].[0-9] | tail -n1 | grep -o 'llvmorg-.\+' || true) - if [ -n "$minor_ref" ]; then - baseline_ref="$minor_ref" - else - # Check if we have a release candidate - rc_ref=$(git ls-remote --refs -t "$remote_repo" llvmorg-"$major_version".[1-9].[0-9]-rc* | tail -n1 | grep -o 'llvmorg-.\+' || true) - if [ -n "$rc_ref" ]; then - baseline_ref="$rc_ref" - fi - fi - { - echo "BASELINE_VERSION_MAJOR=$major_version" - echo "BASELINE_REF=$baseline_ref" - echo "ABI_HEADERS=clang-c" - echo "ABI_LIBS=libclang.so" - } >> "$GITHUB_OUTPUT" - else - { - echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.major }}" - echo "BASELINE_REF=llvmorg-${{ steps.version.outputs.major }}.1.0" - echo "ABI_HEADERS=." - echo "ABI_LIBS=libclang.so libclang-cpp.so" - } >> "$GITHUB_OUTPUT" - fi - - abi-dump: - if: github.repository_owner == 'llvm' - needs: abi-dump-setup - runs-on: ubuntu-latest - strategy: - matrix: - name: - - build-baseline - - build-latest - include: - - name: build-baseline - llvm_version_major: ${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }} - ref: ${{ needs.abi-dump-setup.outputs.BASELINE_REF }} - repo: llvm/llvm-project - - name: build-latest - llvm_version_major: ${{ needs.abi-dump-setup.outputs.LLVM_VERSION_MAJOR }} - ref: ${{ github.sha }} - repo: ${{ github.repository }} - steps: - - name: Install Ninja - uses: llvm/actions/install-ninja@main - - name: Install abi-compliance-checker - run: | - sudo apt-get install abi-dumper autoconf pkg-config - - name: Install universal-ctags - run: | - git clone https://github.com/universal-ctags/ctags.git - cd ctags - ./autogen.sh - ./configure - sudo make install - - name: Download source code - uses: llvm/actions/get-llvm-project-src@main - with: - ref: ${{ matrix.ref }} - repo: ${{ matrix.repo }} - - name: Configure - run: | - mkdir install - cmake -B build -S llvm -G Ninja -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="" -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_C_FLAGS_DEBUG="-g1 -Og" -DCMAKE_CXX_FLAGS_DEBUG="-g1 -Og" -DCMAKE_INSTALL_PREFIX="$(pwd)"/install llvm - - name: Build - run: ninja -C build/ ${{ needs.abi-dump-setup.outputs.ABI_LIBS }} install-clang-headers - - name: Dump ABI - run: | - parallel abi-dumper -lver ${{ matrix.ref }} -skip-cxx -public-headers ./install/include/${{ needs.abi-dump-setup.outputs.ABI_HEADERS }} -o {}-${{ matrix.ref }}.abi ./build/lib/{} ::: ${{ needs.abi-dump-setup.outputs.ABI_LIBS }} - for lib in ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}; do - # Remove symbol versioning from dumps, so we can compare across major versions. - sed -i 's/LLVM_[0-9]\+/LLVM_NOVERSION/' $lib-${{ matrix.ref }}.abi - done - - name: Upload ABI file - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.name }} - path: '*${{ matrix.ref }}.abi' - - abi-compare: - if: github.repository_owner == 'llvm' - runs-on: ubuntu-latest - needs: - - abi-dump-setup - - abi-dump - steps: - - name: Download baseline - uses: actions/download-artifact@v3 - with: - name: build-baseline - path: build-baseline - - name: Download latest - uses: actions/download-artifact@v3 - with: - name: build-latest - path: build-latest - - - name: Install abi-compliance-checker - run: sudo apt-get install abi-compliance-checker - - name: Compare ABI - run: | - for lib in ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}; do - abi-compliance-checker -lib $lib -old build-baseline/$lib*.abi -new build-latest/$lib*.abi - done - - name: Upload ABI Comparison - if: always() - uses: actions/upload-artifact@v3 - with: - name: compat-report-${{ github.sha }} - path: compat_reports/ diff --git a/.github/workflows/libclang-python-tests.yml b/.github/workflows/libclang-python-tests.yml deleted file mode 100644 index 33d6c2174dca..000000000000 --- a/.github/workflows/libclang-python-tests.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Libclang Python Binding Tests - -permissions: - contents: read - -on: - workflow_dispatch: - push: - branches: - - 'main' - paths: - - 'clang/bindings/python/**' - - 'clang/tools/libclang/**' - - 'clang/CMakeList.txt' - - '.github/workflows/libclang-python-tests.yml' - - '.github/workflows/llvm-project-tests.yml' - pull_request: - paths: - - 'clang/bindings/python/**' - - 'clang/tools/libclang/**' - - 'clang/CMakeList.txt' - - '.github/workflows/libclang-python-tests.yml' - - '.github/workflows/llvm-project-tests.yml' - -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} - -jobs: - check-clang-python: - # Build libclang and then run the libclang Python binding's unit tests. - name: Build and run Python unit tests - if: github.repository == 'llvm/llvm-project' - strategy: - fail-fast: false - matrix: - python-version: ["3.8", "3.11"] - uses: ./.github/workflows/llvm-project-tests.yml - with: - build_target: check-clang-python - projects: clang - # There is an issue running on "windows-2019". - # See https://github.com/llvm/llvm-project/issues/76601#issuecomment-1873049082. - os_list: '["ubuntu-22.04"]' - python_version: ${{ matrix.python-version }} diff --git a/.github/workflows/libclc-tests.yml b/.github/workflows/libclc-tests.yml deleted file mode 100644 index 23192f776a98..000000000000 --- a/.github/workflows/libclc-tests.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: libclc Tests - -permissions: - contents: read - -on: - workflow_dispatch: - push: - branches: - - 'release/**' - paths: - - 'libclc/**' - - '.github/workflows/libclc-tests.yml' - - '.github/workflows/llvm-project-tests.yml' - - '!clang/**' - - '!llvm/**' - pull_request: - branches: - - 'release/**' - paths: - - 'libclc/**' - - '.github/workflows/libclc-tests.yml' - - '.github/workflows/llvm-project-tests.yml' - - '!clang/**' - - '!llvm/**' - -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} - -jobs: - check_libclc: - if: github.repository_owner == 'llvm' - name: Test libclc - uses: ./.github/workflows/llvm-project-tests.yml - with: - projects: clang;libclc diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml deleted file mode 100644 index 1456f245cf7c..000000000000 --- a/.github/workflows/libcxx-build-and-test.yaml +++ /dev/null @@ -1,234 +0,0 @@ -# This file defines pre-commit CI for libc++, libc++abi, and libunwind (on Github). -# -# We split the configurations in multiple stages with the intent of saving compute time -# when a job fails early in the pipeline. This is why the jobs are marked as `continue-on-error: false`. -# We try to run the CI configurations with the most signal in the first stage. -# -# Stages 1 & 2 are meant to be "smoke tests", and are meant to catch most build/test failures quickly and without using -# too many resources. -# Stage 3 is "everything else", and is meant to catch breakages on more niche or unique configurations. -# -# Therefore, we "fail-fast" for any failures during stages 1 & 2, meaning any job failing cancels all other running jobs, -# under the assumption that if the "smoke tests" fail, then the other configurations will likely fail in the same way. -# However, stage 3 does not fail fast, as it's more likely that any one job failing is a flake or a configuration-specific -# -name: Build and Test libc++ -on: - pull_request: - paths: - - 'libcxx/**' - - 'libcxxabi/**' - - 'libunwind/**' - - 'runtimes/**' - - 'cmake/**' - - '.github/workflows/libcxx-build-and-test.yaml' - schedule: - # Run nightly at 08:00 UTC (aka 00:00 Pacific, aka 03:00 Eastern) - - cron: '0 8 * * *' - -permissions: - contents: read # Default everything to read-only - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number }} - cancel-in-progress: true - - -env: - # LLVM POST-BRANCH bump version - # LLVM POST-BRANCH add compiler test for ToT - 1, e.g. "Clang 17" - # LLVM RELEASE bump remove compiler ToT - 3, e.g. "Clang 15" - LLVM_HEAD_VERSION: "19" # Used compiler, update POST-BRANCH. - LLVM_PREVIOUS_VERSION: "18" - LLVM_OLDEST_VERSION: "17" - GCC_STABLE_VERSION: "13" - LLVM_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-19" - CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics" - - -jobs: - stage1: - if: github.repository_owner == 'llvm' - runs-on: libcxx-runners-8-set - continue-on-error: false - strategy: - fail-fast: false - matrix: - config: [ - 'generic-cxx03', - 'generic-cxx26', - 'generic-modules' - ] - cc: [ 'clang-19' ] - cxx: [ 'clang++-19' ] - include: - - config: 'generic-gcc' - cc: 'gcc-14' - cxx: 'g++-14' - steps: - - uses: actions/checkout@v4 - - name: ${{ matrix.config }}.${{ matrix.cxx }} - run: libcxx/utils/ci/run-buildbot ${{ matrix.config }} - env: - CC: ${{ matrix.cc }} - CXX: ${{ matrix.cxx }} - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 - if: always() - with: - name: ${{ matrix.config }}-${{ matrix.cxx }}-results - path: | - **/test-results.xml - **/*.abilist - **/CMakeError.log - **/CMakeOutput.log - **/crash_diagnostics/* - stage2: - if: github.repository_owner == 'llvm' - runs-on: libcxx-runners-8-set - needs: [ stage1 ] - continue-on-error: false - strategy: - fail-fast: false - matrix: - config: [ - 'generic-cxx11', - 'generic-cxx14', - 'generic-cxx17', - 'generic-cxx20', - 'generic-cxx23' - ] - cc: [ 'clang-19' ] - cxx: [ 'clang++-19' ] - include: - - config: 'generic-gcc-cxx11' - cc: 'gcc-14' - cxx: 'g++-14' - - config: 'generic-cxx23' - cc: 'clang-17' - cxx: 'clang++-17' - - config: 'generic-cxx26' - cc: 'clang-18' - cxx: 'clang++-18' - steps: - - uses: actions/checkout@v4 - - name: ${{ matrix.config }} - run: libcxx/utils/ci/run-buildbot ${{ matrix.config }} - env: - CC: ${{ matrix.cc }} - CXX: ${{ matrix.cxx }} - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 - if: always() # Upload artifacts even if the build or test suite fails - with: - name: ${{ matrix.config }}-${{ matrix.cxx }}-results - path: | - **/test-results.xml - **/*.abilist - **/CMakeError.log - **/CMakeOutput.log - **/crash_diagnostics/* - stage3: - if: github.repository_owner == 'llvm' - needs: [ stage1, stage2 ] - continue-on-error: false - strategy: - fail-fast: false - max-parallel: 8 - matrix: - config: [ - 'generic-abi-unstable', - 'generic-hardening-mode-debug', - 'generic-hardening-mode-extensive', - 'generic-hardening-mode-fast', - 'generic-hardening-mode-fast-with-abi-breaks', - 'generic-merged', - 'generic-modules-lsv', - 'generic-no-exceptions', - 'generic-no-experimental', - 'generic-no-filesystem', - 'generic-no-localization', - 'generic-no-random_device', - 'generic-no-threads', - 'generic-no-tzdb', - 'generic-no-unicode', - 'generic-no-wide-characters', - 'generic-no-rtti', - 'generic-optimized-speed', - 'generic-static', - # TODO Find a better place for the benchmark and bootstrapping builds to live. They're either very expensive - # or don't provide much value since the benchmark run results are too noise on the bots. - 'benchmarks', - 'bootstrapping-build' - ] - machine: [ 'libcxx-runners-8-set' ] - include: - - config: 'generic-cxx26' - machine: libcxx-runners-8-set - - config: 'generic-asan' - machine: libcxx-runners-8-set - - config: 'generic-tsan' - machine: libcxx-runners-8-set - - config: 'generic-ubsan' - machine: libcxx-runners-8-set - # Use a larger machine for MSAN to avoid timeout and memory allocation issues. - - config: 'generic-msan' - machine: libcxx-runners-8-set - runs-on: ${{ matrix.machine }} - steps: - - uses: actions/checkout@v4 - - name: ${{ matrix.config }} - run: libcxx/utils/ci/run-buildbot ${{ matrix.config }} - env: - CC: clang-19 - CXX: clang++-19 - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 - if: always() - with: - name: ${{ matrix.config }}-results - path: | - **/test-results.xml - **/*.abilist - **/CMakeError.log - **/CMakeOutput.log - **/crash_diagnostics/* - windows: - runs-on: windows-2022 - needs: [ stage1 ] - strategy: - fail-fast: false - matrix: - include: - - { config: clang-cl-dll, mingw: false } - - { config: clang-cl-static, mingw: false } - - { config: clang-cl-no-vcruntime, mingw: false } - - { config: clang-cl-debug, mingw: false } - - { config: clang-cl-static-crt, mingw: false } - - { config: mingw-dll, mingw: true } - - { config: mingw-static, mingw: true } - - { config: mingw-dll-i686, mingw: true } - steps: - - uses: actions/checkout@v4 - - name: Install dependencies - run: | - choco install -y ninja - pip install psutil - - name: Install a current LLVM - if: ${{ matrix.mingw != true }} - run: | - choco install -y llvm --version=18.1.6 --allow-downgrade - - name: Install llvm-mingw - if: ${{ matrix.mingw == true }} - run: | - curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20240606/llvm-mingw-20240606-ucrt-x86_64.zip - powershell Expand-Archive llvm-mingw*.zip -DestinationPath . - del llvm-mingw*.zip - mv llvm-mingw* c:\llvm-mingw - echo "c:\llvm-mingw\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append - - name: Add Git Bash to the path - run: | - echo "c:\Program Files\Git\usr\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append - - name: Set up the MSVC dev environment - if: ${{ matrix.mingw != true }} - uses: ilammy/msvc-dev-cmd@v1 - - name: Build and test - run: | - bash libcxx/utils/ci/run-buildbot ${{ matrix.config }} diff --git a/.github/workflows/libcxx-check-generated-files.yml b/.github/workflows/libcxx-check-generated-files.yml deleted file mode 100644 index 570055624b2a..000000000000 --- a/.github/workflows/libcxx-check-generated-files.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: "Check libc++ generated files" -on: - pull_request: - paths: - - 'libcxx/**' - -permissions: - contents: read - -jobs: - check_generated_files: - runs-on: ubuntu-latest - steps: - - name: Fetch LLVM sources - uses: actions/checkout@v4 - - - name: Install dependencies - uses: aminya/setup-cpp@v1 - with: - clangformat: 17.0.1 - ninja: true - - - name: Check generated files - run: libcxx/utils/ci/run-buildbot check-generated-output diff --git a/.github/workflows/libcxx-restart-preempted-jobs.yaml b/.github/workflows/libcxx-restart-preempted-jobs.yaml deleted file mode 100644 index 21879ce19c27..000000000000 --- a/.github/workflows/libcxx-restart-preempted-jobs.yaml +++ /dev/null @@ -1,132 +0,0 @@ -name: Restart Preempted Libc++ Workflow - -# The libc++ builders run on preemptable VMs, which can be shutdown at any time. -# This workflow identifies when a workflow run was canceled due to the VM being preempted, -# and restarts the workflow run. - -# We identify a canceled workflow run by checking the annotations of the check runs in the check suite, -# which should contain the message "The runner has received a shutdown signal." - -# Note: If a job is both preempted and also contains a non-preemption failure, we do not restart the workflow. - -on: - workflow_run: - workflows: [Build and Test libc\+\+] - types: - - completed - -permissions: - contents: read - -jobs: - restart: - if: github.repository_owner == 'llvm' && (github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'cancelled') - name: "Restart Job" - permissions: - statuses: read - checks: write - actions: write - runs-on: ubuntu-latest - steps: - - name: "Restart Job" - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1 - with: - script: | - const failure_regex = /Process completed with exit code 1./ - const preemption_regex = /The runner has received a shutdown signal/ - - const wf_run = context.payload.workflow_run - core.notice(`Running on "${wf_run.display_title}" by @${wf_run.actor.login} (event: ${wf_run.event})\nWorkflow run URL: ${wf_run.html_url}`) - - - async function create_check_run(conclusion, message) { - // Create a check run on the given workflow run to indicate if - // we are restarting the workflow or not. - if (conclusion != 'success' && conclusion != 'skipped' && conclusion != 'neutral') { - core.setFailed('Invalid conclusion: ' + conclusion) - } - await github.rest.checks.create({ - owner: context.repo.owner, - repo: context.repo.repo, - name: 'Restart Preempted Job', - head_sha: wf_run.head_sha, - status: 'completed', - conclusion: conclusion, - output: { - title: 'Restarted Preempted Job', - summary: message - } - }) - } - - console.log('Listing check runs for suite') - const check_suites = await github.rest.checks.listForSuite({ - owner: context.repo.owner, - repo: context.repo.repo, - check_suite_id: context.payload.workflow_run.check_suite_id, - per_page: 100 // FIXME: We don't have 100 check runs yet, but we should handle this better. - }) - - check_run_ids = []; - for (check_run of check_suites.data.check_runs) { - console.log('Checking check run: ' + check_run.id); - if (check_run.status != 'completed') { - console.log('Check run was not completed. Skipping.'); - continue; - } - if (check_run.conclusion != 'failure' && check_run.conclusion != 'cancelled') { - console.log('Check run had conclusion: ' + check_run.conclusion + '. Skipping.'); - continue; - } - check_run_ids.push(check_run.id); - } - - has_preempted_job = false; - - for (check_run_id of check_run_ids) { - console.log('Listing annotations for check run: ' + check_run_id); - - annotations = await github.rest.checks.listAnnotations({ - owner: context.repo.owner, - repo: context.repo.repo, - check_run_id: check_run_id - }) - - for (annotation of annotations.data) { - if (annotation.annotation_level != 'failure') { - continue; - } - - const preemption_match = annotation.message.match(preemption_regex); - - if (preemption_match != null) { - console.log('Found preemption message: ' + annotation.message); - has_preempted_job = true; - } - - const failure_match = annotation.message.match(failure_regex); - if (failure_match != null) { - // We only want to restart the workflow if all of the failures were due to preemption. - // We don't want to restart the workflow if there were other failures. - core.notice('Choosing not to rerun workflow because we found a non-preemption failure' + - 'Failure message: "' + annotation.message + '"'); - await create_check_run('skipped', 'Choosing not to rerun workflow because we found a non-preemption failure\n' - + 'Failure message: ' + annotation.message) - return; - } - } - } - - if (!has_preempted_job) { - core.notice('No preempted jobs found. Not restarting workflow.'); - await create_check_run('neutral', 'No preempted jobs found. Not restarting workflow.') - return; - } - - core.notice("Restarted workflow: " + context.payload.workflow_run.id); - await github.rest.actions.reRunWorkflowFailedJobs({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id - }) - await create_check_run('success', 'Restarted workflow run due to preempted job') diff --git a/.github/workflows/linux-precommit.yml b/.github/workflows/linux-precommit.yml new file mode 100644 index 000000000000..54b555c00663 --- /dev/null +++ b/.github/workflows/linux-precommit.yml @@ -0,0 +1,95 @@ +name: "Linux precommit" + +permissions: + contents: read + +on: + push: + branches: [ "npu/release/19.x" ] + pull_request: + branches: [ "npu/release/19.x" ] + workflow_dispatch: + branches: [ "npu/release/19.x" ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + + +jobs: + Build: + name: Build and Test + runs-on: ubuntu-latest + defaults: + run: + shell: bash + env: + CMAKE_BUILD_TYPE: 'Release' + LLVM_ENABLE_ASSERTIONS: 'ON' + NPU_PLUGIN_LLVM_PROJECT: llvm + NPU_PLUGIN_LLVM_PROJECT_BUILD_DIR: llvm/build + NPU_PLUGIN_LLVM_PROJECT_INSTALL_DIR: llvm/install + steps: + - name: Clone NPU Plugin LLVM sources + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: 'true' + - name: Print system info + run: | + # Install pre-requisites for Fedora + if [[ -e /etc/fedora-release ]]; then + yum update -y -q && yum install -y -q procps + fi + echo "System: ${{ runner.os }}" + echo "System Architecture: ${{ runner.arch }}" + echo "CPU Info: "; lscpu + echo "RAM Info: "; free -h --si + echo "MEMORY Info: "; df -h + + - name: Configure CMake + run: | + cmake \ + -B ${NPU_PLUGIN_LLVM_PROJECT_BUILD_DIR} \ + -S ${NPU_PLUGIN_LLVM_PROJECT} \ + -DCMAKE_INSTALL_PREFIX=${NPU_PLUGIN_LLVM_PROJECT_INSTALL_DIR} \ + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ + -DLLVM_ENABLE_WARNINGS=OFF \ + -DLLVM_ENABLE_BINDINGS=OFF \ + -DLLVM_ENABLE_RTTI=ON \ + -DLLVM_ENABLE_EH=ON \ + -DLLVM_ENABLE_BACKTRACES=ON \ + -DLLVM_ENABLE_CRASH_OVERRIDES=ON \ + -DLLVM_ENABLE_PROJECTS="mlir" \ + -DLLVM_ENABLE_ASSERTIONS=${LLVM_ENABLE_ASSERTIONS} \ + -DLLVM_INCLUDE_TESTS=ON \ + -DLLVM_INCLUDE_BENCHMARKS=OFF \ + -DLLVM_TARGETS_TO_BUILD="host" \ + -DLLVM_ENABLE_TERMINFO=OFF \ + -DLLVM_BUILD_EXAMPLES=OFF \ + -DLLVM_INCLUDE_EXAMPLES=OFF \ + -DLLVM_BUILD_TOOLS=OFF \ + -DLLVM_BUILD_UTILS=ON \ + -DLLVM_INSTALL_UTILS=ON \ + + - name: Build + run: | + cmake \ + --build ${NPU_PLUGIN_LLVM_PROJECT_BUILD_DIR} \ + --config ${CMAKE_BUILD_TYPE} \ + --parallel $(nproc) + + - name: Test LLVM + run: | + cmake \ + --build ${NPU_PLUGIN_LLVM_PROJECT_BUILD_DIR} \ + --config ${CMAKE_BUILD_TYPE} \ + --parallel $(nproc) \ + --target check-llvm + + - name: Test MLIR + run: | + cmake \ + --build ${NPU_PLUGIN_LLVM_PROJECT_BUILD_DIR} \ + --config ${CMAKE_BUILD_TYPE} \ + --parallel $(nproc) \ + --target check-mlir diff --git a/.github/workflows/lld-tests.yml b/.github/workflows/lld-tests.yml deleted file mode 100644 index 599c0975fa68..000000000000 --- a/.github/workflows/lld-tests.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: LLD Tests - -permissions: - contents: read - -on: - workflow_dispatch: - push: - branches: - - 'release/**' - paths: - - 'lld/**' - - '.github/workflows/lld-tests.yml' - - '.github/workflows/llvm-project-tests.yml' - - '!llvm/**' - pull_request: - branches: - - 'release/**' - paths: - - 'lld/**' - - '.github/workflows/lld-tests.yml' - - '.github/workflows/llvm-project-tests.yml' - - '!llvm/**' - -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} - -jobs: - check_lld: - if: github.repository_owner == 'llvm' - name: Test lld - uses: ./.github/workflows/llvm-project-tests.yml - with: - build_target: check-lld - projects: lld diff --git a/.github/workflows/lldb-tests.yml b/.github/workflows/lldb-tests.yml deleted file mode 100644 index 6bb972195625..000000000000 --- a/.github/workflows/lldb-tests.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: lldb Tests - -permissions: - contents: read - -on: - workflow_dispatch: - push: - branches: - - 'release/**' - paths: - - 'lldb/**' - - '.github/workflows/lldb-tests.yml' - - '.github/workflows/llvm-project-tests.yml' - - '!clang/**' - - '!llvm/**' - pull_request: - branches: - - 'release/**' - paths: - - 'lldb/**' - - '.github/workflows/lldb-tests.yml' - - '.github/workflows/llvm-project-tests.yml' - - '!clang/**' - - '!llvm/**' - -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} - -jobs: - build_lldb: - if: github.repository_owner == 'llvm' - name: Build lldb - uses: ./.github/workflows/llvm-project-tests.yml - with: - projects: clang;lldb diff --git a/.github/workflows/llvm-bugs.yml b/.github/workflows/llvm-bugs.yml deleted file mode 100644 index c392078fa452..000000000000 --- a/.github/workflows/llvm-bugs.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: LLVM Bugs notifier - -permissions: - contents: read - issues: read - -on: - issues: - types: - - opened - -jobs: - auto-subscribe: - runs-on: ubuntu-latest - if: github.repository == 'llvm/llvm-project' - steps: - - uses: actions/setup-node@v4 - with: - node-version: 18 - check-latest: true - - run: npm install mailgun.js form-data - - name: Send notification - uses: actions/github-script@v6 - env: - MAILGUN_API_KEY: ${{ secrets.LLVM_BUGS_KEY }} - with: - script: | - const Mailgun = require('mailgun.js'); - const formData = require('form-data'); - - const mailgun = new Mailgun(formData); - const DOMAIN = 'email.llvm.org'; - - const mg = mailgun.client({ username: 'api', key: process.env.MAILGUN_API_KEY }); - - github.rest.issues.get({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo - }) - .then((issue) => { - const payload = { - author : issue.data.user.login, - issue : issue.data.number, - title : issue.data.title, - url : issue.data.html_url, - labels : issue.data.labels.map((label) => label.name), - assignee : issue.data.assignees.map((assignee) => assignee.login), - body : issue.data.body - }; - - const data = { - from: 'LLVM Bugs ', - to: 'llvm-bugs@lists.llvm.org', - subject: `[Bug ${issue.data.number}] ${issue.data.title}`, - template: 'new-github-issue', - 'o:tracking-clicks': 'no', - 'h:X-Mailgun-Variables': JSON.stringify(payload) - }; - - return mg.messages.create(DOMAIN, data); - }) - .then((msg) => console.log(msg)); diff --git a/.github/workflows/llvm-project-tests.yml b/.github/workflows/llvm-project-tests.yml deleted file mode 100644 index fa11f6b9b456..000000000000 --- a/.github/workflows/llvm-project-tests.yml +++ /dev/null @@ -1,154 +0,0 @@ -name: LLVM Project Tests - -permissions: - contents: read - -on: - workflow_dispatch: - inputs: - build_target: - required: false - projects: - required: false - extra_cmake_args: - required: false - os_list: - required: false - default: '["ubuntu-latest", "windows-2019", "macOS-13"]' - python_version: - required: false - type: string - default: '3.11' - workflow_call: - inputs: - build_target: - required: false - type: string - default: "all" - - projects: - required: true - type: string - - extra_cmake_args: - required: false - type: string - - os_list: - required: false - type: string - # Use windows-2019 due to: - # https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317 - # Use ubuntu-22.04 rather than ubuntu-latest to match the ubuntu - # version in the CI container. Without this, setup-python tries - # to install a python version linked against a newer version of glibc. - # TODO(boomanaiden154): Bump the Ubuntu version once the version in the - # container is bumped. - default: '["ubuntu-22.04", "windows-2019", "macOS-13"]' - - python_version: - required: false - type: string - default: '3.11' - -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - # If the group name here is the same as the group name in the workflow that includes - # this one, then the action will try to wait on itself and get stuck. - group: llvm-project-${{ github.workflow }}-${{ inputs.projects }}${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} - -jobs: - lit-tests: - name: Lit Tests - runs-on: ${{ matrix.os }} - container: - image: ${{(startsWith(matrix.os, 'ubuntu') && 'ghcr.io/llvm/ci-ubuntu-22.04:latest') || null}} - volumes: - - /mnt/:/mnt/ - strategy: - fail-fast: false - matrix: - os: ${{ fromJSON(inputs.os_list) }} - steps: - - name: Setup Windows - if: startsWith(matrix.os, 'windows') - uses: llvm/actions/setup-windows@main - with: - arch: amd64 - # On Windows, starting with win19/20220814.1, cmake choose the 32-bit - # python3.10.6 libraries instead of the 64-bit libraries when building - # lldb. Using this setup-python action to make 3.10 the default - # python fixes this. - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: ${{ inputs.python_version }} - - name: Install Ninja - if: runner.os != 'Linux' - uses: llvm/actions/install-ninja@main - # actions/checkout deletes any existing files in the new git directory, - # so this needs to either run before ccache-action or it has to use - # clean: false. - - uses: actions/checkout@v4 - with: - fetch-depth: 250 - - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1 - with: - # A full build of llvm, clang, lld, and lldb takes about 250MB - # of ccache space. There's not much reason to have more than this, - # because we usually won't need to save cache entries from older - # builds. Also, there is an overall 10GB cache limit, and each - # run creates a new cache entry so we want to ensure that we have - # enough cache space for all the tests to run at once and still - # fit under the 10 GB limit. - # Default to 2G to workaround: https://github.com/hendrikmuhs/ccache-action/issues/174 - max-size: 2G - key: ${{ matrix.os }} - variant: sccache - - name: Build and Test - env: - # Workaround for https://github.com/actions/virtual-environments/issues/5900. - # This should be a no-op for non-mac OSes - PKG_CONFIG_PATH: /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig//12 - shell: bash - id: build-llvm - run: | - if [ "${{ runner.os }}" == "Linux" ]; then - builddir="/mnt/build/" - sudo mkdir -p $builddir - sudo chown gha $builddir - extra_cmake_args="-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang" - else - builddir="$(pwd)"/build - fi - if [ "${{ runner.os }}" == "macOS" ]; then - # Workaround test failure on some lld tests on MacOS - # https://github.com/llvm/llvm-project/issues/81967 - extra_cmake_args="-DLLVM_DISABLE_ASSEMBLY_FILES=ON" - fi - echo "llvm-builddir=$builddir" >> "$GITHUB_OUTPUT" - cmake -G Ninja \ - -B "$builddir" \ - -S llvm \ - -DLLVM_ENABLE_PROJECTS="${{ inputs.projects }}" \ - -DCMAKE_BUILD_TYPE=Release \ - -DLLVM_ENABLE_ASSERTIONS=ON \ - -DLLDB_INCLUDE_TESTS=OFF \ - -DLIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl" \ - -DCMAKE_C_COMPILER_LAUNCHER=sccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ - $extra_cmake_args \ - ${{ inputs.extra_cmake_args }} - ninja -C "$builddir" '${{ inputs.build_target }}' - - - name: Build and Test libclc - if: "!startsWith(matrix.os, 'windows') && contains(inputs.projects, 'libclc')" - env: - LLVM_BUILDDIR: ${{ steps.build-llvm.outputs.llvm-builddir }} - run: | - # The libclc tests don't have a generated check target so all we can - # do is build it. - ninja -C "$LLVM_BUILDDIR" diff --git a/.github/workflows/llvm-project-workflow-tests.yml b/.github/workflows/llvm-project-workflow-tests.yml deleted file mode 100644 index a2539b279be0..000000000000 --- a/.github/workflows/llvm-project-workflow-tests.yml +++ /dev/null @@ -1,32 +0,0 @@ -# This workflow will test the llvm-project-tests workflow in PRs -# targetting the main branch. Since this workflow doesn't normally -# run on main PRs, we need some way to test it to ensure new updates -# don't break it. - -name: LLVM Workflow Test - -permissions: - contents: read - -on: - pull_request: - branches: - - 'main' - paths: - - '.github/workflows/llvm-project-tests.yml' - - '.github/workflows/llvm-project-workflow-tests.yml' - -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} - -jobs: - llvm-test: - if: github.repository_owner == 'llvm' - name: Build and Test - uses: ./.github/workflows/llvm-project-tests.yml - with: - build_target: check-all - projects: clang;lld;libclc;lldb diff --git a/.github/workflows/llvm-tests.yml b/.github/workflows/llvm-tests.yml deleted file mode 100644 index 26e644229aaa..000000000000 --- a/.github/workflows/llvm-tests.yml +++ /dev/null @@ -1,192 +0,0 @@ -name: LLVM Tests - -permissions: - contents: read - -on: - workflow_dispatch: - push: - branches: - - 'release/**' - paths: - - 'llvm/**' - - '.github/workflows/llvm-tests.yml' - - '.github/workflows/llvm-project-tests.yml' - pull_request: - branches: - - 'release/**' - paths: - - 'llvm/**' - - '.github/workflows/llvm-tests.yml' - - '.github/workflows/llvm-project-tests.yml' - -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} - -jobs: - check-all: - if: github.repository_owner == 'llvm' - name: Build and Test - uses: ./.github/workflows/llvm-project-tests.yml - with: - build_target: check-all - projects: clang;lld;libclc;lldb - - abi-dump-setup: - if: github.repository_owner == 'llvm' - runs-on: ubuntu-latest - outputs: - BASELINE_REF: ${{ steps.vars.outputs.BASELINE_REF }} - ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }} - BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }} - BASELINE_VERSION_MINOR: ${{ steps.vars.outputs.BASELINE_VERSION_MINOR }} - LLVM_VERSION_MAJOR: ${{ steps.version.outputs.major }} - LLVM_VERSION_MINOR: ${{ steps.version.outputs.minor }} - LLVM_VERSION_PATCH: ${{ steps.version.outputs.patch }} - steps: - - name: Checkout source - uses: actions/checkout@v4 - with: - fetch-depth: 250 - - - name: Get LLVM version - id: version - uses: ./.github/workflows/get-llvm-version - - - name: Setup Variables - id: vars - run: | - # C++ ABI: - # 18.1.0 we aren't doing ABI checks. - # 18.1.1 We want to check 18.1.0. - # C ABI: - # 18.1.0 We want to check 17.0.x - # 18.1.1 We want to check 18.1.0 - echo "BASELINE_VERSION_MINOR=1" >> "$GITHUB_OUTPUT" - if [ ${{ steps.version.outputs.patch }} -eq 0 ]; then - { - echo "BASELINE_VERSION_MAJOR=$(( ${{ steps.version.outputs.major }} - 1))" - echo "ABI_HEADERS=llvm-c" - } >> "$GITHUB_OUTPUT" - else - { - echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.major }}" - echo "ABI_HEADERS=." - } >> "$GITHUB_OUTPUT" - fi - - abi-dump: - if: github.repository_owner == 'llvm' - needs: abi-dump-setup - runs-on: ubuntu-latest - strategy: - matrix: - name: - - build-baseline - - build-latest - include: - - name: build-baseline - llvm_version_major: ${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }} - ref: llvmorg-${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}.${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MINOR }}.0 - repo: llvm/llvm-project - - name: build-latest - llvm_version_major: ${{ needs.abi-dump-setup.outputs.LLVM_VERSION_MAJOR }} - ref: ${{ github.sha }} - repo: ${{ github.repository }} - steps: - - name: Install Ninja - uses: llvm/actions/install-ninja@main - - name: Install abi-compliance-checker - run: | - sudo apt-get install abi-dumper autoconf pkg-config - - name: Install universal-ctags - run: | - git clone https://github.com/universal-ctags/ctags.git - cd ctags - ./autogen.sh - ./configure - sudo make install - - name: Download source code - uses: llvm/actions/get-llvm-project-src@main - with: - ref: ${{ matrix.ref }} - repo: ${{ matrix.repo }} - - name: Configure - run: | - mkdir install - cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="" -DLLVM_BUILD_LLVM_DYLIB=ON -DCMAKE_C_FLAGS_DEBUG="-g1 -Og" -DCMAKE_CXX_FLAGS_DEBUG="-g1 -Og" -DCMAKE_INSTALL_PREFIX="$(pwd)"/install llvm - - name: Build - # Need to run install-LLVM twice to ensure the symlink is installed (this is a bug). - run: | - ninja -C build install-LLVM - ninja -C build install-LLVM - ninja -C build install-llvm-headers - - name: Dump ABI - run: | - if [ "${{ needs.abi-dump-setup.outputs.ABI_HEADERS }}" = "llvm-c" ]; then - nm ./install/lib/libLLVM.so | awk "/T _LLVM/ || /T LLVM/ { print $3 }" | sort -u | sed -e "s/^_//g" | cut -d ' ' -f 3 > llvm.symbols - # Even though the -symbols-list option doesn't seem to filter out the symbols, I believe it speeds up processing, so I'm leaving it in. - export EXTRA_ARGS="-symbols-list llvm.symbols" - else - touch llvm.symbols - fi - abi-dumper $EXTRA_ARGS -lver ${{ matrix.ref }} -skip-cxx -public-headers ./install/include/${{ needs.abi-dump-setup.outputs.ABI_HEADERS }} -o ${{ matrix.ref }}.abi ./install/lib/libLLVM.so - # Remove symbol versioning from dumps, so we can compare across major versions. - sed -i 's/LLVM_${{ matrix.llvm_version_major }}/LLVM_NOVERSION/' ${{ matrix.ref }}.abi - - name: Upload ABI file - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.name }} - path: ${{ matrix.ref }}.abi - - - name: Upload symbol list file - if: matrix.name == 'build-baseline' - uses: actions/upload-artifact@v3 - with: - name: symbol-list - path: llvm.symbols - - abi-compare: - if: github.repository_owner == 'llvm' - runs-on: ubuntu-latest - needs: - - abi-dump-setup - - abi-dump - steps: - - name: Download baseline - uses: actions/download-artifact@v3 - with: - name: build-baseline - path: build-baseline - - name: Download latest - uses: actions/download-artifact@v3 - with: - name: build-latest - path: build-latest - - name: Download symbol list - uses: actions/download-artifact@v3 - with: - name: symbol-list - path: symbol-list - - - name: Install abi-compliance-checker - run: sudo apt-get install abi-compliance-checker - - name: Compare ABI - run: | - if [ -s symbol-list/llvm.symbols ]; then - # This option doesn't seem to work with the ABI dumper, so passing it here. - export EXTRA_ARGS="-symbols-list symbol-list/llvm.symbols" - fi - # FIXME: Reading of gzip'd abi files on the GitHub runners stop - # working some time in March of 2021, likely due to a change in the - # runner's environment. - abi-compliance-checker $EXTRA_ARGS -l libLLVM.so -old build-baseline/*.abi -new build-latest/*.abi || test "${{ needs.abi-dump-setup.outputs.ABI_HEADERS }}" = "llvm-c" - - name: Upload ABI Comparison - if: always() - uses: actions/upload-artifact@v3 - with: - name: compat-report-${{ github.sha }} - path: compat_reports/ diff --git a/.github/workflows/merged-prs.yml b/.github/workflows/merged-prs.yml deleted file mode 100644 index e29afd4097f9..000000000000 --- a/.github/workflows/merged-prs.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: "Add buildbot information to first PRs from new contributors" - -permissions: - contents: read - -on: - # It's safe to use pull_request_target here, because we aren't checking out - # code from the pull request branch. - # See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ - pull_request_target: - types: - - closed - -jobs: - buildbot_comment: - runs-on: ubuntu-latest - permissions: - pull-requests: write - if: >- - (github.repository == 'llvm/llvm-project') && - (github.event.pull_request.merged == true) - steps: - - name: Checkout Automation Script - uses: actions/checkout@v4 - with: - sparse-checkout: llvm/utils/git/ - ref: main - - - name: Setup Automation Script - working-directory: ./llvm/utils/git/ - run: | - pip install --require-hashes -r requirements.txt - - - name: Add Buildbot information comment - working-directory: ./llvm/utils/git/ - run: | - python3 ./github-automation.py \ - --token '${{ secrets.GITHUB_TOKEN }}' \ - pr-buildbot-information \ - --issue-number "${{ github.event.pull_request.number }}" \ - --author "${{ github.event.pull_request.user.login }}" diff --git a/.github/workflows/new-issues.yml b/.github/workflows/new-issues.yml deleted file mode 100644 index ed15fdb9fba6..000000000000 --- a/.github/workflows/new-issues.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Labeling new issues -on: - issues: - types: ['opened'] - -permissions: - contents: read - -jobs: - automate-issues-labels: - permissions: - issues: write - runs-on: ubuntu-latest - if: github.repository == 'llvm/llvm-project' - steps: - - uses: llvm/actions/issue-labeler@main - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - configuration-path: .github/new-issues-labeler.yml - include-title: 1 - include-body: 0 - sync-labels: 0 - enable-versioned-regex: 0 diff --git a/.github/workflows/new-prs.yml b/.github/workflows/new-prs.yml deleted file mode 100644 index 88175d6f8d64..000000000000 --- a/.github/workflows/new-prs.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: "Labelling new pull requests" - -permissions: - contents: read - -on: - # It's safe to use pull_request_target here, because we aren't checking out - # code from the pull request branch. - # See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ - pull_request_target: - types: - - opened - - reopened - - ready_for_review - - synchronize - -jobs: - greeter: - runs-on: ubuntu-latest - permissions: - pull-requests: write - # Only comment on PRs that have been opened for the first time, by someone - # new to LLVM or to GitHub as a whole. Ideally we'd look for FIRST_TIMER - # or FIRST_TIME_CONTRIBUTOR, but this does not appear to work. Instead check - # that we do not have any of the other author associations. - # See https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=opened#pull_request - # for all the possible values. - if: >- - (github.repository == 'llvm/llvm-project') && - (github.event.action == 'opened') && - (github.event.pull_request.author_association != 'COLLABORATOR') && - (github.event.pull_request.author_association != 'CONTRIBUTOR') && - (github.event.pull_request.author_association != 'MANNEQUIN') && - (github.event.pull_request.author_association != 'MEMBER') && - (github.event.pull_request.author_association != 'OWNER') - steps: - - name: Checkout Automation Script - uses: actions/checkout@v4 - with: - sparse-checkout: llvm/utils/git/ - ref: main - - - name: Setup Automation Script - working-directory: ./llvm/utils/git/ - run: | - pip install --require-hashes -r requirements.txt - - - name: Greet Author - working-directory: ./llvm/utils/git/ - run: | - python3 ./github-automation.py \ - --token '${{ secrets.GITHUB_TOKEN }}' \ - pr-greeter \ - --issue-number "${{ github.event.pull_request.number }}" - - automate-prs-labels: - # Greet first so that only the author gets that notification. - needs: greeter - runs-on: ubuntu-latest - # Ignore PRs with more than 10 commits. Pull requests with a lot of - # commits tend to be accidents usually when someone made a mistake while trying - # to rebase. We want to ignore these pull requests to avoid excessive - # notifications. - # always() means that even if greeter is skipped, this job will run. - if: > - always() && github.repository == 'llvm/llvm-project' && - github.event.pull_request.draft == false && - github.event.pull_request.commits < 10 - steps: - - uses: actions/labeler@v4 - with: - configuration-path: .github/new-prs-labeler.yml - # workaround for https://github.com/actions/labeler/issues/112 - sync-labels: '' - repo-token: ${{ secrets.ISSUE_SUBSCRIBER_TOKEN }} diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index 22357e5d99e4..e34872160c6f 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -1,25 +1,30 @@ name: "Check code formatting" -permissions: - contents: read - on: pull_request: branches: - - main + - npu/release/19.x + +permissions: + contents: read jobs: code_formatter: runs-on: ubuntu-latest - if: github.repository == 'llvm/llvm-project' + if: (github.repository == 'llvm/llvm-project' || github.repository == 'intel/npu-plugin-llvm') && !contains(github.event.pull_request.labels.*.name, 'disable-lint') steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit + - name: Fetch LLVM sources - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: ref: ${{ github.event.pull_request.head.sha }} - name: Checkout through merge base - uses: rmacklin/fetch-through-merge-base@v0 + uses: rmacklin/fetch-through-merge-base@bfe4d03a86f9afa52bc1a70e9814fc92a07f7b75 # v0.3.0 with: base_ref: ${{ github.event.pull_request.base.ref }} head_ref: ${{ github.event.pull_request.head.sha }} @@ -27,18 +32,17 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v39 + uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6 with: separator: "," skip_initial_fetch: true - # We need to pull the script from the main branch, so that we ensure - # we get the latest version of this script. + # We need to make sure that we aren't executing/using any code from the + # PR for security reasons as we're using pull_request_target. Checkout + # the target branch with the necessary files. - name: Fetch code formatting utils - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: - repository: ${{ github.repository }} - ref: ${{ github.base_ref }} sparse-checkout: | llvm/utils/git/requirements_formatting.txt llvm/utils/git/code-format-helper.py @@ -53,12 +57,12 @@ jobs: echo "$CHANGED_FILES" - name: Install clang-format - uses: aminya/setup-cpp@v1 + uses: aminya/setup-cpp@12e62a1b8da8f1e66acc75305a2621234ef49dd0 # v1 with: - clangformat: 18.1.7 + clangformat: 17.0.1 - name: Setup Python env - uses: actions/setup-python@v5 + uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 with: python-version: '3.11' cache: 'pip' @@ -77,20 +81,10 @@ jobs: # to take advantage of the new --diff_from_common_commit option # explicitly in code-format-helper.py and not have to diff starting at # the merge base. - # Create an empty comments file so the pr-write job doesn't fail. run: | - echo "[]" > comments && python ./code-format-tools/llvm/utils/git/code-format-helper.py \ - --write-comment-to-file \ --token ${{ secrets.GITHUB_TOKEN }} \ --issue-number $GITHUB_PR_NUMBER \ --start-rev $(git merge-base $START_REV $END_REV) \ --end-rev $END_REV \ - --changed-files "$CHANGED_FILES" - - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0 - if: always() - with: - name: workflow-args - path: | - comments + --changed-files "$CHANGED_FILES" \ No newline at end of file diff --git a/.github/workflows/pr-request-release-note.yml b/.github/workflows/pr-request-release-note.yml deleted file mode 100644 index 2fa501dda16b..000000000000 --- a/.github/workflows/pr-request-release-note.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: PR Request Release Note - -permissions: - contents: read - -on: - pull_request: - types: - - closed - -jobs: - request-release-note: - if: >- - github.repository_owner == 'llvm' && - startsWith(github.ref, 'refs/heads/release') - - runs-on: ubuntu-latest - steps: - # We need to pull the script from the main branch, so that we ensure - # we get the latest version of this script. - - name: Checkout Scripts - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - sparse-checkout: | - llvm/utils/git/requirements.txt - llvm/utils/git/github-automation.py - sparse-checkout-cone-mode: false - - - name: Install Dependencies - run: | - pip install --require-hashes -r llvm/utils/git/requirements.txt - - - name: Request Release Note - env: - # We need to use an llvmbot token here, because we are mentioning a user. - GITHUB_TOKEN: ${{ github.token }} - run: | - python3 llvm/utils/git/github-automation.py \ - --repo "$GITHUB_REPOSITORY" \ - --token "$GITHUB_TOKEN" \ - request-release-note \ - --pr-number ${{ github.event.pull_request.number}} - - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0 - if: always() - with: - name: workflow-args - path: | - comments diff --git a/.github/workflows/pr-subscriber.yml b/.github/workflows/pr-subscriber.yml deleted file mode 100644 index 272d3e2f9ef8..000000000000 --- a/.github/workflows/pr-subscriber.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: PR Subscriber - -on: - pull_request_target: - types: - - labeled - -permissions: - contents: read - -jobs: - auto-subscribe: - runs-on: ubuntu-latest - if: github.repository == 'llvm/llvm-project' - steps: - - name: Checkout Automation Script - uses: actions/checkout@v4 - with: - sparse-checkout: llvm/utils/git/ - ref: main - - - name: Setup Automation Script - working-directory: ./llvm/utils/git/ - run: | - pip install --require-hashes -r requirements.txt - - - name: Update watchers - working-directory: ./llvm/utils/git/ - run: | - python3 ./github-automation.py \ - --token '${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}' \ - pr-subscriber \ - --issue-number "${{ github.event.number }}" \ - --label-name "${{ github.event.label.name }}" diff --git a/.github/workflows/release-binaries-all.yml b/.github/workflows/release-binaries-all.yml deleted file mode 100644 index 394b0c74d24e..000000000000 --- a/.github/workflows/release-binaries-all.yml +++ /dev/null @@ -1,98 +0,0 @@ -name: Release Binaries All - -permissions: - contents: read # Default everything to read-only - -on: - workflow_dispatch: - inputs: - release-version: - description: 'Release Version' - required: true - type: string - upload: - description: 'Upload binaries to the release page' - required: true - default: false - type: boolean - - workflow_call: - inputs: - release-version: - description: 'Release Version' - required: true - type: string - upload: - description: 'Upload binaries to the release page' - required: true - default: false - type: boolean - - pull_request: - types: - - opened - - synchronize - - reopened - # When a PR is closed, we still start this workflow, but then skip - # all the jobs, which makes it effectively a no-op. The reason to - # do this is that it allows us to take advantage of concurrency groups - # to cancel in progress CI jobs whenever the PR is closed. - - closed - paths: - - '.github/workflows/release-binaries-all.yml' - - '.github/workflows/release-binaries.yml' - - '.github/workflows/release-binaries-setup-stage/*' - - '.github/workflows/release-binaries-save-stage/*' - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || 'dispatch' }} - cancel-in-progress: True - -jobs: - setup-variables: - if: >- - (github.event_name != 'pull_request' || github.event.action != 'closed') - runs-on: ubuntu-22.04 - outputs: - release-version: ${{ steps.vars.outputs.release-version }} - upload: ${{ steps.vars.outputs.upload }} - steps: - - shell: bash - id: vars - run: | - upload="${{ inputs.upload }}" - release_version="${{ inputs.release-version }}" - if [ "${{ github.event_name }}" = "pull_request" ]; then - upload="false" - release_version="" - fi - echo "release-version=$release_version" >> "$GITHUB_OUTPUT" - echo "upload=$upload" >> "$GITHUB_OUTPUT" - - release-binaries-all: - name: Build Release Binaries - needs: - - setup-variables - permissions: - contents: write # For release uploads - id-token: write # For artifact attestations - attestations: write # For artifact attestations - strategy: - fail-fast: false - matrix: - runs-on: - - ubuntu-22.04 - - windows-2022 - - macos-13 - - macos-14 - - uses: ./.github/workflows/release-binaries.yml - with: - release-version: "${{ needs.setup-variables.outputs.release-version }}" - upload: ${{ needs.setup-variables.outputs.upload == 'true'}} - runs-on: "${{ matrix.runs-on }}" - secrets: - # This will be empty for pull_request events, but that's fine, because - # the release-binaries workflow does not use this secret for the - # pull_request event. - RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} diff --git a/.github/workflows/release-binaries-save-stage/action.yml b/.github/workflows/release-binaries-save-stage/action.yml deleted file mode 100644 index f08088c7bc56..000000000000 --- a/.github/workflows/release-binaries-save-stage/action.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Save Stage -description: >- - Upload the source and binary directories from a build stage so that they - can be re-used in the next stage. This action is used to the release - binaries workflow into multiple stages to avoid the 6 hour timeout on - the GitHub hosted runners. -inputs: - build-prefix: - description: "Directory containing the build directory." - required: true - type: 'string' - -permissions: - contents: read - -runs: - using: "composite" - steps: - # We need to create an archive of the build directory, because it has too - # many files to upload. - - name: Package Build and Source Directories - shell: bash - run: | - # Remove .git/config to avoid leaking GITHUB_TOKEN stored there. - # See https://unit42.paloaltonetworks.com/github-repo-artifacts-leak-tokens/ - rm -Rf .git/config - # Windows does not support symlinks, so we need to dereference them. - tar --exclude build/ ${{ (runner.os == 'Windows' && '-h') || '' }} -c . | zstd -T0 -c > ../llvm-project.tar.zst - mv ../llvm-project.tar.zst . - tar -C ${{ inputs.build-prefix }} -c build/ | zstd -T0 -c > build.tar.zst - - - name: Upload Stage 1 Source - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0 - with: - name: ${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-source - path: llvm-project.tar.zst - retention-days: 2 - - - name: Upload Stage 1 Build Dir - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0 - with: - name: ${{ runner.os}}-${{ runner.arch }}-${{ github.job }}-build - path: build.tar.zst - retention-days: 2 diff --git a/.github/workflows/release-binaries-setup-stage/action.yml b/.github/workflows/release-binaries-setup-stage/action.yml deleted file mode 100644 index f5e5db27e659..000000000000 --- a/.github/workflows/release-binaries-setup-stage/action.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Setup Stage -description: >- - Setup the next stage of the release binaries workflow. This sets up the - environment correctly for a new stage of the release binaries workflow - and also restores the source and build directory from the previous stage. - -inputs: - previous-artifact: - description: >- - A unique descriptor for the artifact from the previous stage. This will - be used to construct the final artifact pattern, which is: - $RUNNER_OS-$RUNNER_ARCH-$PREVIOUS_ARTIFACT-* - required: false - type: 'string' - -outputs: - build-prefix: - description: "Directory containing the build directory." - value: ${{ steps.build-prefix.outputs.build-prefix }} - -runs: - using: "composite" - steps: - - name: Install Ninja - uses: llvm/actions/install-ninja@22e9f909d35b50bd1181709564bfe816eaeaae81 # main - - - name: Setup Windows - if: startsWith(runner.os, 'Windows') - uses: llvm/actions/setup-windows@main - with: - arch: amd64 - - - name: Set Build Prefix - id: build-prefix - shell: bash - run: | - build_prefix=`pwd` - if [ "${{ runner.os }}" = "Linux" ]; then - sudo chown $USER:$USER /mnt/ - build_prefix=/mnt/ - fi - echo "build-prefix=$build_prefix" >> $GITHUB_OUTPUT - - - name: Download Previous Stage Artifact - if: ${{ inputs.previous-artifact }} - id: download - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 - with: - pattern: ${{ runner.os }}-${{ runner.arch }}-${{ inputs.previous-artifact }}-* - merge-multiple: true - - - name: Unpack Artifact - if: ${{ steps.download.outputs.download-path }} - shell: bash - run: | - tar --zstd -xf llvm-project.tar.zst - rm llvm-project.tar.zst - tar --zstd -C ${{ steps.build-prefix.outputs.build-prefix}} -xf build.tar.zst - rm build.tar.zst diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml deleted file mode 100644 index f24e25879b96..000000000000 --- a/.github/workflows/release-binaries.yml +++ /dev/null @@ -1,492 +0,0 @@ -name: Release Binaries - -on: - workflow_dispatch: - inputs: - release-version: - description: 'Release Version' - required: false - type: string - upload: - description: 'Upload binaries to the release page' - required: true - default: false - type: boolean - runs-on: - description: "Runner to use for the build" - required: true - type: choice - options: - - ubuntu-22.04 - - windows-2022 - - macos-13 - - macos-14 - - workflow_call: - inputs: - release-version: - description: 'Release Version' - required: false - type: string - upload: - description: 'Upload binaries to the release page' - required: true - default: false - type: boolean - runs-on: - description: "Runner to use for the build" - required: true - type: string - secrets: - RELEASE_TASKS_USER_TOKEN: - description: "Secret used to check user permissions." - required: false - - -permissions: - contents: read # Default everything to read-only - -jobs: - prepare: - name: Prepare to build binaries - runs-on: ${{ inputs.runs-on }} - if: github.repository == 'llvm/llvm-project' - outputs: - release-version: ${{ steps.vars.outputs.release-version }} - ref: ${{ steps.vars.outputs.ref }} - upload: ${{ steps.vars.outputs.upload }} - target-cmake-flags: ${{ steps.vars.outputs.target-cmake-flags }} - build-flang: ${{ steps.vars.outputs.build-flang }} - enable-pgo: ${{ steps.vars.outputs.enable-pgo }} - release-binary-basename: ${{ steps.vars.outputs.release-binary-basename }} - release-binary-filename: ${{ steps.vars.outputs.release-binary-filename }} - - steps: - # It's good practice to use setup-python, but this is also required on macos-14 - # due to https://github.com/actions/runner-images/issues/10385 - - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f - with: - python-version: '3.12' - - - name: Checkout LLVM - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Install Dependencies - shell: bash - run: | - pip install --require-hashes -r ./llvm/utils/git/requirements.txt - - - name: Check Permissions - if: github.event_name != 'pull_request' - env: - GITHUB_TOKEN: ${{ github.token }} - USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} - shell: bash - run: | - ./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} --user-token "$USER_TOKEN" check-permissions - - - name: Collect Variables - id: vars - shell: bash - # In order for the test-release.sh script to run correctly, the LLVM - # source needs to be at the following location relative to the build dir: - # | X.Y.Z-rcN | ./rcN/llvm-project - # | X.Y.Z | ./final/llvm-project - # - # We also need to set divergent flags based on the release version: - # | X.Y.Z-rcN | -rc N -test-asserts - # | X.Y.Z | -final - run: | - trimmed=$(echo ${{ inputs.release-version }} | xargs) - if [ -n "$trimmed" ]; then - release_version="$trimmed" - ref="llvmorg-$release_version" - else - release_version="${{ (github.event_name == 'pull_request' && format('PR{0}', github.event.pull_request.number)) || 'CI'}}-${{ github.sha }}" - ref=${{ github.sha }} - fi - if [ -n "${{ inputs.upload }}" ]; then - upload="${{ inputs.upload }}" - else - upload="false" - fi - echo "release-version=$release_version">> $GITHUB_OUTPUT - echo "ref=$ref" >> $GITHUB_OUTPUT - echo "upload=$upload" >> $GITHUB_OUTPUT - - release_binary_basename="LLVM-$release_version-${{ runner.os }}-${{ runner.arch }}" - echo "release-binary-basename=$release_binary_basename" >> $GITHUB_OUTPUT - echo "release-binary-filename=$release_binary_basename.tar.xz" >> $GITHUB_OUTPUT - - # Detect necessary CMake flags - target="${{ runner.os }}-${{ runner.arch }}" - echo "enable-pgo=false" >> $GITHUB_OUTPUT - target_cmake_flags="-DLLVM_RELEASE_ENABLE_PGO=OFF" - # The macOS builds try to cross compile some libraries so we need to - # add extra CMake args to disable them. - # See https://github.com/llvm/llvm-project/issues/99767 - if [ "${{ runner.os }}" = "macOS" ]; then - target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF" - if [ "${{ runner.arch }}" = "ARM64" ]; then - arches=arm64 - else - arches=x86_64 - fi - target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_DARWIN_osx_ARCHS=$arches -DBOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches" - fi - - build_flang="true" - - if [ "${{ runner.os }}" = "Windows" ]; then - # The build times out on Windows, so we need to disable LTO. - target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF" - fi - - echo "target-cmake-flags=$target_cmake_flags" >> $GITHUB_OUTPUT - echo "build-flang=$build_flang" >> $GITHUB_OUTPUT - - build-stage1: - name: "Build Stage 1" - needs: prepare - if: github.repository == 'llvm/llvm-project' - runs-on: ${{ inputs.runs-on }} - steps: - - - name: Checkout Actions - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }} - sparse-checkout: | - .github/workflows/ - sparse-checkout-cone-mode: false - # Check out outside of working directory so the source checkout doesn't - # remove it. - path: workflows - - # actions/checkout does not support paths outside of the GITHUB_WORKSPACE. - # Also, anything that we put inside of GITHUB_WORKSPACE will be overwritten - # by future actions/checkout steps. Therefore, in order to checkout the - # latest actions from main, we need to first checkout out the actions inside of - # GITHUB_WORKSPACE (see previous step), then use actions/checkout to checkout - # the code being built and the move the actions from main back into GITHUB_WORKSPACE, - # becasue the uses on composite actions only reads workflows from inside GITHUB_WORKSPACE. - - shell: bash - run: mv workflows ../workflows-main - - - name: Checkout LLVM - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ needs.prepare.outputs.ref }} - - - name: Copy main workflows - shell: bash - run: | - mv ../workflows-main . - - - name: Setup Stage - id: setup-stage - uses: ./workflows-main/.github/workflows/release-binaries-setup-stage - - - name: Setup sccache - uses: hendrikmuhs/ccache-action@ca3acd2731eef11f1572ccb126356c2f9298d35e # v1.2.9 - with: - # Default to 2G to workaround: https://github.com/hendrikmuhs/ccache-action/issues/174 - max-size: 2G - key: sccache-${{ runner.os }}-${{ runner.arch }}-release - variant: sccache - - - name: Build Stage 1 Clang - id: build - shell: bash - run: | - # There were some issues on the ARM64 MacOS runners with trying to build x86 object, - # so we need to set some extra cmake flags to disable this. - cmake -G Ninja -S llvm -B ${{ steps.setup-stage.outputs.build-prefix }}/build \ - ${{ needs.prepare.outputs.target-cmake-flags }} \ - -C clang/cmake/caches/Release.cmake \ - -DBOOTSTRAP_LLVM_PARALLEL_LINK_JOBS=1 \ - -DBOOTSTRAP_CPACK_PACKAGE_FILE_NAME="${{ needs.prepare.outputs.release-binary-basename }}" \ - -DCMAKE_C_COMPILER_LAUNCHER=sccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=sccache - ninja -v -C ${{ steps.setup-stage.outputs.build-prefix }}/build - # There is a race condition on the MacOS builders and this command is here - # to help debug that when it happens. - ls -ltr ${{ steps.setup-stage.outputs.build-prefix }}/build - - - name: Save Stage - uses: ./workflows-main/.github/workflows/release-binaries-save-stage - with: - build-prefix: ${{ steps.setup-stage.outputs.build-prefix }} - - build-stage2: - name: "Build Stage 2" - needs: - - prepare - - build-stage1 - if: github.repository == 'llvm/llvm-project' - runs-on: ${{ inputs.runs-on }} - steps: - - name: Checkout Actions - uses: actions/checkout@v4 - with: - ref: ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }} - sparse-checkout: | - .github/workflows/ - sparse-checkout-cone-mode: false - path: workflows - - name: Setup Stage - id: setup-stage - uses: ./workflows/.github/workflows/release-binaries-setup-stage - with: - previous-artifact: build-stage1 - - - name: Build Stage 2 - # Re-enable once PGO builds are supported. - if: needs.prepare.outputs.enable-pgo == 'true' - shell: bash - run: | - ninja -C ${{ steps.setup-stage.outputs.build-prefix}}/build stage2-instrumented - - - name: Save Stage - uses: ./workflows/.github/workflows/release-binaries-save-stage - with: - build-prefix: ${{ steps.setup-stage.outputs.build-prefix }} - - build-stage3-clang: - name: "Build Stage 3 LLVM/Clang" - needs: - - prepare - - build-stage2 - if: github.repository == 'llvm/llvm-project' - runs-on: ${{ inputs.runs-on }} - steps: - - name: Checkout Actions - uses: actions/checkout@v4 - with: - ref: ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }} - sparse-checkout: | - .github/workflows/ - sparse-checkout-cone-mode: false - path: workflows - - name: Setup Stage - id: setup-stage - uses: ./workflows/.github/workflows/release-binaries-setup-stage - with: - previous-artifact: build-stage2 - - - name: Build LLVM/Clang - shell: bash - run: | - # There is a race condition on the MacOS builders and this command is here - # to help debug that when it happens. - ls -ltr ${{ steps.setup-stage.outputs.build-prefix }}/build - ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-clang - # Build some of the larger binaries here too. - ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/ \ - clang-scan-deps \ - modularize clangd \ - clangd-indexer \ - clang-check \ - ${{ (runner.os == 'Linux' && 'clangd-fuzzer') || '' }} \ - clang-tidy \ - llc \ - lli \ - llvm-exegesis \ - llvm-opt-fuzzer \ - llvm-reduce \ - llvm-lto \ - dsymutil - - - name: Save Stage - uses: ./workflows/.github/workflows/release-binaries-save-stage - with: - build-prefix: ${{ steps.setup-stage.outputs.build-prefix }} - - build-stage3-flang: - name: "Build Stage 3 Flang/MLIR/Bolt" - needs: - - prepare - - build-stage3-clang - runs-on: ${{ inputs.runs-on }} - steps: - - name: Checkout Actions - uses: actions/checkout@v4 - with: - ref: ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }} - sparse-checkout: | - .github/workflows/ - sparse-checkout-cone-mode: false - path: workflows - - name: Setup Stage - id: setup-stage - uses: ./workflows/.github/workflows/release-binaries-setup-stage - with: - previous-artifact: build-stage3-clang - - - name: Build Flang / MLIR / Bolt - shell: bash - run: | - # Build some of the mlir tools that take a long time to link - if [ "${{ needs.prepare.outputs.build-flang }}" = "true" ]; then - ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/ -j2 flang-new bbc - fi - ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/ \ - mlir-bytecode-parser-fuzzer \ - mlir-cpu-runner \ - mlir-lsp-server \ - mlir-opt \ - mlir-query \ - mlir-reduce \ - mlir-text-parser-fuzzer \ - mlir-translate \ - mlir-transform-opt \ - mlir-cat \ - mlir-minimal-opt \ - mlir-minimal-opt-canonicalize \ - mlir-pdll-lsp-server \ - llvm-bolt \ - llvm-bolt-heatmap - - - name: Save Stage - uses: ./workflows/.github/workflows/release-binaries-save-stage - with: - build-prefix: ${{ steps.setup-stage.outputs.build-prefix }} - - build-stage3-all: - name: "Build Stage 3" - needs: - - prepare - - build-stage3-flang - runs-on: ${{ inputs.runs-on }} - steps: - - name: Checkout Actions - uses: actions/checkout@v4 - with: - ref: ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }} - sparse-checkout: | - .github/workflows/ - sparse-checkout-cone-mode: false - path: workflows - - name: Setup Stage - id: setup-stage - uses: ./workflows/.github/workflows/release-binaries-setup-stage - with: - previous-artifact: build-stage3-flang - - - name: Build Release Package - shell: bash - run: | - which cmake - ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-package - # Copy Release artifact to the workspace so it is easier to upload. - # This is necessary, because on Windows, the build-prefix path can - # only be used on bash steps, because it uses the form of /d/files/ - # and other steps expect D:\files. - mv ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/${{ needs.prepare.outputs.release-binary-filename }} . - - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0 - with: - name: ${{ runner.os }}-${{ runner.arch }}-release-binary - # Due to path differences on Windows when running in bash vs running on node, - # we need to search for files in the current workspace. - path: | - ${{ needs.prepare.outputs.release-binary-filename }} - - # Clean up some build files to reduce size of artifact. - - name: Clean Up Build Directory - shell: bash - run: | - find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname ${{ needs.prepare.outputs.release-binary-filename }} -delete - rm -Rf ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/_CPack_Packages - - - name: Save Stage - uses: ./workflows/.github/workflows/release-binaries-save-stage - with: - build-prefix: ${{ steps.setup-stage.outputs.build-prefix }} - - upload-release-binaries: - name: "Upload Release Binaries" - needs: - - prepare - - build-stage3-all - if: >- - always() && - github.event_name != 'pull_request' && - needs.prepare.outputs.upload == 'true' - runs-on: ubuntu-22.04 - permissions: - contents: write # For release uploads - id-token: write # For artifact attestations - attestations: write # For artifact attestations - - steps: - - name: Checkout Release Scripts - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - sparse-checkout: | - llvm/utils/release/github-upload-release.py - llvm/utils/git/requirements.txt - sparse-checkout-cone-mode: false - - - name: 'Download artifact' - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 - with: - pattern: '*-release-binary' - merge-multiple: true - - - name: Attest Build Provenance - id: provenance - uses: actions/attest-build-provenance@897ed5eab6ed058a474202017ada7f40bfa52940 # v1.0.0 - with: - subject-path: ${{ needs.prepare.outputs.release-binary-filename }} - - - name: Rename attestation file - run: - mv ${{ steps.provenance.outputs.bundle-path }} ${{ needs.prepare.outputs.release-binary-filename }}.jsonl - - - name: Upload Build Provenance - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 - with: - name: ${{ needs.prepare.outputs.release-binary-filename }}-attestation - path: ${{ needs.prepare.outputs.release-binary-filename }}.jsonl - - - name: Install Python Requirements - run: | - pip install --require-hashes -r ./llvm/utils/git/requirements.txt - - - name: Upload Release - shell: bash - run: | - ./llvm/utils/release/github-upload-release.py \ - --token ${{ github.token }} \ - --release ${{ needs.prepare.outputs.release-version }} \ - upload \ - --files ${{ needs.prepare.outputs.release-binary-filename }}* - - test-stage3: - name: "Test Stage 3" - needs: - - prepare - - build-stage3-all - if: >- - github.repository == 'llvm/llvm-project' - runs-on: ${{ inputs.runs-on }} - steps: - - name: Checkout Actions - uses: actions/checkout@v4 - with: - ref: ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }} - sparse-checkout: | - .github/workflows/ - sparse-checkout-cone-mode: false - path: workflows - - name: Setup Stage - id: setup-stage - uses: ./workflows/.github/workflows/release-binaries-setup-stage - with: - previous-artifact: build-stage3-all - - - name: Run Tests - shell: bash - run: | - ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-check-all diff --git a/.github/workflows/release-documentation.yml b/.github/workflows/release-documentation.yml deleted file mode 100644 index 922c5093f135..000000000000 --- a/.github/workflows/release-documentation.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: Release Documentation - -permissions: - contents: read - -on: - workflow_dispatch: - inputs: - release-version: - description: 'Release Version' - required: true - type: string - upload: - description: 'Upload documentation' - required: false - type: boolean - - workflow_call: - inputs: - release-version: - description: 'Release Version' - required: true - type: string - upload: - description: 'Upload documentation' - required: false - type: boolean - -jobs: - release-documentation: - name: Build and Upload Release Documentation - runs-on: ubuntu-latest - env: - upload: ${{ inputs.upload && !contains(inputs.release-version, 'rc') }} - steps: - - name: Checkout LLVM - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Setup Python env - uses: actions/setup-python@v5 - with: - cache: 'pip' - cache-dependency-path: './llvm/docs/requirements.txt' - - - name: Install Dependencies - run: | - sudo apt-get update - sudo apt-get install -y \ - graphviz \ - python3-github \ - ninja-build \ - texlive-font-utils - pip3 install --user -r ./llvm/docs/requirements.txt - - - name: Build Documentation - env: - GITHUB_TOKEN: ${{ github.token }} - run: | - ./llvm/utils/release/build-docs.sh -release "${{ inputs.release-version }}" -no-doxygen - - - name: Create Release Notes Artifact - uses: actions/upload-artifact@v3 - with: - name: release-notes - path: docs-build/html-export/ - - - name: Clone www-releases - if: env.upload - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - repository: ${{ github.repository_owner }}/www-releases - ref: main - fetch-depth: 0 - path: www-releases - persist-credentials: false - - - name: Upload Release Notes - if: env.upload - env: - GH_TOKEN: ${{ secrets.WWW_RELEASES_TOKEN }} - run: | - mkdir -p www-releases/${{ inputs.release-version }} - mv ./docs-build/html-export/* www-releases/${{ inputs.release-version }} - cd www-releases - git checkout -b ${{ inputs.release-version }} - git add ${{ inputs.release-version }} - git config user.email "llvmbot@llvm.org" - git config user.name "llvmbot" - git commit -a -m "Add ${{ inputs.release-version }} documentation" - git push --force "https://$GH_TOKEN@github.com/llvmbot/www-releases.git" HEAD:refs/heads/${{ inputs.release-version }} - gh pr create -f -B main -H ${{ inputs.release-version }} -R llvmbot/www-releases diff --git a/.github/workflows/release-doxygen.yml b/.github/workflows/release-doxygen.yml deleted file mode 100644 index ea95e5bb12b2..000000000000 --- a/.github/workflows/release-doxygen.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Release Doxygen - -permissions: - contents: read - -on: - workflow_dispatch: - inputs: - release-version: - description: 'Release Version' - required: true - type: string - upload: - description: 'Upload documentation' - required: false - type: boolean - - workflow_call: - inputs: - release-version: - description: 'Release Version' - required: true - type: string - upload: - description: 'Upload documentation' - required: false - type: boolean - secrets: - RELEASE_TASKS_USER_TOKEN: - description: "Secret used to check user permissions." - required: false - -jobs: - release-doxygen: - name: Build and Upload Release Doxygen - runs-on: ubuntu-latest - permissions: - contents: write - env: - upload: ${{ inputs.upload && !contains(inputs.release-version, 'rc') }} - steps: - - name: Checkout LLVM - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Setup Python env - uses: actions/setup-python@v5 - with: - cache: 'pip' - cache-dependency-path: './llvm/docs/requirements.txt' - - - name: Install Dependencies - run: | - sudo apt-get update - sudo apt-get install -y \ - doxygen \ - graphviz \ - python3-github \ - ninja-build \ - texlive-font-utils - pip3 install --user -r ./llvm/docs/requirements.txt - - - name: Build Doxygen - run: | - ./llvm/utils/release/build-docs.sh -release "${{ inputs.release-version }}" -no-sphinx - - - name: Upload Doxygen - if: env.upload - env: - GITHUB_TOKEN: ${{ github.token }} - USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} - run: | - ./llvm/utils/release/github-upload-release.py --token "$GITHUB_TOKEN" --release "${{ inputs.release-version }}" --user "${{ github.actor }}" --user-token "$USER_TOKEN" upload --files ./*doxygen*.tar.xz diff --git a/.github/workflows/release-lit.yml b/.github/workflows/release-lit.yml deleted file mode 100644 index 9d6f3140e688..000000000000 --- a/.github/workflows/release-lit.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: Release Lit - -permissions: - contents: read - -on: - workflow_dispatch: - inputs: - release-version: - description: 'Release Version' - required: true - type: string - - workflow_call: - inputs: - release-version: - description: 'Release Version' - required: true - type: string - secrets: - RELEASE_TASKS_USER_TOKEN: - description: "Secret used to check user permissions." - required: false - -jobs: - release-lit: - name: Release Lit - runs-on: ubuntu-latest - steps: - - name: Checkout LLVM - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: "llvmorg-${{ inputs.release-version }}" - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y python3-setuptools python3-psutil python3-github - - - name: Check Permissions - env: - GITHUB_TOKEN: ${{ github.token }} - USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} - run: | - ./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} --user-token "$USER_TOKEN" check-permissions - - - name: Setup Cpp - uses: aminya/setup-cpp@v1 - with: - compiler: llvm-16.0.6 - cmake: true - ninja: true - - - name: Test lit - run: | - mkdir build && cd build - export FILECHECK_OPTS='-dump-input-filter=all -vv -color' - cmake ../llvm -DCMAKE_BUILD_TYPE=Release -G Ninja - ninja -v -j $(nproc) check-lit - - - name: Package lit - run: | - cd llvm/utils/lit - # Remove 'dev' suffix from lit version. - sed -i 's/ + "dev"//g' lit/__init__.py - python3 setup.py sdist bdist_wheel - - - name: Upload lit to test.pypi.org - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.LLVM_LIT_TEST_PYPI_API_TOKEN }} - repository-url: https://test.pypi.org/legacy/ - packages-dir: llvm/utils/lit/dist/ - - - name: Upload lit to pypi.org - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.LLVM_LIT_PYPI_API_TOKEN }} - packages-dir: llvm/utils/lit/dist/ diff --git a/.github/workflows/release-sources.yml b/.github/workflows/release-sources.yml deleted file mode 100644 index a6c86823f99d..000000000000 --- a/.github/workflows/release-sources.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Release Sources - -permissions: - contents: read - -on: - workflow_dispatch: - inputs: - release-version: - description: Release Version - required: true - type: string - workflow_call: - inputs: - release-version: - description: Release Version - required: true - type: string - secrets: - RELEASE_TASKS_USER_TOKEN: - description: "Secret used to check user permissions." - required: false - # Run on pull_requests for testing purposes. - pull_request: - paths: - - '.github/workflows/release-sources.yml' - types: - - opened - - synchronize - - reopened - # When a PR is closed, we still start this workflow, but then skip - # all the jobs, which makes it effectively a no-op. The reason to - # do this is that it allows us to take advantage of concurrency groups - # to cancel in progress CI jobs whenever the PR is closed. - - closed - -concurrency: - group: ${{ github.workflow }}-${{ inputs.release-version || github.event.pull_request.number }} - cancel-in-progress: True - -jobs: - inputs: - name: Collect Job Inputs - if: >- - github.repository_owner == 'llvm' && - github.event.action != 'closed' - outputs: - ref: ${{ steps.inputs.outputs.ref }} - export-args: ${{ steps.inputs.outputs.export-args }} - runs-on: ubuntu-latest - steps: - - id: inputs - run: | - ref=${{ (inputs.release-version && format('llvmorg-{0}', inputs.release-version)) || github.sha }} - if [ -n "${{ inputs.release-version }}" ]; then - export_args="-release ${{ inputs.release-version }} -final" - else - export_args="-git-ref ${{ github.sha }}" - fi - echo "ref=$ref" >> $GITHUB_OUTPUT - echo "export-args=$export_args" >> $GITHUB_OUTPUT - - release-sources: - name: Package Release Sources - if: github.repository_owner == 'llvm' - runs-on: ubuntu-latest - needs: - - inputs - permissions: - id-token: write - attestations: write - steps: - - name: Checkout LLVM - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ needs.inputs.outputs.ref }} - fetch-tags: true - - name: Install Dependencies - run: | - pip install --require-hashes -r ./llvm/utils/git/requirements.txt - - - name: Check Permissions - if: github.event_name != 'pull_request' - env: - GITHUB_TOKEN: ${{ github.token }} - USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} - run: | - ./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} --user-token "$USER_TOKEN" check-permissions - - name: Create Tarballs - run: | - ./llvm/utils/release/export.sh ${{ needs.inputs.outputs.export-args }} - - name: Attest Build Provenance - if: github.event_name != 'pull_request' - id: provenance - uses: actions/attest-build-provenance@897ed5eab6ed058a474202017ada7f40bfa52940 # v1.0.0 - with: - subject-path: "*.xz" - - if: github.event_name != 'pull_request' - run: | - mv ${{ steps.provenance.outputs.bundle-path }} . - - name: Create Tarball Artifacts - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 - with: - path: | - *.xz - attestation.jsonl - - diff --git a/.github/workflows/release-tasks.yml b/.github/workflows/release-tasks.yml deleted file mode 100644 index 780dd0ff6325..000000000000 --- a/.github/workflows/release-tasks.yml +++ /dev/null @@ -1,123 +0,0 @@ -name: Release Task - -permissions: - contents: read - -on: - push: - tags: - # The regex support here is limited, so just match everything that starts with llvmorg- and filter later. - - 'llvmorg-*' - -jobs: - validate-tag: - name: Validate Tag - runs-on: ubuntu-latest - if: github.repository == 'llvm/llvm-project' - outputs: - release-version: ${{ steps.validate-tag.outputs.release-version }} - steps: - - name: Validate Tag - id: validate-tag - run: | - echo "${{ github.ref_name }}" | grep -e '^llvmorg-[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc[0-9]\+\)\?$' - release_version=$(echo "${{ github.ref_name }}" | sed 's/llvmorg-//g') - echo "release-version=$release_version" >> "$GITHUB_OUTPUT" - - release-create: - name: Create a New Release - runs-on: ubuntu-latest - permissions: - contents: write # For creating the release. - needs: validate-tag - - steps: - - name: Install Dependencies - run: | - sudo apt-get update - sudo apt-get install python3-github - - - name: Checkout LLVM - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Create Release - env: - GITHUB_TOKEN: ${{ github.token }} - USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} - run: | - ./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --release ${{ needs.validate-tag.outputs.release-version }} --user ${{ github.actor }} --user-token "$USER_TOKEN" create - release-documentation: - name: Build and Upload Release Documentation - needs: - - validate-tag - uses: ./.github/workflows/release-documentation.yml - with: - release-version: ${{ needs.validate-tag.outputs.release-version }} - upload: true - - release-doxygen: - name: Build and Upload Release Doxygen - permissions: - contents: write - needs: - - validate-tag - - release-create - uses: ./.github/workflows/release-doxygen.yml - with: - release-version: ${{ needs.validate-tag.outputs.release-version }} - upload: true - # Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use. - secrets: - RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} - - release-lit: - name: Release Lit - needs: validate-tag - uses: ./.github/workflows/release-lit.yml - with: - release-version: ${{ needs.validate-tag.outputs.release-version }} - # Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use. - secrets: - RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} - - release-binaries: - name: Build Release Binaries - permissions: - contents: write - id-token: write - attestations: write - needs: - - validate-tag - - release-create - strategy: - fail-fast: false - matrix: - runs-on: - - ubuntu-22.04 - - windows-2022 - - macos-13 - - macos-14 - - uses: ./.github/workflows/release-binaries.yml - with: - release-version: ${{ needs.validate-tag.outputs.release-version }} - upload: true - runs-on: ${{ matrix.runs-on }} - # Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use. - secrets: - RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} - - release-sources: - name: Package Release Sources - permissions: - contents: read - id-token: write - attestations: write - needs: - - validate-tag - uses: ./.github/workflows/release-sources.yml - with: - release-version: ${{ needs.validate-tag.outputs.release-version }} - # Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use. - secrets: - RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index ff61cf83a6af..2d96a0a67825 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -2,7 +2,7 @@ # by a third-party and are governed by separate terms of service, privacy # policy, and support documentation. -# Check current LLVM-Project results here: https://securityscorecards.dev/viewer/?uri=github.com/llvm/llvm-project +# Check current LLVM-Project results here: https://securityscorecards.dev/viewer/?uri=github.com/intel/npu-plugin-llvm name: Scorecard supply-chain security on: @@ -13,50 +13,63 @@ on: # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained schedule: - cron: '38 20 * * *' + push: + branches: [ "npu/release/19.x" ] # Declare default permissions as read only. -permissions: - contents: read +permissions: read-all jobs: analysis: name: Scorecard analysis runs-on: ubuntu-latest - if: github.repository == 'llvm/llvm-project' permissions: # Needed to upload the results to code-scanning dashboard. security-events: write # Needed to publish results and get a badge (see publish_results below). - id-token: write + id-token: write + # Uncomment the permissions below if installing in a private repository. + # contents: read + # actions: read steps: - name: "Checkout code" - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 + uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0 with: results_file: results.sarif results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecard on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional. + # repo_token: ${{ secrets.SCORECARD_TOKEN }} + # Public repositories: # - Publish results to OpenSSF REST API for easy access by consumers # - Allows the repository to include the Scorecard badge. - # - See https://github.com/ossf/scorecard-action#publishing-results. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. publish_results: true # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + uses: actions/upload-artifact@c24449f33cd45d4826c6702db7e49f7cdb9b551d # v3.pre.node20 with: name: SARIF file path: results.sarif retention-days: 5 - # Upload the results to GitHub's code scanning dashboard. + # Upload the results to GitHub's code scanning dashboard (optional). + # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4 + uses: github/codeql-action/upload-sarif@v3 with: - sarif_file: results.sarif + sarif_file: results.sarif \ No newline at end of file diff --git a/.github/workflows/set-release-binary-outputs.sh b/.github/workflows/set-release-binary-outputs.sh deleted file mode 100644 index 14d0798364e9..000000000000 --- a/.github/workflows/set-release-binary-outputs.sh +++ /dev/null @@ -1,34 +0,0 @@ -# Usage: set-release-binary-outputs.sh - -set -e - -if [ -z "$GITHUB_OUTPUT" ]; then - export GITHUB_OUTPUT=`mktemp` - echo "Warning: Environment variable GITHUB_OUTPUT is not set." - echo "Writing output variables to $GITHUB_OUTPUT" -fi - -tag=$1 -upload=$2 - -if echo $tag | grep -e '^[0-9a-f]\+$'; then - # This is a plain commit. - # TODO: Don't hardcode this. - release_version="18" - upload='false' - ref="$tag" - -else - - pattern='^llvmorg-[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc[0-9]\+\)\?$' - echo "$tag" | grep -e $pattern - if [ $? != 0 ]; then - echo "ERROR: Tag '$tag' doesn't match pattern: $pattern" - exit 1 - fi - release_version=`echo "$tag" | sed 's/llvmorg-//g'` - release=`echo "$release_version" | sed 's/-.*//g'` -fi -echo "release-version=$release_version" >> $GITHUB_OUTPUT -echo "upload=$upload" >> $GITHUB_OUTPUT -echo "ref=$tag" >> $GITHUB_OUTPUT diff --git a/.github/workflows/spirv-tests.yml b/.github/workflows/spirv-tests.yml deleted file mode 100644 index 75918e73e897..000000000000 --- a/.github/workflows/spirv-tests.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: SPIR-V Tests - -permissions: - contents: read - -on: - workflow_dispatch: - pull_request: - paths: - - 'llvm/lib/Target/SPIRV/**' - - 'llvm/test/CodeGen/SPIRV/**' - - '.github/workflows/spirv-tests.yml' - -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} - -jobs: - check_spirv: - if: github.repository_owner == 'llvm' - name: Test SPIR-V - uses: ./.github/workflows/llvm-project-tests.yml - with: - build_target: check-llvm-codegen-spirv - projects: - extra_cmake_args: '-DLLVM_TARGETS_TO_BUILD="" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="SPIRV" -DLLVM_INCLUDE_SPIRV_TOOLS_TESTS=ON' - os_list: '["ubuntu-latest"]' diff --git a/.github/workflows/unprivileged-download-artifact/action.yml b/.github/workflows/unprivileged-download-artifact/action.yml deleted file mode 100644 index 9d8fb59a67c0..000000000000 --- a/.github/workflows/unprivileged-download-artifact/action.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: Unprivileged Download Artifact -description: >- - Download artifacts from another workflow run without using an access token. -inputs: - run-id: - description: >- - The run-id for the workflow run that you want to download the artifact - from. If ommitted it will download the most recently created artifact - from the repo with the artifact-name. - required: false - artifact-name: - desciption: The name of the artifact to download. - required: true - - -outputs: - filename: - description: >- - The filename of the downloaded artifact or the empty string if the - artifact was not found. - value: ${{ steps.download-artifact.outputs.filename }} - artifact-id: - description: "The id of the artifact being downloaded." - value: ${{ steps.artifact-url.outputs.id }} - - -runs: - using: "composite" - steps: - - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1 - id: artifact-url - with: - script: | - var response; - if (!"${{ inputs.run-id }}") { - response = await github.rest.actions.listArtifactsForRepo({ - owner: context.repo.owner, - repo: context.repo.repo, - name: "${{ inputs.artifact-name }}" - }) - } else { - response = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: "${{ inputs.run-id }}", - name: "${{ inputs.artifact-name }}" - }) - } - - console.log(response) - - for (artifact of response.data.artifacts) { - console.log(artifact); - } - - if (response.data.artifacts.length == 0) { - console.log("Could not find artifact ${{ inputs.artifact-name }} for workflow run ${{ inputs.run-id }}") - return; - } - - const url_response = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: response.data.artifacts[0].id, - archive_format: "zip" - }) - - core.setOutput("url", url_response.url); - core.setOutput("id", response.data.artifacts[0].id); - - - shell: bash - if: steps.artifact-url.outputs.url != '' - id: download-artifact - run: | - curl -L -o ${{ inputs.artifact-name }}.zip "${{ steps.artifact-url.outputs.url }}" - echo "filename=${{ inputs.artifact-name }}.zip" >> $GITHUB_OUTPUT - - - shell: bash - if: steps.download-artifact.outputs.filename != '' - run: | - unzip ${{ steps.download-artifact.outputs.filename }} diff --git a/.github/workflows/version-check.py b/.github/workflows/version-check.py deleted file mode 100755 index f75fd5030088..000000000000 --- a/.github/workflows/version-check.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/python3 - -from git import Repo -import re -import sys - - -def get_version_from_tag(tag): - m = re.match("llvmorg-([0-9]+)\.([0-9]+)\.([0-9]+)(-rc[0-9]+)?$", tag) - if m: - if m.lastindex == 4: - # We have an rc tag. - return m.group(1, 2, 3) - # We have a final release tag. - return (m.group(1), m.group(2), str(int(m.group(3)) + 1)) - - m = re.match("llvmorg-([0-9]+)-init", tag) - if m: - return (m.group(1), "1", "0") - - raise Exception(f"error: Tag is not valid: {tag}") - - -version = sys.argv[1] - -repo = Repo() - -tag = repo.git.describe(tags=True, abbrev=0) -expected_version = ".".join(get_version_from_tag(tag)) - -if version != expected_version: - print("error: Expected version", expected_version, "but found version", version) - sys.exit(1) - -print("Versions match:", version, expected_version) -sys.exit(0) diff --git a/.github/workflows/version-check.yml b/.github/workflows/version-check.yml deleted file mode 100644 index 894e07d323ca..000000000000 --- a/.github/workflows/version-check.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: LLVM Project Version Check - -on: - push: - branches: - - 'release/**' - pull_request: - branches: - - 'release/**' - -permissions: - contents: read - -jobs: - version_check: - if: github.repository_owner == 'llvm' - runs-on: ubuntu-latest - steps: - - name: Fetch LLVM sources - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install dependencies - run: | - pip install --require-hashes -r ./llvm/utils/git/requirements.txt - - - name: Version Check - run: | - version=$(grep -o 'LLVM_VERSION_\(MAJOR\|MINOR\|PATCH\) [0-9]\+' cmake/Modules/LLVMVersion.cmake | cut -d ' ' -f 2 | tr "\n" "." | sed 's/.$//g') - .github/workflows/version-check.py "$version" diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake index ffcc718b4777..94a42de60e06 100644 --- a/llvm/cmake/modules/TableGen.cmake +++ b/llvm/cmake/modules/TableGen.cmake @@ -81,7 +81,7 @@ function(tablegen project ofn) endif() if (NOT LLVM_ENABLE_WARNINGS) - list(APPEND LLVM_TABLEGEN_FLAGS "-no-warn-on-unused-template-args") + list(APPEND LLVM_TABLEGEN_FLAGS "-Dno-warn-on-unused-template-args") endif() # We need both _TABLEGEN_TARGET and _TABLEGEN_EXE in the DEPENDS list diff --git a/llvm/docs/requirements-hashed.txt b/llvm/docs/requirements-hashed.txt index 64cfc8fc7979..3b652e658c8c 100644 --- a/llvm/docs/requirements-hashed.txt +++ b/llvm/docs/requirements-hashed.txt @@ -4,21 +4,21 @@ # # pip-compile --generate-hashes --output-file=requirements-hashed.txt requirements.txt # -alabaster==0.7.13 \ - --hash=sha256:1ee19aca801bbabb5ba3f5f258e4422dfa86f82f3e9cefb0859b283cdd7f62a3 \ - --hash=sha256:a27a4a084d5e690e16e01e03ad2b2e552c61a65469419b907243193de1a84ae2 +alabaster==0.7.16 \ + --hash=sha256:75a8b99c28a5dad50dd7f8ccdd447a121ddb3892da9e53d1ca5cca3106d58d65 \ + --hash=sha256:b46733c07dce03ae4e150330b975c75737fa60f0a7c591b6c8bf4928a28e2c92 # via sphinx -babel==2.14.0 \ - --hash=sha256:6919867db036398ba21eb5c7a0f6b28ab8cbc3ae7a73a44ebe34ae74a4e7d363 \ - --hash=sha256:efb1a25b7118e67ce3a259bed20545c29cb68be8ad2c784c83689981b7a57287 +babel==2.15.0 \ + --hash=sha256:08706bdad8d0a3413266ab61bd6c34d0c28d6e1e7badf40a2cebe67644e2e1fb \ + --hash=sha256:8daf0e265d05768bc6c7a314cf1321e9a123afc328cc635c18622a2f30a04413 # via sphinx -beautifulsoup4==4.12.2 \ - --hash=sha256:492bbc69dca35d12daac71c4db1bfff0c876c00ef4a2ffacce226d4638eb72da \ - --hash=sha256:bd2520ca0d9d7d12694a53d44ac482d181b4ec1888909b035a3dbf40d0f57d4a +beautifulsoup4==4.12.3 \ + --hash=sha256:74e3d1928edc070d21748185c46e3fb33490f22f52a3addee9aee0f4f7781051 \ + --hash=sha256:b80878c9f40111313e55da8ba20bdba06d8fa3969fc68304167741bbf9e082ed # via furo -certifi==2023.11.17 \ - --hash=sha256:9b469f3a900bf28dc19b8cfbf8019bf47f7fdd1a65a1d4ffb98fc14166beb4d1 \ - --hash=sha256:e036ab49d5b79556f99cfc2d9320b34cfbe5be05c5871b51de9329f0603b0474 +certifi==2024.7.4 \ + --hash=sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b \ + --hash=sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90 # via requests charset-normalizer==3.3.2 \ --hash=sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027 \ @@ -116,35 +116,35 @@ commonmark==0.9.1 \ --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 # via recommonmark -docutils==0.20.1 \ - --hash=sha256:96f387a2c5562db4476f09f13bbab2192e764cac08ebbf3a34a95d9b1e4a59d6 \ - --hash=sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b +docutils==0.21.2 \ + --hash=sha256:3a6b18732edf182daa3cd12775bbb338cf5691468f91eeeb109deff6ebfa986f \ + --hash=sha256:dafca5b9e384f0e419294eb4d2ff9fa826435bf15f15b7bd45723e8ad76811b2 # via # -r requirements.txt # myst-parser # recommonmark # sphinx -furo==2024.1.29 \ - --hash=sha256:3548be2cef45a32f8cdc0272d415fcb3e5fa6a0eb4ddfe21df3ecf1fe45a13cf \ - --hash=sha256:4d6b2fe3f10a6e36eb9cc24c1e7beb38d7a23fc7b3c382867503b7fcac8a1e02 +furo==2024.5.6 \ + --hash=sha256:490a00d08c0a37ecc90de03ae9227e8eb5d6f7f750edf9807f398a2bdf2358de \ + --hash=sha256:81f205a6605ebccbb883350432b4831c0196dd3d1bc92f61e1f459045b3d2b0b # via -r requirements.txt -idna==3.6 \ - --hash=sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca \ - --hash=sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f +idna==3.7 \ + --hash=sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc \ + --hash=sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0 # via requests imagesize==1.4.1 \ --hash=sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b \ --hash=sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a # via sphinx -jinja2==3.1.2 \ - --hash=sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852 \ - --hash=sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61 +jinja2==3.1.4 \ + --hash=sha256:4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369 \ + --hash=sha256:bc5dd2abb727a5319567b7a813e6a2e7318c39f4f487cfe6c89c6f9c7d25197d # via # myst-parser # sphinx -markdown==3.5.1 \ - --hash=sha256:5874b47d4ee3f0b14d764324d2c94c03ea66bee56f2d929da9f2508d65e722dc \ - --hash=sha256:b65d7beb248dc22f2e8a31fb706d93798093c308dc1aba295aedeb9d41a813bd +markdown==3.6 \ + --hash=sha256:48f276f4d8cfb8ce6527c8f79e2ee29708508bf4d40aa410fbc3b4ee832c850f \ + --hash=sha256:ed4f41f6daecbeeb96e576ce414c41d2d876daa9a16cb35fa8ed8c2ddfad0224 # via sphinx-markdown-tables markdown-it-py==3.0.0 \ --hash=sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1 \ @@ -152,87 +152,87 @@ markdown-it-py==3.0.0 \ # via # mdit-py-plugins # myst-parser -markupsafe==2.1.3 \ - --hash=sha256:05fb21170423db021895e1ea1e1f3ab3adb85d1c2333cbc2310f2a26bc77272e \ - --hash=sha256:0a4e4a1aff6c7ac4cd55792abf96c915634c2b97e3cc1c7129578aa68ebd754e \ - --hash=sha256:10bbfe99883db80bdbaff2dcf681dfc6533a614f700da1287707e8a5d78a8431 \ - --hash=sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686 \ - --hash=sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c \ - --hash=sha256:1577735524cdad32f9f694208aa75e422adba74f1baee7551620e43a3141f559 \ - --hash=sha256:1b40069d487e7edb2676d3fbdb2b0829ffa2cd63a2ec26c4938b2d34391b4ecc \ - --hash=sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb \ - --hash=sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939 \ - --hash=sha256:282c2cb35b5b673bbcadb33a585408104df04f14b2d9b01d4c345a3b92861c2c \ - --hash=sha256:2c1b19b3aaacc6e57b7e25710ff571c24d6c3613a45e905b1fde04d691b98ee0 \ - --hash=sha256:2ef12179d3a291be237280175b542c07a36e7f60718296278d8593d21ca937d4 \ - --hash=sha256:338ae27d6b8745585f87218a3f23f1512dbf52c26c28e322dbe54bcede54ccb9 \ - --hash=sha256:3c0fae6c3be832a0a0473ac912810b2877c8cb9d76ca48de1ed31e1c68386575 \ - --hash=sha256:3fd4abcb888d15a94f32b75d8fd18ee162ca0c064f35b11134be77050296d6ba \ - --hash=sha256:42de32b22b6b804f42c5d98be4f7e5e977ecdd9ee9b660fda1a3edf03b11792d \ - --hash=sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd \ - --hash=sha256:504b320cd4b7eff6f968eddf81127112db685e81f7e36e75f9f84f0df46041c3 \ - --hash=sha256:525808b8019e36eb524b8c68acdd63a37e75714eac50e988180b169d64480a00 \ - --hash=sha256:56d9f2ecac662ca1611d183feb03a3fa4406469dafe241673d521dd5ae92a155 \ - --hash=sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac \ - --hash=sha256:65c1a9bcdadc6c28eecee2c119465aebff8f7a584dd719facdd9e825ec61ab52 \ - --hash=sha256:68e78619a61ecf91e76aa3e6e8e33fc4894a2bebe93410754bd28fce0a8a4f9f \ - --hash=sha256:69c0f17e9f5a7afdf2cc9fb2d1ce6aabdb3bafb7f38017c0b77862bcec2bbad8 \ - --hash=sha256:6b2b56950d93e41f33b4223ead100ea0fe11f8e6ee5f641eb753ce4b77a7042b \ - --hash=sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007 \ - --hash=sha256:787003c0ddb00500e49a10f2844fac87aa6ce977b90b0feaaf9de23c22508b24 \ - --hash=sha256:7ef3cb2ebbf91e330e3bb937efada0edd9003683db6b57bb108c4001f37a02ea \ - --hash=sha256:8023faf4e01efadfa183e863fefde0046de576c6f14659e8782065bcece22198 \ - --hash=sha256:8758846a7e80910096950b67071243da3e5a20ed2546e6392603c096778d48e0 \ - --hash=sha256:8afafd99945ead6e075b973fefa56379c5b5c53fd8937dad92c662da5d8fd5ee \ - --hash=sha256:8c41976a29d078bb235fea9b2ecd3da465df42a562910f9022f1a03107bd02be \ - --hash=sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2 \ - --hash=sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1 \ - --hash=sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707 \ - --hash=sha256:962f82a3086483f5e5f64dbad880d31038b698494799b097bc59c2edf392fce6 \ - --hash=sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c \ - --hash=sha256:9dcdfd0eaf283af041973bff14a2e143b8bd64e069f4c383416ecd79a81aab58 \ - --hash=sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823 \ - --hash=sha256:aa7bd130efab1c280bed0f45501b7c8795f9fdbeb02e965371bbef3523627779 \ - --hash=sha256:ab4a0df41e7c16a1392727727e7998a467472d0ad65f3ad5e6e765015df08636 \ - --hash=sha256:ad9e82fb8f09ade1c3e1b996a6337afac2b8b9e365f926f5a61aacc71adc5b3c \ - --hash=sha256:af598ed32d6ae86f1b747b82783958b1a4ab8f617b06fe68795c7f026abbdcad \ - --hash=sha256:b076b6226fb84157e3f7c971a47ff3a679d837cf338547532ab866c57930dbee \ - --hash=sha256:b7ff0f54cb4ff66dd38bebd335a38e2c22c41a8ee45aa608efc890ac3e3931bc \ - --hash=sha256:bfce63a9e7834b12b87c64d6b155fdd9b3b96191b6bd334bf37db7ff1fe457f2 \ - --hash=sha256:c011a4149cfbcf9f03994ec2edffcb8b1dc2d2aede7ca243746df97a5d41ce48 \ - --hash=sha256:c9c804664ebe8f83a211cace637506669e7890fec1b4195b505c214e50dd4eb7 \ - --hash=sha256:ca379055a47383d02a5400cb0d110cef0a776fc644cda797db0c5696cfd7e18e \ - --hash=sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b \ - --hash=sha256:cd0f502fe016460680cd20aaa5a76d241d6f35a1c3350c474bac1273803893fa \ - --hash=sha256:ceb01949af7121f9fc39f7d27f91be8546f3fb112c608bc4029aef0bab86a2a5 \ - --hash=sha256:d080e0a5eb2529460b30190fcfcc4199bd7f827663f858a226a81bc27beaa97e \ - --hash=sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb \ - --hash=sha256:df0be2b576a7abbf737b1575f048c23fb1d769f267ec4358296f31c2479db8f9 \ - --hash=sha256:e09031c87a1e51556fdcb46e5bd4f59dfb743061cf93c4d6831bf894f125eb57 \ - --hash=sha256:e4dd52d80b8c83fdce44e12478ad2e85c64ea965e75d66dbeafb0a3e77308fcc \ - --hash=sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc \ - --hash=sha256:fec21693218efe39aa7f8599346e90c705afa52c5b31ae019b2e57e8f6542bb2 \ - --hash=sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11 +markupsafe==2.1.5 \ + --hash=sha256:00e046b6dd71aa03a41079792f8473dc494d564611a8f89bbbd7cb93295ebdcf \ + --hash=sha256:075202fa5b72c86ad32dc7d0b56024ebdbcf2048c0ba09f1cde31bfdd57bcfff \ + --hash=sha256:0e397ac966fdf721b2c528cf028494e86172b4feba51d65f81ffd65c63798f3f \ + --hash=sha256:17b950fccb810b3293638215058e432159d2b71005c74371d784862b7e4683f3 \ + --hash=sha256:1f3fbcb7ef1f16e48246f704ab79d79da8a46891e2da03f8783a5b6fa41a9532 \ + --hash=sha256:2174c595a0d73a3080ca3257b40096db99799265e1c27cc5a610743acd86d62f \ + --hash=sha256:2b7c57a4dfc4f16f7142221afe5ba4e093e09e728ca65c51f5620c9aaeb9a617 \ + --hash=sha256:2d2d793e36e230fd32babe143b04cec8a8b3eb8a3122d2aceb4a371e6b09b8df \ + --hash=sha256:30b600cf0a7ac9234b2638fbc0fb6158ba5bdcdf46aeb631ead21248b9affbc4 \ + --hash=sha256:397081c1a0bfb5124355710fe79478cdbeb39626492b15d399526ae53422b906 \ + --hash=sha256:3a57fdd7ce31c7ff06cdfbf31dafa96cc533c21e443d57f5b1ecc6cdc668ec7f \ + --hash=sha256:3c6b973f22eb18a789b1460b4b91bf04ae3f0c4234a0a6aa6b0a92f6f7b951d4 \ + --hash=sha256:3e53af139f8579a6d5f7b76549125f0d94d7e630761a2111bc431fd820e163b8 \ + --hash=sha256:4096e9de5c6fdf43fb4f04c26fb114f61ef0bf2e5604b6ee3019d51b69e8c371 \ + --hash=sha256:4275d846e41ecefa46e2015117a9f491e57a71ddd59bbead77e904dc02b1bed2 \ + --hash=sha256:4c31f53cdae6ecfa91a77820e8b151dba54ab528ba65dfd235c80b086d68a465 \ + --hash=sha256:4f11aa001c540f62c6166c7726f71f7573b52c68c31f014c25cc7901deea0b52 \ + --hash=sha256:5049256f536511ee3f7e1b3f87d1d1209d327e818e6ae1365e8653d7e3abb6a6 \ + --hash=sha256:58c98fee265677f63a4385256a6d7683ab1832f3ddd1e66fe948d5880c21a169 \ + --hash=sha256:598e3276b64aff0e7b3451b72e94fa3c238d452e7ddcd893c3ab324717456bad \ + --hash=sha256:5b7b716f97b52c5a14bffdf688f971b2d5ef4029127f1ad7a513973cfd818df2 \ + --hash=sha256:5dedb4db619ba5a2787a94d877bc8ffc0566f92a01c0ef214865e54ecc9ee5e0 \ + --hash=sha256:619bc166c4f2de5caa5a633b8b7326fbe98e0ccbfacabd87268a2b15ff73a029 \ + --hash=sha256:629ddd2ca402ae6dbedfceeba9c46d5f7b2a61d9749597d4307f943ef198fc1f \ + --hash=sha256:656f7526c69fac7f600bd1f400991cc282b417d17539a1b228617081106feb4a \ + --hash=sha256:6ec585f69cec0aa07d945b20805be741395e28ac1627333b1c5b0105962ffced \ + --hash=sha256:72b6be590cc35924b02c78ef34b467da4ba07e4e0f0454a2c5907f473fc50ce5 \ + --hash=sha256:7502934a33b54030eaf1194c21c692a534196063db72176b0c4028e140f8f32c \ + --hash=sha256:7a68b554d356a91cce1236aa7682dc01df0edba8d043fd1ce607c49dd3c1edcf \ + --hash=sha256:7b2e5a267c855eea6b4283940daa6e88a285f5f2a67f2220203786dfa59b37e9 \ + --hash=sha256:823b65d8706e32ad2df51ed89496147a42a2a6e01c13cfb6ffb8b1e92bc910bb \ + --hash=sha256:8590b4ae07a35970728874632fed7bd57b26b0102df2d2b233b6d9d82f6c62ad \ + --hash=sha256:8dd717634f5a044f860435c1d8c16a270ddf0ef8588d4887037c5028b859b0c3 \ + --hash=sha256:8dec4936e9c3100156f8a2dc89c4b88d5c435175ff03413b443469c7c8c5f4d1 \ + --hash=sha256:97cafb1f3cbcd3fd2b6fbfb99ae11cdb14deea0736fc2b0952ee177f2b813a46 \ + --hash=sha256:a17a92de5231666cfbe003f0e4b9b3a7ae3afb1ec2845aadc2bacc93ff85febc \ + --hash=sha256:a549b9c31bec33820e885335b451286e2969a2d9e24879f83fe904a5ce59d70a \ + --hash=sha256:ac07bad82163452a6884fe8fa0963fb98c2346ba78d779ec06bd7a6262132aee \ + --hash=sha256:ae2ad8ae6ebee9d2d94b17fb62763125f3f374c25618198f40cbb8b525411900 \ + --hash=sha256:b91c037585eba9095565a3556f611e3cbfaa42ca1e865f7b8015fe5c7336d5a5 \ + --hash=sha256:bc1667f8b83f48511b94671e0e441401371dfd0f0a795c7daa4a3cd1dde55bea \ + --hash=sha256:bec0a414d016ac1a18862a519e54b2fd0fc8bbfd6890376898a6c0891dd82e9f \ + --hash=sha256:bf50cd79a75d181c9181df03572cdce0fbb75cc353bc350712073108cba98de5 \ + --hash=sha256:bff1b4290a66b490a2f4719358c0cdcd9bafb6b8f061e45c7a2460866bf50c2e \ + --hash=sha256:c061bb86a71b42465156a3ee7bd58c8c2ceacdbeb95d05a99893e08b8467359a \ + --hash=sha256:c8b29db45f8fe46ad280a7294f5c3ec36dbac9491f2d1c17345be8e69cc5928f \ + --hash=sha256:ce409136744f6521e39fd8e2a24c53fa18ad67aa5bc7c2cf83645cce5b5c4e50 \ + --hash=sha256:d050b3361367a06d752db6ead6e7edeb0009be66bc3bae0ee9d97fb326badc2a \ + --hash=sha256:d283d37a890ba4c1ae73ffadf8046435c76e7bc2247bbb63c00bd1a709c6544b \ + --hash=sha256:d9fad5155d72433c921b782e58892377c44bd6252b5af2f67f16b194987338a4 \ + --hash=sha256:daa4ee5a243f0f20d528d939d06670a298dd39b1ad5f8a72a4275124a7819eff \ + --hash=sha256:db0b55e0f3cc0be60c1f19efdde9a637c32740486004f20d1cff53c3c0ece4d2 \ + --hash=sha256:e61659ba32cf2cf1481e575d0462554625196a1f2fc06a1c777d3f48e8865d46 \ + --hash=sha256:ea3d8a3d18833cf4304cd2fc9cbb1efe188ca9b5efef2bdac7adc20594a0e46b \ + --hash=sha256:ec6a563cff360b50eed26f13adc43e61bc0c04d94b8be985e6fb24b81f6dcfdf \ + --hash=sha256:f5dfb42c4604dddc8e4305050aa6deb084540643ed5804d7455b5df8fe16f5e5 \ + --hash=sha256:fa173ec60341d6bb97a89f5ea19c85c5643c1e7dedebc22f5181eb73573142c5 \ + --hash=sha256:fa9db3f79de01457b03d4f01b34cf91bc0048eb2c3846ff26f66687c2f6d16ab \ + --hash=sha256:fce659a462a1be54d2ffcacea5e3ba2d74daa74f30f5f143fe0c58636e355fdd \ + --hash=sha256:ffee1f21e5ef0d712f9033568f8344d5da8cc2869dbd08d87c84656e6a2d2f68 # via jinja2 -mdit-py-plugins==0.4.0 \ - --hash=sha256:b51b3bb70691f57f974e257e367107857a93b36f322a9e6d44ca5bf28ec2def9 \ - --hash=sha256:d8ab27e9aed6c38aa716819fedfde15ca275715955f8a185a8e1cf90fb1d2c1b +mdit-py-plugins==0.4.1 \ + --hash=sha256:1020dfe4e6bfc2c79fb49ae4e3f5b297f5ccd20f010187acc52af2921e27dc6a \ + --hash=sha256:834b8ac23d1cd60cec703646ffd22ae97b7955a6d596eb1d304be1e251ae499c # via myst-parser mdurl==0.1.2 \ --hash=sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8 \ --hash=sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba # via markdown-it-py -myst-parser==2.0.0 \ - --hash=sha256:7c36344ae39c8e740dad7fdabf5aa6fc4897a813083c6cc9990044eb93656b14 \ - --hash=sha256:ea929a67a6a0b1683cdbe19b8d2e724cd7643f8aa3e7bb18dd65beac3483bead +myst-parser==3.0.1 \ + --hash=sha256:6457aaa33a5d474aca678b8ead9b3dc298e89c68e67012e73146ea6fd54babf1 \ + --hash=sha256:88f0cb406cb363b077d176b51c476f62d60604d68a8dcdf4832e080441301a87 # via -r requirements.txt -packaging==23.2 \ - --hash=sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5 \ - --hash=sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7 +packaging==24.1 \ + --hash=sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002 \ + --hash=sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124 # via sphinx -pygments==2.17.2 \ - --hash=sha256:b27c2826c47d0f3219f29554824c30c5e8945175d888647acd804ddd04af846c \ - --hash=sha256:da46cec9fd2de5be3a8a784f434e4c4ab670b4ff54d605c4c2717e9d49c4c367 +pygments==2.18.0 \ + --hash=sha256:786ff802f32e91311bff3889f6e9a86e81505fe99f2735bb6d60ae0c5004f199 \ + --hash=sha256:b8e6aca0523f3ab76fee51799c488e38782ac06eafcf95e7ba832985c8e7b13a # via # furo # sphinx @@ -292,9 +292,9 @@ recommonmark==0.7.1 \ --hash=sha256:1b1db69af0231efce3fa21b94ff627ea33dee7079a01dd0a7f8482c3da148b3f \ --hash=sha256:bdb4db649f2222dcd8d2d844f0006b958d627f732415d399791ee436a3686d67 # via -r requirements.txt -requests==2.31.0 \ - --hash=sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f \ - --hash=sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1 +requests==2.32.3 \ + --hash=sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760 \ + --hash=sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6 # via sphinx snowballstemmer==2.2.0 \ --hash=sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1 \ @@ -304,9 +304,9 @@ soupsieve==2.5 \ --hash=sha256:5663d5a7b3bfaeee0bc4372e7fc48f9cff4940b3eec54a6451cc5299f1097690 \ --hash=sha256:eaa337ff55a1579b6549dc679565eac1e3d000563bcb1c8ab0d0fefbc0c2cdc7 # via beautifulsoup4 -sphinx==7.2.6 \ - --hash=sha256:1e09160a40b956dc623c910118fa636da93bd3ca0b9876a7b3df90f07d691560 \ - --hash=sha256:9a5160e1ea90688d5963ba09a2dcd8bdd526620edbb65c328728f1b2228d5ab5 +sphinx==7.3.7 \ + --hash=sha256:413f75440be4cacf328f580b4274ada4565fb2187d696a84970c23f77b64d8c3 \ + --hash=sha256:a4a7db75ed37531c05002d56ed6948d4c42f473a36f46e1382b0bd76ca9627bc # via # -r requirements.txt # furo @@ -340,27 +340,27 @@ sphinxcontrib-applehelp==1.0.8 \ # via # -r requirements.txt # sphinx -sphinxcontrib-devhelp==1.0.5 \ - --hash=sha256:63b41e0d38207ca40ebbeabcf4d8e51f76c03e78cd61abe118cf4435c73d4212 \ - --hash=sha256:fe8009aed765188f08fcaadbb3ea0d90ce8ae2d76710b7e29ea7d047177dae2f +sphinxcontrib-devhelp==1.0.6 \ + --hash=sha256:6485d09629944511c893fa11355bda18b742b83a2b181f9a009f7e500595c90f \ + --hash=sha256:9893fd3f90506bc4b97bdb977ceb8fbd823989f4316b28c3841ec128544372d3 # via sphinx -sphinxcontrib-htmlhelp==2.0.4 \ - --hash=sha256:6c26a118a05b76000738429b724a0568dbde5b72391a688577da08f11891092a \ - --hash=sha256:8001661c077a73c29beaf4a79968d0726103c5605e27db92b9ebed8bab1359e9 +sphinxcontrib-htmlhelp==2.0.5 \ + --hash=sha256:0dc87637d5de53dd5eec3a6a01753b1ccf99494bd756aafecd74b4fa9e729015 \ + --hash=sha256:393f04f112b4d2f53d93448d4bce35842f62b307ccdc549ec1585e950bc35e04 # via sphinx sphinxcontrib-jsmath==1.0.1 \ --hash=sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178 \ --hash=sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8 # via sphinx -sphinxcontrib-qthelp==1.0.6 \ - --hash=sha256:62b9d1a186ab7f5ee3356d906f648cacb7a6bdb94d201ee7adf26db55092982d \ - --hash=sha256:bf76886ee7470b934e363da7a954ea2825650013d367728588732c7350f49ea4 +sphinxcontrib-qthelp==1.0.7 \ + --hash=sha256:053dedc38823a80a7209a80860b16b722e9e0209e32fea98c90e4e6624588ed6 \ + --hash=sha256:e2ae3b5c492d58fcbd73281fbd27e34b8393ec34a073c792642cd8e529288182 # via sphinx -sphinxcontrib-serializinghtml==1.1.9 \ - --hash=sha256:0c64ff898339e1fac29abd2bf5f11078f3ec413cfe9c046d3120d7ca65530b54 \ - --hash=sha256:9b36e503703ff04f20e9675771df105e58aa029cfcbc23b8ed716019b7416ae1 +sphinxcontrib-serializinghtml==1.1.10 \ + --hash=sha256:326369b8df80a7d2d8d7f99aa5ac577f51ea51556ed974e7716cfd4fca3f6cb7 \ + --hash=sha256:93f3f5dc458b91b192fe10c397e324f262cf163d79f3282c158e8436a2c4511f # via sphinx -urllib3==2.1.0 \ - --hash=sha256:55901e917a5896a349ff771be919f8bd99aff50b79fe58fec595eb37bbc56bb3 \ - --hash=sha256:df7aa8afb0148fa78488e7899b2c59b5f4ffcfa82e6c54ccb9dd37c1d7b52d54 +urllib3==2.2.2 \ + --hash=sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472 \ + --hash=sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168 # via requests diff --git a/llvm/docs/requirements.txt b/llvm/docs/requirements.txt index 960a6eb644e1..5753a6640d66 100644 --- a/llvm/docs/requirements.txt +++ b/llvm/docs/requirements.txt @@ -1,9 +1,9 @@ -sphinx==7.2.6 -docutils==0.20.1 +sphinx==7.3.7 +docutils==0.21.2 sphinx-markdown-tables==0.0.17 recommonmark==0.7.1 sphinx-automodapi==0.17.0 sphinx-bootstrap-theme==0.8.1 sphinxcontrib-applehelp==1.0.8 -furo==2024.1.29 -myst-parser==2.0.0 +furo==2024.5.6 +myst-parser==3.0.1 diff --git a/llvm/include/llvm/ADT/FunctionExtras.h b/llvm/include/llvm/ADT/FunctionExtras.h index 49e0e8ab0db4..a21541c4d378 100644 --- a/llvm/include/llvm/ADT/FunctionExtras.h +++ b/llvm/include/llvm/ADT/FunctionExtras.h @@ -152,7 +152,7 @@ template class UniqueFunctionBase { void *StoragePtr; size_t Size; size_t Alignment; - } OutOfLineStorage; + } OutOfLineStorage = {}; static_assert( sizeof(OutOfLineStorageT) <= InlineStorageSize, "Should always use all of the out-of-line storage for inline storage!"); diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h index 8f988d01cb2a..8dc6210109ce 100644 --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -1194,7 +1194,8 @@ class indexed_accessor_iterator return index - rhs.index; } bool operator==(const indexed_accessor_iterator &rhs) const { - return base == rhs.base && index == rhs.index; + assert(base == rhs.base && "incompatible iterators"); + return index == rhs.index; } bool operator<(const indexed_accessor_iterator &rhs) const { assert(base == rhs.base && "incompatible iterators"); diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp index a804deb44618..d10395c9d544 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -1427,8 +1427,8 @@ unsigned DWARFVerifier::verifyNameIndexAttribute( } if (AttrEnc.Index == dwarf::DW_IDX_parent) { - constexpr static auto AllowedForms = {dwarf::Form::DW_FORM_flag_present, - dwarf::Form::DW_FORM_ref4}; + static constexpr dwarf::Form AllowedForms[] = {dwarf::Form::DW_FORM_flag_present, + dwarf::Form::DW_FORM_ref4}; if (!is_contained(AllowedForms, AttrEnc.Form)) { ErrorCategory.Report("Unexpected NameIndex Abbreviation", [&]() { error() << formatv( diff --git a/llvm/utils/git/requirements.txt b/llvm/utils/git/requirements.txt index e354c91a4d5b..5410e85a1678 100644 --- a/llvm/utils/git/requirements.txt +++ b/llvm/utils/git/requirements.txt @@ -4,9 +4,7 @@ # # pip-compile --generate-hashes --output-file=requirements.txt requirements.txt.in # -certifi==2024.2.2 \ - --hash=sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f \ - --hash=sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1 +certifi==2024.7.4 # via # -r requirements.txt.in # requests @@ -158,39 +156,7 @@ charset-normalizer==3.3.2 \ --hash=sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519 \ --hash=sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561 # via requests -cryptography==42.0.5 \ - --hash=sha256:0270572b8bd2c833c3981724b8ee9747b3ec96f699a9665470018594301439ee \ - --hash=sha256:111a0d8553afcf8eb02a4fea6ca4f59d48ddb34497aa8706a6cf536f1a5ec576 \ - --hash=sha256:16a48c23a62a2f4a285699dba2e4ff2d1cff3115b9df052cdd976a18856d8e3d \ - --hash=sha256:1b95b98b0d2af784078fa69f637135e3c317091b615cd0905f8b8a087e86fa30 \ - --hash=sha256:1f71c10d1e88467126f0efd484bd44bca5e14c664ec2ede64c32f20875c0d413 \ - --hash=sha256:2424ff4c4ac7f6b8177b53c17ed5d8fa74ae5955656867f5a8affaca36a27abb \ - --hash=sha256:2bce03af1ce5a5567ab89bd90d11e7bbdff56b8af3acbbec1faded8f44cb06da \ - --hash=sha256:329906dcc7b20ff3cad13c069a78124ed8247adcac44b10bea1130e36caae0b4 \ - --hash=sha256:37dd623507659e08be98eec89323469e8c7b4c1407c85112634ae3dbdb926fdd \ - --hash=sha256:3eaafe47ec0d0ffcc9349e1708be2aaea4c6dd4978d76bf6eb0cb2c13636c6fc \ - --hash=sha256:5e6275c09d2badf57aea3afa80d975444f4be8d3bc58f7f80d2a484c6f9485c8 \ - --hash=sha256:6fe07eec95dfd477eb9530aef5bead34fec819b3aaf6c5bd6d20565da607bfe1 \ - --hash=sha256:7367d7b2eca6513681127ebad53b2582911d1736dc2ffc19f2c3ae49997496bc \ - --hash=sha256:7cde5f38e614f55e28d831754e8a3bacf9ace5d1566235e39d91b35502d6936e \ - --hash=sha256:9481ffe3cf013b71b2428b905c4f7a9a4f76ec03065b05ff499bb5682a8d9ad8 \ - --hash=sha256:98d8dc6d012b82287f2c3d26ce1d2dd130ec200c8679b6213b3c73c08b2b7940 \ - --hash=sha256:a011a644f6d7d03736214d38832e030d8268bcff4a41f728e6030325fea3e400 \ - --hash=sha256:a2913c5375154b6ef2e91c10b5720ea6e21007412f6437504ffea2109b5a33d7 \ - --hash=sha256:a30596bae9403a342c978fb47d9b0ee277699fa53bbafad14706af51fe543d16 \ - --hash=sha256:b03c2ae5d2f0fc05f9a2c0c997e1bc18c8229f392234e8a0194f202169ccd278 \ - --hash=sha256:b6cd2203306b63e41acdf39aa93b86fb566049aeb6dc489b70e34bcd07adca74 \ - --hash=sha256:b7ffe927ee6531c78f81aa17e684e2ff617daeba7f189f911065b2ea2d526dec \ - --hash=sha256:b8cac287fafc4ad485b8a9b67d0ee80c66bf3574f655d3b97ef2e1082360faf1 \ - --hash=sha256:ba334e6e4b1d92442b75ddacc615c5476d4ad55cc29b15d590cc6b86efa487e2 \ - --hash=sha256:ba3e4a42397c25b7ff88cdec6e2a16c2be18720f317506ee25210f6d31925f9c \ - --hash=sha256:c41fb5e6a5fe9ebcd58ca3abfeb51dffb5d83d6775405305bfa8715b76521922 \ - --hash=sha256:cd2030f6650c089aeb304cf093f3244d34745ce0cfcc39f20c6fbfe030102e2a \ - --hash=sha256:cd65d75953847815962c84a4654a84850b2bb4aed3f26fadcc1c13892e1e29f6 \ - --hash=sha256:e4985a790f921508f36f81831817cbc03b102d643b5fcb81cd33df3fa291a1a1 \ - --hash=sha256:e807b3188f9eb0eaa7bbb579b462c5ace579f1cedb28107ce8b48a9f7ad3679e \ - --hash=sha256:f12764b8fffc7a123f641d7d049d382b73f96a34117e0b637b80643169cec8ac \ - --hash=sha256:f8837fe1d6ac4a8052a9a8ddab256bc006242696f03368a4009be7ee3075cdb7 +cryptography==43.0.1 # via pyjwt deprecated==1.2.14 \ --hash=sha256:6fac8b097794a90302bdbb17b9b815e732d3c4720583ff1b198499d78470466c \ @@ -200,13 +166,9 @@ gitdb==4.0.11 \ --hash=sha256:81a3407ddd2ee8df444cbacea00e2d038e40150acfa3001696fe0dcf1d3adfa4 \ --hash=sha256:bf5421126136d6d0af55bc1e7c1af1c397a34f5b7bd79e776cd3e89785c2b04b # via gitpython -gitpython==3.1.43 \ - --hash=sha256:35f314a9f878467f5453cc1fee295c3e18e52f1b99f10f6cf5b1682e968a9e7c \ - --hash=sha256:eec7ec56b92aad751f9912a73404bc02ba212a23adb2c7098ee668417051a1ff +gitpython==3.1.41 # via -r requirements.txt.in -idna==3.7 \ - --hash=sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc \ - --hash=sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0 +idna==3.7 # via requests pycparser==2.22 \ --hash=sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6 \ @@ -232,17 +194,15 @@ pynacl==1.5.0 \ --hash=sha256:a422368fc821589c228f4c49438a368831cb5bbc0eab5ebe1d7fac9dded6567b \ --hash=sha256:e46dae94e34b085175f8abb3b0aaa7da40767865ac82c928eeb9e57e1ea8a543 # via pygithub -requests==2.31.0 \ - --hash=sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f \ - --hash=sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1 +requests==2.32.0 # via pygithub smmap==5.0.1 \ --hash=sha256:dceeb6c0028fdb6734471eb07c0cd2aae706ccaecab45965ee83f11c8d3b1f62 \ --hash=sha256:e6d8668fa5f93e706934a62d7b4db19c8d9eb8cf2adbb75ef1b675aa332b69da # via gitdb -urllib3==2.2.1 \ - --hash=sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d \ - --hash=sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19 +types-cryptography==3.3.23.2 + # via pyjwt +urllib3==1.26.19 # via requests wrapt==1.16.0 \ --hash=sha256:0d2691979e93d06a95a26257adb7bfd0c93818e89b1406f5a28f36e0d8c1e1fc \ diff --git a/llvm/utils/git/requirements_formatting.txt b/llvm/utils/git/requirements_formatting.txt index 4c9dbd8755ab..8b8dc81e961d 100644 --- a/llvm/utils/git/requirements_formatting.txt +++ b/llvm/utils/git/requirements_formatting.txt @@ -4,11 +4,11 @@ # # pip-compile --output-file=llvm/utils/git/requirements_formatting.txt llvm/utils/git/requirements_formatting.txt.in # -black==23.12.1 +black==24.3.0 # via # -r llvm/utils/git/requirements_formatting.txt.in # darker -certifi==2024.2.2 +certifi==2024.7.4 # via requests cffi==1.16.0 # via @@ -18,7 +18,7 @@ charset-normalizer==3.3.2 # via requests click==8.1.7 # via black -cryptography==42.0.5 +cryptography==43.0.1 # via pyjwt darker==1.7.2 # via -r llvm/utils/git/requirements_formatting.txt.in @@ -42,11 +42,11 @@ pyjwt[crypto]==2.8.0 # via pygithub pynacl==1.5.0 # via pygithub -requests==2.31.0 +requests==2.32.2 # via pygithub toml==0.10.2 # via darker -urllib3==2.2.1 +urllib3==2.2.2 # via requests wrapt==1.16.0 # via deprecated diff --git a/llvm/utils/git/requirements_formatting.txt.in b/llvm/utils/git/requirements_formatting.txt.in index 4aac571af1cf..244cb435a01b 100644 --- a/llvm/utils/git/requirements_formatting.txt.in +++ b/llvm/utils/git/requirements_formatting.txt.in @@ -1,3 +1,3 @@ -black~=23.0 +black~=24.3 darker==1.7.2 PyGithub==1.59.1 diff --git a/llvm/utils/vscode/llvm/package-lock.json b/llvm/utils/vscode/llvm/package-lock.json index 9559768c1919..839a18209283 100644 --- a/llvm/utils/vscode/llvm/package-lock.json +++ b/llvm/utils/vscode/llvm/package-lock.json @@ -358,9 +358,9 @@ } }, "node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, "bin": { "semver": "bin/semver" diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt index c6d44908a111..3a42a1bfa67e 100644 --- a/mlir/CMakeLists.txt +++ b/mlir/CMakeLists.txt @@ -131,6 +131,10 @@ set(MLIR_ENABLE_NVPTXCOMPILER 0 CACHE BOOL set(MLIR_ENABLE_PDL_IN_PATTERNMATCH 1 CACHE BOOL "Enable PDL in PatternMatch") +option(MLIR_DIALECT_SPIRV_ENABLE + "Enable build targets related to SPIR-V dialect." + ON) + option(MLIR_INCLUDE_TESTS "Generate build targets for the MLIR unit tests." ${LLVM_INCLUDE_TESTS}) diff --git a/mlir/examples/toy/Ch5/toyc.cpp b/mlir/examples/toy/Ch5/toyc.cpp index 6a0c6318bae2..dd4e90084534 100644 --- a/mlir/examples/toy/Ch5/toyc.cpp +++ b/mlir/examples/toy/Ch5/toyc.cpp @@ -10,6 +10,7 @@ // //===----------------------------------------------------------------------===// +#include "mlir/Dialect/Bufferization/Extensions/AllExtensions.h" #include "mlir/Dialect/Func/Extensions/AllExtensions.h" #include "mlir/IR/Diagnostics.h" #include "toy/AST.h" @@ -116,6 +117,7 @@ int loadMLIR(llvm::SourceMgr &sourceMgr, mlir::MLIRContext &context, int dumpMLIR() { mlir::DialectRegistry registry; mlir::func::registerAllExtensions(registry); + mlir::bufferization::registerAllExtensions(registry); mlir::MLIRContext context(registry); // Load our Dialect in this MLIR Context. diff --git a/mlir/examples/toy/Ch6/toyc.cpp b/mlir/examples/toy/Ch6/toyc.cpp index c244b31434ba..ca695f0f2c15 100644 --- a/mlir/examples/toy/Ch6/toyc.cpp +++ b/mlir/examples/toy/Ch6/toyc.cpp @@ -10,6 +10,7 @@ // //===----------------------------------------------------------------------===// +#include "mlir/Dialect/Bufferization/Extensions/AllExtensions.h" #include "mlir/Dialect/Func/Extensions/AllExtensions.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "toy/AST.h" @@ -299,6 +300,7 @@ int main(int argc, char **argv) { // If we aren't dumping the AST, then we are compiling with/to MLIR. mlir::DialectRegistry registry; mlir::func::registerAllExtensions(registry); + mlir::bufferization::registerAllExtensions(registry); mlir::MLIRContext context(registry); // Load our Dialect in this MLIR Context. diff --git a/mlir/examples/toy/Ch7/toyc.cpp b/mlir/examples/toy/Ch7/toyc.cpp index fea56796adf1..c9aaf4d4dca5 100644 --- a/mlir/examples/toy/Ch7/toyc.cpp +++ b/mlir/examples/toy/Ch7/toyc.cpp @@ -10,6 +10,7 @@ // //===----------------------------------------------------------------------===// +#include "mlir/Dialect/Bufferization/Extensions/AllExtensions.h" #include "mlir/Dialect/Func/Extensions/AllExtensions.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "toy/AST.h" @@ -300,6 +301,7 @@ int main(int argc, char **argv) { // If we aren't dumping the AST, then we are compiling with/to MLIR. mlir::DialectRegistry registry; mlir::func::registerAllExtensions(registry); + mlir::bufferization::registerAllExtensions(registry); mlir::MLIRContext context(registry); // Load our Dialect in this MLIR Context. diff --git a/mlir/include/mlir/Conversion/Passes.h b/mlir/include/mlir/Conversion/Passes.h index 208f26489d6c..69d9dfd8f790 100644 --- a/mlir/include/mlir/Conversion/Passes.h +++ b/mlir/include/mlir/Conversion/Passes.h @@ -70,7 +70,7 @@ #include "mlir/Conversion/TosaToLinalg/TosaToLinalg.h" #include "mlir/Conversion/TosaToMLProgram/TosaToMLProgram.h" #include "mlir/Conversion/TosaToSCF/TosaToSCF.h" -#include "mlir/Conversion/TosaToTensor/TosaToTensor.h" +/* #include "mlir/Conversion/TosaToTensor/TosaToTensor.h" */ #include "mlir/Conversion/UBToLLVM/UBToLLVM.h" #include "mlir/Conversion/UBToSPIRV/UBToSPIRV.h" #include "mlir/Conversion/VectorToArmSME/VectorToArmSME.h" diff --git a/mlir/include/mlir/Conversion/Passes.td b/mlir/include/mlir/Conversion/Passes.td index 748646e60582..49de0c47624e 100644 --- a/mlir/include/mlir/Conversion/Passes.td +++ b/mlir/include/mlir/Conversion/Passes.td @@ -1216,18 +1216,18 @@ def TosaToSCF : Pass<"tosa-to-scf"> { // TosaToTensor //===----------------------------------------------------------------------===// -def TosaToTensor : Pass<"tosa-to-tensor"> { - let summary = "Lower TOSA to the Tensor dialect"; - let dependentDialects = [ - "tensor::TensorDialect", - ]; - let description = [{ - Pass that converts TOSA operations to the equivalent operations using the - operations in the Tensor dialect. - }]; - - let constructor = "tosa::createTosaToTensor()"; -} +// def TosaToTensor : Pass<"tosa-to-tensor"> { +// let summary = "Lower TOSA to the Tensor dialect"; +// let dependentDialects = [ +// "tensor::TensorDialect", +// ]; +// let description = [{ +// Pass that converts TOSA operations to the equivalent operations using the +// operations in the Tensor dialect. +// }]; +// +// let constructor = "tosa::createTosaToTensor()"; +//} //===----------------------------------------------------------------------===// // UBToLLVM diff --git a/mlir/include/mlir/Dialect/Bufferization/Extensions/AllExtensions.h b/mlir/include/mlir/Dialect/Bufferization/Extensions/AllExtensions.h new file mode 100644 index 000000000000..eae89c628e22 --- /dev/null +++ b/mlir/include/mlir/Dialect/Bufferization/Extensions/AllExtensions.h @@ -0,0 +1,29 @@ +//===- AllExtensions.h - Bufferization dialect extensions -------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_BUFFERIZATION_EXTENSIONS_ALLEXTENSIONS_H_ +#define MLIR_DIALECT_BUFFERIZATION_EXTENSIONS_ALLEXTENSIONS_H_ + +namespace mlir { +class DialectRegistry; + +namespace bufferization { +/// Register all extensions of the bufferization dialect. This should generally +/// only be used by tools, or other use cases that really do want *all* +/// extensions of the dialect. All other cases should prefer to instead register +/// the specific extensions they intend to take advantage of. +void registerAllExtensions(DialectRegistry ®istry); + +/// Register the extension used to support one-shot bufferization for *builtin* +/// types. This is a special function since it extends the Builtin dialect, not +/// Bufferization dialect. +void registerBufferizerExtensionForBuiltinDialect(DialectRegistry ®istry); +} // namespace bufferization +} // namespace mlir + +#endif // MLIR_DIALECT_BUFFERIZATION_EXTENSIONS_ALLEXTENSIONS_H_ diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/Bufferization.h b/mlir/include/mlir/Dialect/Bufferization/IR/Bufferization.h index 6f19dca2e822..1362d75b100d 100644 --- a/mlir/include/mlir/Dialect/Bufferization/IR/Bufferization.h +++ b/mlir/include/mlir/Dialect/Bufferization/IR/Bufferization.h @@ -68,6 +68,11 @@ LogicalResult foldToMemrefToTensorPair(RewriterBase &rewriter, void populateDeallocOpCanonicalizationPatterns(RewritePatternSet &patterns, MLIRContext *context); +/// Returns a BufferizerInterface::getTensorTypeFromMemRefType() result, +/// performing custom memref -> tensor type conversion for user types and +/// builtins. +Type getTensorTypeFromMemRefType(Type type); + } // namespace bufferization } // namespace mlir diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td index 1c70a4b8df92..96543ffe75df 100644 --- a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td +++ b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td @@ -389,7 +389,7 @@ def Bufferization_ToTensorOp : Bufferization_Op<"to_tensor", [ SameOperandsAndResultElementType, TypesMatchWith<"result type matches tensor equivalent of 'memref'", "memref", "result", - "memref::getTensorTypeFromMemRefType($_self)"> + "bufferization::getTensorTypeFromMemRefType($_self)"> ]> { let summary = "create a tensor from a `memref`"; let description = [{ @@ -495,7 +495,7 @@ def Bufferization_ToMemrefOp : Bufferization_Op<"to_memref", [ Pure, TypesMatchWith<"type of 'tensor' is the tensor equivalent of 'memref'", "memref", "tensor", - "memref::getTensorTypeFromMemRefType($_self)"> + "bufferization::getTensorTypeFromMemRefType($_self)"> ]> { let summary = "cast a tensor to memref"; let description = [{ diff --git a/mlir/include/mlir/Dialect/CMakeLists.txt b/mlir/include/mlir/Dialect/CMakeLists.txt index f71023519733..3e652d6de8d0 100644 --- a/mlir/include/mlir/Dialect/CMakeLists.txt +++ b/mlir/include/mlir/Dialect/CMakeLists.txt @@ -34,7 +34,9 @@ add_subdirectory(Quant) add_subdirectory(SCF) add_subdirectory(Shape) add_subdirectory(SparseTensor) -add_subdirectory(SPIRV) +if(MLIR_DIALECT_SPIRV_ENABLE) + add_subdirectory(SPIRV) +endif() add_subdirectory(Tensor) add_subdirectory(Tosa) add_subdirectory(Transform) @@ -42,4 +44,4 @@ add_subdirectory(UB) add_subdirectory(Utils) add_subdirectory(Vector) add_subdirectory(X86Vector) -add_subdirectory(XeGPU) +# add_subdirectory(XeGPU) diff --git a/mlir/include/mlir/Dialect/Quant/QuantDialectBytecode.td b/mlir/include/mlir/Dialect/Quant/QuantDialectBytecode.td index bd9cdf823822..6c1e2b01f4ca 100644 --- a/mlir/include/mlir/Dialect/Quant/QuantDialectBytecode.td +++ b/mlir/include/mlir/Dialect/Quant/QuantDialectBytecode.td @@ -81,6 +81,37 @@ def UniformQuantizedPerAxisType: DialectType<(type }]; } +def QuantileQuantizedType: DialectType<(type + VarInt:$flags, + Type:$storageType, + Type:$quantileType, + Type:$expressedType, + Array:$quantiles, + DoubleAPFloat:$scale, + SignedVarInt:$zeroPoint, + SignedVarInt:$storageTypeMin, + SignedVarInt:$storageTypeMax +)>; + +def QuantileQuantizedPerAxisType: DialectType<(type + VarInt:$flags, + Type:$storageType, + Type:$quantileType, + Type:$expressedType, + VarInt:$quantizedDimension, + SignedVarInt:$storageTypeMin, + SignedVarInt:$storageTypeMax, + Array:$quantiles, + Array:$scales, + Array:$zeroPoints +)> { + // Note: builder order differs from bytecode. + let cBuilder = [{ + get<$_resultType>(context, flags, storageType, quantileType, expressedType, quantiles, scales, + zeroPoints, quantizedDimension, storageTypeMin, storageTypeMax) + }]; +} + /// This enum contains marker codes used to indicate which attribute is /// currently being decoded, and how it should be decoded. The order of these /// codes should generally be unchanged, as any changes will inevitably break @@ -93,7 +124,9 @@ def QuantDialectTypes : DialectTypes<"Quant"> { AnyQuantizedTypeWithExpressedType, CalibratedQuantizedType, UniformQuantizedType, - UniformQuantizedPerAxisType + UniformQuantizedPerAxisType, + QuantileQuantizedType, + QuantileQuantizedPerAxisType ]; } diff --git a/mlir/include/mlir/Dialect/Quant/QuantOpsBase.td b/mlir/include/mlir/Dialect/Quant/QuantOpsBase.td index da822d0a61de..820219c1ed17 100644 --- a/mlir/include/mlir/Dialect/Quant/QuantOpsBase.td +++ b/mlir/include/mlir/Dialect/Quant/QuantOpsBase.td @@ -67,8 +67,38 @@ def quant_UniformQuantizedType : CPred<"::llvm::isa($_self)">, "UniformQuantizedType">; +// An implementation of UniformQuantizedPerAxisType. +def quant_UniformQuantizedPerAxisType : + DialectType($_self)">, + "UniformQuantizedPerAxisType">; + +// An implementation of QuantileQuantizedType. +def quant_QuantileQuantizedType : + DialectType($_self)">, + "QuantileQuantizedType">; + +// An implementation of QuantileQuantizedPerAxisType. +def quant_QuantileQuantizedPerAxisType : + DialectType($_self)">, + "QuantileQuantizedPerAxisType">; + // Predicate for detecting a container or primitive of UniformQuantizedType. def quant_UniformQuantizedValueType : quant_TypedPrimitiveOrContainer; +// Predicate for detecting a container or primitive of UniformQuantizedPerAxisType. +def quant_UniformQuantizedPerAxisValueType : + quant_TypedPrimitiveOrContainer; + +// Predicate for detecting a container or primitive of QuantileQuantizedType. +def quant_QuantileQuantizedValueType : + quant_TypedPrimitiveOrContainer; + +// Predicate for detecting a container or primitive of QuantileQuantizedPerAxisType. +def quant_QuantileQuantizedPerAxisValueType : + quant_TypedPrimitiveOrContainer; + #endif // DIALECT_QUANT_QUANT_OPS_BASE_ diff --git a/mlir/include/mlir/Dialect/Quant/QuantTypes.h b/mlir/include/mlir/Dialect/Quant/QuantTypes.h index de5aed0a91a2..6a6d3a54891c 100644 --- a/mlir/include/mlir/Dialect/Quant/QuantTypes.h +++ b/mlir/include/mlir/Dialect/Quant/QuantTypes.h @@ -25,6 +25,8 @@ struct QuantizedTypeStorage; struct AnyQuantizedTypeStorage; struct UniformQuantizedTypeStorage; struct UniformQuantizedPerAxisTypeStorage; +struct QuantileQuantizedTypeStorage; +struct QuantileQuantizedPerAxisTypeStorage; struct CalibratedQuantizedTypeStorage; } // namespace detail @@ -82,6 +84,18 @@ class QuantizedType : public Type { return llvm::maxUIntN(integralWidth); } + static constexpr int64_t getDefaultMaximumForF8E4M3FN() { return 448; } + + static constexpr int64_t getDefaultMinimumForF8E4M3FN() { + return -getDefaultMaximumForF8E4M3FN(); + } + + static constexpr int64_t getDefaultMaximumForF8E5M2() { return 57344; } + + static constexpr int64_t getDefaultMinimumForF8E5M2() { + return -getDefaultMaximumForF8E5M2(); + } + /// Gets the original expressed type that this quantized type approximates. /// Note that this presumes that the quantized type was always derived from /// a floating point type, which in the broadest definition, is not true (i.e. @@ -282,6 +296,8 @@ class UniformQuantizedType int64_t zeroPoint, int64_t storageTypeMin, int64_t storageTypeMax); + static bool classof(mlir::Type type); + /// Gets the scale term. The scale designates the difference between the real /// values corresponding to consecutive quantized values differing by 1. double getScale() const; @@ -345,6 +361,8 @@ class UniformQuantizedPerAxisType int32_t quantizedDimension, int64_t storageTypeMin, int64_t storageTypeMax); + static bool classof(mlir::Type type); + /// Gets the quantization scales. The scales designate the difference between /// the real values corresponding to consecutive quantized values differing /// by 1. The ith scale corresponds to the ith slice in the @@ -378,6 +396,148 @@ class UniformQuantizedPerAxisType } }; +/// QuantileQuantizedType derives from UniformQuantizedType and adds to it a +/// look up table array of quantile values. The type of the data in the look up table is determined by +/// the quantileType member: supported quantileType types are integer/unsigned/hf8/bf8/f16/bf16/f32/f64. +/// +/// Syntax synopsis: +/// Per-layer, all parameters expressed: +/// !quant +/// Per-layer, optional parameters omitted: +/// !quant +/// +/// StorageType: 'i'|'u' NumBits +/// QuantileType: 'i'|'u' NumBits, 'hf8', 'bf8', 'f16', 'bf16', 'f32', 'f64' +/// ExpressedType: 'f16', 'f32', 'bf16', 'f64' +/// Quantiles: Quantile+ +/// Quantile: A legal double value +/// Scale: A legal double value +/// ZeroPoint: An integer value +class QuantileQuantizedType + : public Type::TypeBase { +public: + using Base::Base; + using Base::getChecked; + + static constexpr StringLiteral name = "quant.quantile"; + + /// Gets an instance of the type with all parameters specified but not + /// checked. + static QuantileQuantizedType get(unsigned flags, Type storageType, + Type quantileType, Type expressedType, + ArrayRef quantiles, double scale, + int64_t zeroPoint, int64_t storageTypeMin, + int64_t storageTypeMax); + + static QuantileQuantizedType + getChecked(function_ref emitError, unsigned flags, + Type storageType, Type quantileType, Type expressedType, + ArrayRef quantiles, double scale, int64_t zeroPoint, + int64_t storageTypeMin, int64_t storageTypeMax); + + /// Verifies construction invariants and issues errors/warnings. + static LogicalResult verify(function_ref emitError, + unsigned flags, Type storageType, + Type quantileType, Type expressedType, + ArrayRef quantiles, double scale, + int64_t zeroPoint, int64_t storageTypeMin, + int64_t storageTypeMax); + + static bool classof(mlir::Type type); + + /// Gets the quantileType + Type getQuantileType() const; + + /// Gets the quantileType bit width + unsigned getQuantileTypeIntegralWidth() const; + + /// Gets the quantile values + ArrayRef getQuantiles() const; + + // Fixed point values are real numbers divided by a scale. + // Currently, only signed storage types are treated as fixed point. + // A fixed point value can be obtained from an affine value by subtracting + // the zeroPoint. + // In the future, this may be explicit versus implied by type and zeroPoint. + bool isFixedPoint() const { return isSigned() && getZeroPoint() == 0; } +}; + +/// Represents per-axis QuantileQuantizedType (also known as per-channel +/// quantization). The type of the data in the look up table is determined by the +/// quantileType member: supported quantileType types are integer/unsigned/hf8/bf8/f16/bf16/f32/f64. +/// +/// Syntax synopsis: +/// Per-axis, all parameters expressed: +/// !quant +/// Per-axis, optional parameters omitted: +/// !quant +/// +/// StorageType: 'i'|'u' NumBits +/// QuantileType: 'i'|'u' NumBits, 'hf8', 'bf8', 'f16', 'bf16', 'f32', 'f64' +/// ExpressedType: 'f16', 'f32', 'bf16', 'f64' +/// QuantizedDim: An integer value +/// Quantiles: Quantile+ +/// Quantile: A legal double value +/// QuantParams: (Scale ':' ZeroPoint)+ +/// Scale: A legal double value +/// ZeroPoint: An integer value +class QuantileQuantizedPerAxisType + : public Type::TypeBase { +public: + using Base::Base; + using Base::getChecked; + + static constexpr StringLiteral name = "quant.quantile_per_axis"; + + /// Gets an instance of the type with all parameters specified but not + /// checked. + static QuantileQuantizedPerAxisType + get(unsigned flags, Type storageType, Type quantileType, Type expressedType, + ArrayRef quantiles, ArrayRef scales, + ArrayRef zeroPoints, int32_t quantizedDimension, + int64_t storageTypeMin, int64_t storageTypeMax); + + /// Gets an instance of the type with all specified parameters checked. + /// Returns a nullptr convertible type on failure. + static QuantileQuantizedPerAxisType + getChecked(function_ref emitError, unsigned flags, + Type storageType, Type quantileType, Type expressedType, + ArrayRef quantiles, ArrayRef scales, + ArrayRef zeroPoints, int32_t quantizedDimension, + int64_t storageTypeMin, int64_t storageTypeMax); + + /// Verifies construction invariants and issues errors/warnings. + static LogicalResult + verify(function_ref emitError, unsigned flags, + Type storageType, Type quantileType, Type expressedType, + ArrayRef quantiles, ArrayRef scales, + ArrayRef zeroPoints, int32_t quantizedDimension, + int64_t storageTypeMin, int64_t storageTypeMax); + + static bool classof(mlir::Type type); + + /// Gets the quantileType + Type getQuantileType() const; + + /// Gets the quantileType bit width + unsigned getQuantileTypeIntegralWidth() const; + + /// Gets the quantile values + ArrayRef getQuantiles() const; + + /// Fixed point values are real numbers divided by a scale. + /// Currently, only signed storage types are treated as fixed point. + /// A fixed point value can be obtained from an affine value by subtracting + /// the zeroPoint. + /// In the future, this may be explicit versus implied by type and zeroPoint. + bool isFixedPoint() const { + return isSigned() && !llvm::is_contained(getZeroPoints(), 0); + } +}; + /// A quantized type that infers its range from given min/max values. /// /// Typical syntax: diff --git a/mlir/include/mlir/IR/BuiltinTypeInterfaces.td b/mlir/include/mlir/IR/BuiltinTypeInterfaces.td index db38e2e1bce2..61d357a909d5 100644 --- a/mlir/include/mlir/IR/BuiltinTypeInterfaces.td +++ b/mlir/include/mlir/IR/BuiltinTypeInterfaces.td @@ -104,24 +104,20 @@ def ShapedTypeInterface : TypeInterface<"ShapedType"> { /// Return the number of elements present in the given shape. static int64_t getNumElements(ArrayRef shape); + }]; + let extraSharedClassDeclaration = [{ /// Return a clone of this type with the given new shape and element type. - /// The returned type is ranked, even if this type is unranked. auto clone(::llvm::ArrayRef shape, Type elementType) { - return cloneWith(shape, elementType); + return $_type.cloneWith(shape, elementType); } - /// Return a clone of this type with the given new shape. The returned type - /// is ranked, even if this type is unranked. + /// Return a clone of this type with the given new shape. auto clone(::llvm::ArrayRef shape) { - return cloneWith(shape, getElementType()); + return $_type.cloneWith(shape, $_type.getElementType()); } - }]; - let extraSharedClassDeclaration = [{ - /// Return a clone of this type with the given new element type. The - /// returned type is ranked if and only if this type is ranked. In that - /// case, the returned type has the same shape as this type. + /// Return a clone of this type with the given new element type. auto clone(::mlir::Type elementType) { return $_type.cloneWith(/*shape=*/std::nullopt, elementType); } @@ -188,4 +184,68 @@ def ShapedTypeInterface : TypeInterface<"ShapedType"> { }]; } +//===----------------------------------------------------------------------===// +// TensorTypeInterface +//===----------------------------------------------------------------------===// + +def TensorTypeInterface : TypeInterface<"TensorType", [ + ShapedTypeInterface + ] + > { + let cppNamespace = "::mlir"; + let description = [{ + This interface provides a shared interface for ranked and unranked type + and customized tensor types. + + This class attaches the ShapedTypeInterface to act as a mixin to + provide many useful utility functions. + }]; + + let extraClassDeclaration = [{ + // Return true if the specified element type is ok in a tensor. + static bool isValidElementType(::mlir::Type type); + }]; + + let extraClassOf = [{ + return $_type.hasTrait<::mlir::TensorType::Trait>(); + }]; + +} + +//===----------------------------------------------------------------------===// +// BaseMemRefTypeInterface +//===----------------------------------------------------------------------===// + +def BaseMemRefTypeInterface : TypeInterface<"BaseMemRefType", [ + ShapedTypeInterface + ] + > { + let cppNamespace = "::mlir"; + let description = [{ + This interface provides a shared interface for ranked and unranked memref and + customized memref types. + + This interface attaches the ShapedTypeInterface to act as a mixin to + provide many useful utility functions. + }]; + + let methods = [ + InterfaceMethod<[{ + Returns the memory space in which data referred to by this memref resides. + }], + "::mlir::Attribute", "getMemorySpace">, + ]; + + let extraClassDeclaration = [{ + // Return true if the specified element type is ok in a memref. + static bool isValidElementType(::mlir::Type type); + + unsigned getMemorySpaceAsInt() const; + }]; + + let extraClassOf = [{ + return $_type.hasTrait<::mlir::BaseMemRefType::Trait>(); + }]; +} + #endif // MLIR_IR_BUILTINTYPEINTERFACES_TD_ diff --git a/mlir/include/mlir/IR/BuiltinTypes.h b/mlir/include/mlir/IR/BuiltinTypes.h index 4250be90ba7f..93de0919460c 100644 --- a/mlir/include/mlir/IR/BuiltinTypes.h +++ b/mlir/include/mlir/IR/BuiltinTypes.h @@ -85,108 +85,6 @@ class FloatType : public Type { const llvm::fltSemantics &getFloatSemantics(); }; -//===----------------------------------------------------------------------===// -// TensorType -//===----------------------------------------------------------------------===// - -/// Tensor types represent multi-dimensional arrays, and have two variants: -/// RankedTensorType and UnrankedTensorType. -/// Note: This class attaches the ShapedType trait to act as a mixin to -/// provide many useful utility functions. This inheritance has no effect -/// on derived tensor types. -class TensorType : public Type, public ShapedType::Trait { -public: - using Type::Type; - - /// Returns the element type of this tensor type. - Type getElementType() const; - - /// Returns if this type is ranked, i.e. it has a known number of dimensions. - bool hasRank() const; - - /// Returns the shape of this tensor type. - ArrayRef getShape() const; - - /// Clone this type with the given shape and element type. If the - /// provided shape is `std::nullopt`, the current shape of the type is used. - TensorType cloneWith(std::optional> shape, - Type elementType) const; - - // Make sure that base class overloads are visible. - using ShapedType::Trait::clone; - - /// Return a clone of this type with the given new shape and element type. - /// The returned type is ranked, even if this type is unranked. - RankedTensorType clone(ArrayRef shape, Type elementType) const; - - /// Return a clone of this type with the given new shape. The returned type - /// is ranked, even if this type is unranked. - RankedTensorType clone(ArrayRef shape) const; - - /// Return true if the specified element type is ok in a tensor. - static bool isValidElementType(Type type); - - /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool classof(Type type); - - /// Allow implicit conversion to ShapedType. - operator ShapedType() const { return llvm::cast(*this); } -}; - -//===----------------------------------------------------------------------===// -// BaseMemRefType -//===----------------------------------------------------------------------===// - -/// This class provides a shared interface for ranked and unranked memref types. -/// Note: This class attaches the ShapedType trait to act as a mixin to -/// provide many useful utility functions. This inheritance has no effect -/// on derived memref types. -class BaseMemRefType : public Type, public ShapedType::Trait { -public: - using Type::Type; - - /// Returns the element type of this memref type. - Type getElementType() const; - - /// Returns if this type is ranked, i.e. it has a known number of dimensions. - bool hasRank() const; - - /// Returns the shape of this memref type. - ArrayRef getShape() const; - - /// Clone this type with the given shape and element type. If the - /// provided shape is `std::nullopt`, the current shape of the type is used. - BaseMemRefType cloneWith(std::optional> shape, - Type elementType) const; - - // Make sure that base class overloads are visible. - using ShapedType::Trait::clone; - - /// Return a clone of this type with the given new shape and element type. - /// The returned type is ranked, even if this type is unranked. - MemRefType clone(ArrayRef shape, Type elementType) const; - - /// Return a clone of this type with the given new shape. The returned type - /// is ranked, even if this type is unranked. - MemRefType clone(ArrayRef shape) const; - - /// Return true if the specified element type is ok in a memref. - static bool isValidElementType(Type type); - - /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool classof(Type type); - - /// Returns the memory space in which data referred to by this memref resides. - Attribute getMemorySpace() const; - - /// [deprecated] Returns the memory space in old raw integer representation. - /// New `Attribute getMemorySpace()` method should be used instead. - unsigned getMemorySpaceAsInt() const; - - /// Allow implicit conversion to ShapedType. - operator ShapedType() const { return llvm::cast(*this); } -}; - } // namespace mlir //===----------------------------------------------------------------------===// @@ -399,10 +297,6 @@ SliceVerificationResult isRankReducedType(ShapedType originalType, // Deferred Method Definitions //===----------------------------------------------------------------------===// -inline bool BaseMemRefType::classof(Type type) { - return llvm::isa(type); -} - inline bool BaseMemRefType::isValidElementType(Type type) { return type.isIntOrIndexOrFloat() || llvm::isa( @@ -469,10 +363,6 @@ inline FloatType FloatType::getF128(MLIRContext *ctx) { return Float128Type::get(ctx); } -inline bool TensorType::classof(Type type) { - return llvm::isa(type); -} - //===----------------------------------------------------------------------===// // Type Utilities //===----------------------------------------------------------------------===// diff --git a/mlir/include/mlir/IR/BuiltinTypes.td b/mlir/include/mlir/IR/BuiltinTypes.td index 0b3532dcc7d4..56ec6d97433f 100644 --- a/mlir/include/mlir/IR/BuiltinTypes.td +++ b/mlir/include/mlir/IR/BuiltinTypes.td @@ -423,8 +423,8 @@ def Builtin_Integer : Builtin_Type<"Integer", "integer"> { //===----------------------------------------------------------------------===// def Builtin_MemRef : Builtin_Type<"MemRef", "memref", [ - ShapedTypeInterface - ], "BaseMemRefType"> { + BaseMemRefTypeInterface + ]> { let summary = "Shaped reference to a region of memory"; let description = [{ Syntax: @@ -675,7 +675,7 @@ def Builtin_MemRef : Builtin_Type<"MemRef", "memref", [ "unsigned":$memorySpaceInd)> ]; let extraClassDeclaration = [{ - using BaseMemRefType::clone; + using ShapedType::Trait::clone; using ShapedType::Trait::getElementTypeBitWidth; using ShapedType::Trait::getRank; using ShapedType::Trait::getNumElements; @@ -693,6 +693,13 @@ def Builtin_MemRef : Builtin_Type<"MemRef", "memref", [ /// New `Attribute getMemorySpace()` method should be used instead. unsigned getMemorySpaceAsInt() const; + /// Returns if this type is ranked (always true). + bool hasRank() const { return true; } + + /// Returns a clone of this type with the given shape and element + /// type. If a shape is not provided, the current shape of the type is used. + MemRefType cloneWith(std::optional> shape, + Type elementType) const; }]; let skipDefaultBuilders = 1; let genVerifyDecl = 1; @@ -773,8 +780,8 @@ def Builtin_Opaque : Builtin_Type<"Opaque", "opaque"> { //===----------------------------------------------------------------------===// def Builtin_RankedTensor : Builtin_Type<"RankedTensor", "tensor", [ - ShapedTypeInterface, ValueSemantics - ], "TensorType"> { + TensorTypeInterface, ValueSemantics + ]> { let summary = "Multi-dimensional array with a fixed number of dimensions"; let description = [{ Syntax: @@ -855,7 +862,7 @@ def Builtin_RankedTensor : Builtin_Type<"RankedTensor", "tensor", [ }]> ]; let extraClassDeclaration = [{ - using TensorType::clone; + using ShapedType::Trait::clone; using ShapedType::Trait::getElementTypeBitWidth; using ShapedType::Trait::getRank; using ShapedType::Trait::getNumElements; @@ -869,11 +876,12 @@ def Builtin_RankedTensor : Builtin_Type<"RankedTensor", "tensor", [ /// Arguments that are passed into the builder must outlive the builder. class Builder; - /// Return a clone of this type with the given new element type and the same - /// shape as this type. - RankedTensorType clone(::mlir::Type elementType) { - return ::llvm::cast(cloneWith(getShape(), elementType)); - } + /// Returns if this type is ranked (always true). + bool hasRank() const { return true; } + + /// Returns a clone of this type with the given shape and element type. + RankedTensorType cloneWith(std::optional> shape, + Type elementType) const; }]; let skipDefaultBuilders = 1; let genVerifyDecl = 1; @@ -951,8 +959,8 @@ def Builtin_Tuple : Builtin_Type<"Tuple", "tuple"> { //===----------------------------------------------------------------------===// def Builtin_UnrankedMemRef : Builtin_Type<"UnrankedMemRef", "unranked_memref", [ - ShapedTypeInterface - ], "BaseMemRefType"> { + BaseMemRefTypeInterface + ]> { let summary = "Shaped reference, with unknown rank, to a region of memory"; let description = [{ Syntax: @@ -998,7 +1006,7 @@ def Builtin_UnrankedMemRef : Builtin_Type<"UnrankedMemRef", "unranked_memref", [ }]> ]; let extraClassDeclaration = [{ - using BaseMemRefType::clone; + using ShapedType::Trait::clone; using ShapedType::Trait::getElementTypeBitWidth; using ShapedType::Trait::getRank; using ShapedType::Trait::getNumElements; @@ -1014,11 +1022,12 @@ def Builtin_UnrankedMemRef : Builtin_Type<"UnrankedMemRef", "unranked_memref", [ /// New `Attribute getMemorySpace()` method should be used instead. unsigned getMemorySpaceAsInt() const; - /// Return a clone of this type with the given new element type and the same - /// shape as this type. - MemRefType clone(::mlir::Type elementType) { - return ::llvm::cast(cloneWith(getShape(), elementType)); - } + /// Returns if this type is ranked (always false). + bool hasRank() const { return false; } + + /// Returns a clone of this type with the given shape and element type. + BaseMemRefType cloneWith(std::optional> shape, + Type elementType) const; }]; let skipDefaultBuilders = 1; let genVerifyDecl = 1; @@ -1029,8 +1038,8 @@ def Builtin_UnrankedMemRef : Builtin_Type<"UnrankedMemRef", "unranked_memref", [ //===----------------------------------------------------------------------===// def Builtin_UnrankedTensor : Builtin_Type<"UnrankedTensor", "unranked_tensor", [ - ShapedTypeInterface, ValueSemantics - ], "TensorType"> { + TensorTypeInterface, ValueSemantics + ]> { let summary = "Multi-dimensional array with unknown dimensions"; let description = [{ Syntax: @@ -1057,7 +1066,7 @@ def Builtin_UnrankedTensor : Builtin_Type<"UnrankedTensor", "unranked_tensor", [ }]> ]; let extraClassDeclaration = [{ - using TensorType::clone; + using ShapedType::Trait::clone; using ShapedType::Trait::getElementTypeBitWidth; using ShapedType::Trait::getRank; using ShapedType::Trait::getNumElements; @@ -1068,6 +1077,13 @@ def Builtin_UnrankedTensor : Builtin_Type<"UnrankedTensor", "unranked_tensor", [ using ShapedType::Trait::getDynamicDimIndex; ArrayRef getShape() const { return std::nullopt; } + + /// Returns if this type is ranked (always false). + bool hasRank() const { return false; } + + /// Returns a clone of this type with the given shape and element type. + TensorType cloneWith(std::optional> shape, + Type elementType) const; }]; let skipDefaultBuilders = 1; let genVerifyDecl = 1; diff --git a/mlir/include/mlir/IR/OpImplementation.h b/mlir/include/mlir/IR/OpImplementation.h index fa435cb3155e..43284d13f815 100644 --- a/mlir/include/mlir/IR/OpImplementation.h +++ b/mlir/include/mlir/IR/OpImplementation.h @@ -116,6 +116,16 @@ class AsmPrinter { /// Return the raw output stream used by this printer. virtual raw_ostream &getStream() const; + /// Print a newline and indent the printer to the start of the current + /// operation. + virtual void printNewline(); + + /// Increase indentation. + virtual void increaseIndent(); + + /// Decrease indentation. + virtual void decreaseIndent(); + /// Print the given floating point value in a stabilized form that can be /// roundtripped through the IR. This is the companion to the 'parseFloat' /// hook on the AsmParser. @@ -417,16 +427,6 @@ class OpAsmPrinter : public AsmPrinter { /// Print a loc(...) specifier if printing debug info is enabled. virtual void printOptionalLocationSpecifier(Location loc) = 0; - /// Print a newline and indent the printer to the start of the current - /// operation. - virtual void printNewline() = 0; - - /// Increase indentation. - virtual void increaseIndent() = 0; - - /// Decrease indentation. - virtual void decreaseIndent() = 0; - /// Print a block argument in the usual format of: /// %ssaName : type {attr1=42} loc("here") /// where location printing is controlled by the standard internal option. @@ -1569,13 +1569,19 @@ class OpAsmParser : public AsmParser { SmallVectorImpl &result) { size_t operandSize = llvm::range_size(operands); size_t typeSize = llvm::range_size(types); - if (operandSize != typeSize) + if (typeSize != 0 && operandSize != typeSize) return emitError(loc) << operandSize << " operands present, but expected " << typeSize; - for (auto [operand, type] : llvm::zip_equal(operands, types)) - if (resolveOperand(operand, type, result)) - return failure(); + if (typeSize == 0) { + for (auto it : operands) + if (resolveOperand(it, Type(), result)) + return failure(); + } else { + for (auto [operand, type] : llvm::zip_equal(operands, types)) + if (resolveOperand(operand, type, result)) + return failure(); + } return success(); } diff --git a/mlir/include/mlir/IR/SymbolInterfaces.td b/mlir/include/mlir/IR/SymbolInterfaces.td index a8b04d045311..f715d82199bd 100644 --- a/mlir/include/mlir/IR/SymbolInterfaces.td +++ b/mlir/include/mlir/IR/SymbolInterfaces.td @@ -171,11 +171,6 @@ def Symbol : OpInterface<"SymbolOpInterface"> { if (concreteOp.isDeclaration() && concreteOp.isPublic()) return concreteOp.emitOpError("symbol declaration cannot have public " "visibility"); - auto parent = $_op->getParentOp(); - if (parent && !parent->hasTrait() && parent->isRegistered()) { - return concreteOp.emitOpError("symbol's parent must have the SymbolTable " - "trait"); - } return success(); }]; @@ -227,4 +222,6 @@ def SymbolUserOpInterface : OpInterface<"SymbolUserOpInterface"> { // Op defines a symbol table. def SymbolTable : NativeOpTrait<"SymbolTable">; +def SymbolContainer : NativeOpTrait<"SymbolContainer">; + #endif // MLIR_IR_SYMBOLINTERFACES diff --git a/mlir/include/mlir/IR/SymbolTable.h b/mlir/include/mlir/IR/SymbolTable.h index 597c6a9a1d89..e7c50691308e 100644 --- a/mlir/include/mlir/IR/SymbolTable.h +++ b/mlir/include/mlir/IR/SymbolTable.h @@ -259,6 +259,12 @@ class SymbolTable { StringAttr newSymbolName, Region *from); + static LogicalResult replaceAllSymbolUses(Operation *oldSymbol, + SymbolRefAttr newSymbolName, + Operation *from); + static LogicalResult replaceAllSymbolUses(Operation *oldSymbol, + SymbolRefAttr newSymbolName, + Region *from); private: Operation *symbolTableOp; @@ -405,6 +411,7 @@ class SymbolUserMap { /// Replace all of the uses of the given symbol with `newSymbolName`. void replaceAllUsesWith(Operation *symbol, StringAttr newSymbolName); + void replaceAllUsesWith(Operation *symbol, SymbolRefAttr newSymbolName); private: /// A reference to the symbol table used to construct this map. @@ -465,6 +472,40 @@ class SymbolTable : public TraitBase { } }; +template +class SymbolContainer : public TraitBase { + public: + static LogicalResult verifyTrait(Operation *op) { + return mlir::success(); //TODO::implement + } + + /// Look up a symbol with the specified name, returning null if no such + /// name exists. Symbol names never include the @ on them. Note: This + /// performs a linear scan of held symbols. + Operation *lookupSymbol(StringAttr name) { + return mlir::SymbolTable::lookupSymbolIn(this->getOperation(), name); + } + template + T lookupSymbol(StringAttr name) { + return dyn_cast_or_null(lookupSymbol(name)); + } + Operation *lookupSymbol(SymbolRefAttr symbol) { + return mlir::SymbolTable::lookupSymbolIn(this->getOperation(), symbol); + } + template + T lookupSymbol(SymbolRefAttr symbol) { + return dyn_cast_or_null(lookupSymbol(symbol)); + } + + Operation *lookupSymbol(StringRef name) { + return mlir::SymbolTable::lookupSymbolIn(this->getOperation(), name); + } + template + T lookupSymbol(StringRef name) { + return dyn_cast_or_null(lookupSymbol(name)); + } +}; + } // namespace OpTrait //===----------------------------------------------------------------------===// diff --git a/mlir/include/mlir/InitAllDialects.h b/mlir/include/mlir/InitAllDialects.h index 549c26c72d8a..e0ab246e3804 100644 --- a/mlir/include/mlir/InitAllDialects.h +++ b/mlir/include/mlir/InitAllDialects.h @@ -92,7 +92,7 @@ #include "mlir/Dialect/Vector/Transforms/BufferizableOpInterfaceImpl.h" #include "mlir/Dialect/Vector/Transforms/SubsetOpInterfaceImpl.h" #include "mlir/Dialect/X86Vector/X86VectorDialect.h" -#include "mlir/Dialect/XeGPU/IR/XeGPU.h" +/* #include "mlir/Dialect/XeGPU/IR/XeGPU.h" */ #include "mlir/IR/Dialect.h" #include "mlir/Interfaces/CastInterfaces.h" #include "mlir/Target/LLVM/NVVM/Target.h" @@ -147,8 +147,8 @@ inline void registerAllDialects(DialectRegistry ®istry) { transform::TransformDialect, ub::UBDialect, vector::VectorDialect, - x86vector::X86VectorDialect, - xegpu::XeGPUDialect>(); + x86vector::X86VectorDialect + /*xegpu::XeGPUDialect*/>(); // clang-format on // Register all external models. diff --git a/mlir/include/mlir/InitAllExtensions.h b/mlir/include/mlir/InitAllExtensions.h index 20a4ab6f18a2..f79457510ce9 100644 --- a/mlir/include/mlir/InitAllExtensions.h +++ b/mlir/include/mlir/InitAllExtensions.h @@ -25,6 +25,7 @@ #include "mlir/Conversion/UBToLLVM/UBToLLVM.h" #include "mlir/Dialect/Affine/TransformOps/AffineTransformOps.h" #include "mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.h" +#include "mlir/Dialect/Bufferization/Extensions/AllExtensions.h" #include "mlir/Dialect/Func/Extensions/AllExtensions.h" #include "mlir/Dialect/Func/TransformOps/FuncTransformOps.h" #include "mlir/Dialect/GPU/TransformOps/GPUTransformOps.h" @@ -85,6 +86,8 @@ inline void registerAllExtensions(DialectRegistry ®istry) { // Translation extensions need to be registered by calling // `registerAllToLLVMIRTranslations` (see All.h). + + bufferization::registerAllExtensions(registry); } } // namespace mlir diff --git a/mlir/include/mlir/InitAllPasses.h b/mlir/include/mlir/InitAllPasses.h index 1b9c1b193ace..2fb35859a007 100644 --- a/mlir/include/mlir/InitAllPasses.h +++ b/mlir/include/mlir/InitAllPasses.h @@ -44,7 +44,7 @@ #include "mlir/Dialect/Tosa/Transforms/Passes.h" #include "mlir/Dialect/Transform/Transforms/Passes.h" #include "mlir/Dialect/Vector/Transforms/Passes.h" -#include "mlir/Dialect/XeGPU/Transforms/Passes.h" +/* #include "mlir/Dialect/XeGPU/Transforms/Passes.h" */ #include "mlir/Transforms/Passes.h" #include @@ -92,7 +92,7 @@ inline void registerAllPasses() { arm_sme::registerArmSMEPasses(); arm_sve::registerArmSVEPasses(); emitc::registerEmitCPasses(); - xegpu::registerXeGPUPasses(); + /* xegpu::registerXeGPUPasses(); */ // Dialect pipelines bufferization::registerBufferizationPipelines(); diff --git a/mlir/include/mlir/Interfaces/SideEffectInterfaces.h b/mlir/include/mlir/Interfaces/SideEffectInterfaces.h index aef7ec622fe4..e8d1d2514a9f 100644 --- a/mlir/include/mlir/Interfaces/SideEffectInterfaces.h +++ b/mlir/include/mlir/Interfaces/SideEffectInterfaces.h @@ -147,7 +147,7 @@ class EffectInstance { effectOnFullRegion(effectOnFullRegion) {} template ::value, + llvm::is_one_of::value, bool> = true> EffectInstance(EffectT *effect, T value, Resource *resource = DefaultResource::get()) @@ -155,7 +155,7 @@ class EffectInstance { effectOnFullRegion(false) {} template ::value, + llvm::is_one_of::value, bool> = true> EffectInstance(EffectT *effect, T value, int stage, bool effectOnFullRegion, Resource *resource = DefaultResource::get()) @@ -223,6 +223,9 @@ class EffectInstance { if (OpResult result = llvm::dyn_cast_if_present(value)) { return result; } + if (Value result = llvm::dyn_cast_if_present(value)) { + return result; + } return cast_if_present(value); } @@ -264,7 +267,7 @@ class EffectInstance { /// The Symbol, OpOperand, OpResult or BlockArgument that the effect applies /// to. This is optionally null. - PointerUnion value; + PointerUnion value; /// Additional parameters of the effect instance. An attribute is used for /// type-safe structured storage and context-based uniquing. Concrete effects diff --git a/mlir/include/mlir/Pass/Pass.h b/mlir/include/mlir/Pass/Pass.h index 7725a3a2910b..e8afc8e9e916 100644 --- a/mlir/include/mlir/Pass/Pass.h +++ b/mlir/include/mlir/Pass/Pass.h @@ -296,6 +296,10 @@ class Pass { /// Copy the option values from 'other', which is another instance of this /// pass. void copyOptionValuesFrom(const Pass *other); + + /// Copy the option values from 'other', which are PassPipeline options. + /// Here we copy only those options that have the same argument name. + void copyOptionValuesFrom(const detail::PassOptions &other); private: /// Out of line virtual method to ensure vtables and metadata are emitted to a diff --git a/mlir/include/mlir/Pass/PassOptions.h b/mlir/include/mlir/Pass/PassOptions.h index 6bffa84f7b16..68dafad3e323 100644 --- a/mlir/include/mlir/Pass/PassOptions.h +++ b/mlir/include/mlir/Pass/PassOptions.h @@ -302,6 +302,9 @@ class PassOptions : protected llvm::cl::SubCommand { /// Copy the option values from 'other' into 'this', where 'other' has the /// same options as 'this'. void copyOptionValuesFrom(const PassOptions &other); + + /// Copy only those options that have the same argument name. + void matchAndCopyOptionValuesFrom(const PassOptions &otherPassOptions); /// Parse options out as key=value pairs that can then be handed off to the /// `llvm::cl` command line passing infrastructure. Everything is space @@ -340,7 +343,7 @@ class PassOptions : protected llvm::cl::SubCommand { /// ListOption someListFlag{*this, "flag-name", llvm::cl::desc("...")}; /// }; template -class PassPipelineOptions : public detail::PassOptions { +class PassPipelineOptions : public virtual detail::PassOptions { public: /// Factory that parses the provided options and returns a unique_ptr to the /// struct. diff --git a/mlir/include/mlir/Pass/PassRegistry.h b/mlir/include/mlir/Pass/PassRegistry.h index 08874f012199..f9cdee683d3f 100644 --- a/mlir/include/mlir/Pass/PassRegistry.h +++ b/mlir/include/mlir/Pass/PassRegistry.h @@ -44,6 +44,9 @@ using PassAllocatorFunction = std::function()>; // PassRegistry //===----------------------------------------------------------------------===// +/// Prints the passes that were previously registered and stored in passRegistry +void printRegisteredPasses(); + /// Structure to group information about a passes and pass pipelines (argument /// to invoke via mlir-opt, description, pass pipeline builder). class PassRegistryEntry { diff --git a/mlir/include/mlir/Support/Timing.h b/mlir/include/mlir/Support/Timing.h index a8a4bfd1c6cf..983b57059abc 100644 --- a/mlir/include/mlir/Support/Timing.h +++ b/mlir/include/mlir/Support/Timing.h @@ -17,6 +17,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringMapEntry.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/Format.h" #include namespace mlir { @@ -367,6 +368,53 @@ class OutputStrategy { raw_ostream &os; }; +constexpr llvm::StringLiteral kTimingDescription = + "... Execution time report ..."; + +class OutputTextStrategy : public OutputStrategy { +public: + OutputTextStrategy(raw_ostream &os) : OutputStrategy(os) {} + + void printHeader(const TimeRecord &total) override { + // Figure out how many spaces to description name. + unsigned padding = (80 - kTimingDescription.size()) / 2; + os << "===" << std::string(73, '-') << "===\n"; + os.indent(padding) << kTimingDescription << '\n'; + os << "===" << std::string(73, '-') << "===\n"; + + // Print the total time followed by the section headers. + os << llvm::format(" Total Execution Time: %.4f seconds\n\n", total.wall); + if (total.user != total.wall) + os << " ----User Time----"; + os << " ----Wall Time---- ----Name----\n"; + } + + void printFooter() override { os.flush(); } + + void printTime(const TimeRecord &time, const TimeRecord &total) override { + if (total.user != total.wall) { + os << llvm::format(" %8.4f (%5.1f%%)", time.user, + 100.0 * time.user / total.user); + } + os << llvm::format(" %8.4f (%5.1f%%) ", time.wall, + 100.0 * time.wall / total.wall); + } + + void printListEntry(StringRef name, const TimeRecord &time, + const TimeRecord &total, bool lastEntry) override { + printTime(time, total); + os << name << "\n"; + } + + void printTreeEntry(unsigned indent, StringRef name, const TimeRecord &time, + const TimeRecord &total) override { + printTime(time, total); + os.indent(indent) << name << "\n"; + } + + void printTreeEntryEnd(unsigned indent, bool lastEntry) override {} +}; + //===----------------------------------------------------------------------===// // DefaultTimingManager //===----------------------------------------------------------------------===// diff --git a/mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h b/mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h index d0ca188abcc2..170bd84408bc 100644 --- a/mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h +++ b/mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h @@ -119,6 +119,13 @@ class MlirOptMainConfig { return success(); } + /// List the registered passes and return. + MlirOptMainConfig &listPasses(bool list) { + listPassesFlag = list; + return *this; + } + bool shouldListPasses() const { return listPassesFlag; } + /// Enable running the reproducer information stored in resources (if /// present). MlirOptMainConfig &runReproducer(bool enableReproducer) { @@ -219,6 +226,9 @@ class MlirOptMainConfig { /// The callback to populate the pass manager. std::function passPipelineCallback; + /// List the registered passes and return. + bool listPassesFlag = false; + /// Enable running the reproducer. bool runReproducerFlag = false; @@ -249,6 +259,11 @@ class MlirOptMainConfig { std::string generateReproducerFileFlag = ""; }; +/// VPUX-specific method to get value for arch kind from command line +/// and register HW-specific passes and pipelines +using AdditionalRegistrationFn = + std::function; + /// This defines the function type used to setup the pass manager. This can be /// used to pass in a callback to setup a default pass pipeline to be applied on /// the loaded IR. @@ -276,18 +291,12 @@ LogicalResult MlirOptMain(llvm::raw_ostream &outputStream, /// Implementation for tools like `mlir-opt`. /// - toolName is used for the header displayed by `--help`. /// - registry should contain all the dialects that can be parsed in the source. +/// - additionalRegistration will be called before the main command line parsing +/// to perform additional registrations. LogicalResult MlirOptMain(int argc, char **argv, llvm::StringRef toolName, - DialectRegistry ®istry); - -/// Implementation for tools like `mlir-opt`. -/// This function can be used with registrationAndParseCLIOptions so that -/// CLI options can be accessed before running MlirOptMain. -/// - inputFilename is the name of the input mlir file. -/// - outputFilename is the name of the output file. -/// - registry should contain all the dialects that can be parsed in the source. -LogicalResult MlirOptMain(int argc, char **argv, llvm::StringRef inputFilename, - llvm::StringRef outputFilename, - DialectRegistry ®istry); + DialectRegistry ®istry, + const AdditionalRegistrationFn &additionalRegistration + = [](llvm::StringRef){}); /// Helper wrapper to return the result of MlirOptMain directly from main. /// diff --git a/mlir/include/mlir/Transforms/BufferizationUtils.h b/mlir/include/mlir/Transforms/BufferizationUtils.h new file mode 100644 index 000000000000..b5fc071809d3 --- /dev/null +++ b/mlir/include/mlir/Transforms/BufferizationUtils.h @@ -0,0 +1,55 @@ +//===- BufferizationUtils.h - One-Shot Bufferization utilities --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines interfaces for various (one-shot) bufferization +// utility methods. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_TRANSFORMS_BUFFERIZATIONUTILS_H +#define MLIR_TRANSFORMS_BUFFERIZATIONUTILS_H + +#include "mlir/IR/BuiltinAttributes.h" +#include "mlir/IR/DialectInterface.h" + +namespace mlir { + +//===----------------------------------------------------------------------===// +// BufferizerInterface +//===----------------------------------------------------------------------===// + +/// This is the interface that must be implemented by the dialects of memref / +/// tensor types to be bufferized. Note that the default implementation for the +/// builtin dialect is provided via the bufferization dialect. +struct DialectBufferizerInterface + : DialectInterface::Base { + DialectBufferizerInterface(Dialect *dialect) : Base(dialect) {} + + //===--------------------------------------------------------------------===// + // Transformation Hooks + //===--------------------------------------------------------------------===// + + /// Hook to customize the behavior of memref -> tensor conversion. Returns a + /// tensor type for the specified memref type. + virtual Type getTensorTypeFromMemRefType(Type type) const = 0; +}; + +/// This wrapper automatically collects DialectBufferizerInterface +/// implementations from all registered dialects. +struct BufferizerInterface + : DialectInterfaceCollection { + using Base::Base; + + /// Dispatches to DialectBufferizerInterface::getTensorTypeFromMemRefType() of + /// the dialect of the specified type. + Type getTensorTypeFromMemRefType(Type type) const; +}; + +} // namespace mlir + +#endif // MLIR_TRANSFORMS_BUFFERIZATIONUTILS_H diff --git a/mlir/include/mlir/Transforms/InliningUtils.h b/mlir/include/mlir/Transforms/InliningUtils.h index 88fc033a6ab7..7d9aff7ee32b 100644 --- a/mlir/include/mlir/Transforms/InliningUtils.h +++ b/mlir/include/mlir/Transforms/InliningUtils.h @@ -172,6 +172,14 @@ class DialectInlinerInterface return result; } + /// Hook to cleanup IR before erase call op + virtual void eraseCall(Operation *call) const; + + /// Hook to get proper place where callable region will be inlined + /// By default returns block of the call operation + virtual std::tuple + getInlineBlockAndPoint(Operation *call) const; + /// Process a set of blocks that have been inlined for a call. This callback /// is invoked before inlined terminator operations have been processed. virtual void processInlinedCallBlocks( diff --git a/mlir/lib/AsmParser/Parser.cpp b/mlir/lib/AsmParser/Parser.cpp index 7181f13d3c8b..c6f45398f8a1 100644 --- a/mlir/lib/AsmParser/Parser.cpp +++ b/mlir/lib/AsmParser/Parser.cpp @@ -1000,16 +1000,24 @@ Value OperationParser::resolveSSAUse(UnresolvedOperand useInfo, Type type) { // If we have already seen a value of this name, return it. if (useInfo.number < entries.size() && entries[useInfo.number].value) { Value result = entries[useInfo.number].value; + // Check that the type matches the other uses. - if (result.getType() == type) - return maybeRecordUse(result); - - emitError(useInfo.location, "use of value '") - .append(useInfo.name, - "' expects different type than prior uses: ", type, " vs ", - result.getType()) - .attachNote(getEncodedSourceLocation(entries[useInfo.number].loc)) - .append("prior use here"); + if (type && result.getType() != type) { + emitError(useInfo.location, "use of value '") + .append(useInfo.name, + "' expects different type than prior uses: ", type, " vs ", + result.getType()) + .attachNote(getEncodedSourceLocation(entries[useInfo.number].loc)) + .append("prior use here"); + return nullptr; + } + + return maybeRecordUse(result); + } + + if (!type) { + emitError(useInfo.location, "forward reference of value '") + .append(useInfo.name, "' requires explicit type specification"); return nullptr; } diff --git a/mlir/lib/Conversion/CMakeLists.txt b/mlir/lib/Conversion/CMakeLists.txt index 80c8b84d9ae8..1c5c628f20d0 100644 --- a/mlir/lib/Conversion/CMakeLists.txt +++ b/mlir/lib/Conversion/CMakeLists.txt @@ -5,7 +5,9 @@ add_subdirectory(ArithToAMDGPU) add_subdirectory(ArithToArmSME) add_subdirectory(ArithToEmitC) add_subdirectory(ArithToLLVM) -add_subdirectory(ArithToSPIRV) +if(MLIR_DIALECT_SPIRV_ENABLE) + add_subdirectory(ArithToSPIRV) +endif() add_subdirectory(ArmNeon2dToIntr) add_subdirectory(ArmSMEToSCF) add_subdirectory(ArmSMEToLLVM) @@ -17,17 +19,23 @@ add_subdirectory(ComplexToSPIRV) add_subdirectory(ComplexToStandard) add_subdirectory(ControlFlowToLLVM) add_subdirectory(ControlFlowToSCF) -add_subdirectory(ControlFlowToSPIRV) add_subdirectory(ConvertToLLVM) -add_subdirectory(ConvertToSPIRV) add_subdirectory(FuncToEmitC) +if(MLIR_DIALECT_SPIRV_ENABLE) + add_subdirectory(ControlFlowToSPIRV) + add_subdirectory(ConvertToSPIRV) +endif() add_subdirectory(FuncToLLVM) -add_subdirectory(FuncToSPIRV) +if(MLIR_DIALECT_SPIRV_ENABLE) + add_subdirectory(FuncToSPIRV) +endif() add_subdirectory(GPUCommon) add_subdirectory(GPUToLLVMSPV) add_subdirectory(GPUToNVVM) add_subdirectory(GPUToROCDL) -add_subdirectory(GPUToSPIRV) +if(MLIR_DIALECT_SPIRV_ENABLE) + add_subdirectory(GPUToSPIRV) +endif() add_subdirectory(GPUToVulkan) add_subdirectory(IndexToLLVM) add_subdirectory(IndexToSPIRV) @@ -37,10 +45,14 @@ add_subdirectory(MathToFuncs) add_subdirectory(MathToLibm) add_subdirectory(MathToLLVM) add_subdirectory(MathToROCDL) -add_subdirectory(MathToSPIRV) add_subdirectory(MemRefToEmitC) +if(MLIR_DIALECT_SPIRV_ENABLE) + add_subdirectory(MathToSPIRV) +endif() add_subdirectory(MemRefToLLVM) -add_subdirectory(MemRefToSPIRV) +if(MLIR_DIALECT_SPIRV_ENABLE) + add_subdirectory(MemRefToSPIRV) +endif() add_subdirectory(NVGPUToNVVM) add_subdirectory(NVVMToLLVM) add_subdirectory(OpenACCToSCF) @@ -51,20 +63,29 @@ add_subdirectory(SCFToControlFlow) add_subdirectory(SCFToEmitC) add_subdirectory(SCFToGPU) add_subdirectory(SCFToOpenMP) -add_subdirectory(SCFToSPIRV) +if(MLIR_DIALECT_SPIRV_ENABLE) + add_subdirectory(SCFToSPIRV) +endif() add_subdirectory(ShapeToStandard) -add_subdirectory(SPIRVToLLVM) +if(MLIR_DIALECT_SPIRV_ENABLE) + add_subdirectory(SPIRVToLLVM) +endif() add_subdirectory(TensorToLinalg) -add_subdirectory(TensorToSPIRV) +if(MLIR_DIALECT_SPIRV_ENABLE) + add_subdirectory(TensorToSPIRV) +endif() add_subdirectory(TosaToArith) add_subdirectory(TosaToLinalg) add_subdirectory(TosaToMLProgram) add_subdirectory(TosaToSCF) -add_subdirectory(TosaToTensor) +# FIXME(askrebko): cannot be compiled: no conversion between ShapedType and TensorType +# add_subdirectory(TosaToTensor) add_subdirectory(UBToLLVM) add_subdirectory(UBToSPIRV) add_subdirectory(VectorToArmSME) add_subdirectory(VectorToGPU) add_subdirectory(VectorToLLVM) add_subdirectory(VectorToSCF) -add_subdirectory(VectorToSPIRV) +if(MLIR_DIALECT_SPIRV_ENABLE) + add_subdirectory(VectorToSPIRV) +endif() diff --git a/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt b/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt index faeb32f2bc8c..6c9ca3e4d1ef 100644 --- a/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt +++ b/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt @@ -1,6 +1,7 @@ -add_mlir_conversion_library(MLIRGPUToVulkanTransforms - ConvertLaunchFuncToVulkanCalls.cpp - ConvertGPULaunchFuncToVulkanLaunchFunc.cpp +if(MLIR_DIALECT_SPIRV_ENABLE) + add_mlir_conversion_library(MLIRGPUToVulkanTransforms + ConvertLaunchFuncToVulkanCalls.cpp + ConvertGPULaunchFuncToVulkanLaunchFunc.cpp DEPENDS MLIRConversionPassIncGen @@ -17,3 +18,22 @@ add_mlir_conversion_library(MLIRGPUToVulkanTransforms MLIRTransforms MLIRTranslateLib ) +else() + add_mlir_conversion_library(MLIRGPUToVulkanTransforms + ConvertLaunchFuncToVulkanCalls.cpp + ConvertGPULaunchFuncToVulkanLaunchFunc.cpp + + DEPENDS + MLIRConversionPassIncGen + + LINK_LIBS PUBLIC + MLIRFuncDialect + MLIRGPUDialect + MLIRIR + MLIRLLVMDialect + MLIRPass + MLIRSupport + MLIRTransforms + MLIRTranslateLib + ) +endif() diff --git a/mlir/lib/Dialect/Arith/IR/CMakeLists.txt b/mlir/lib/Dialect/Arith/IR/CMakeLists.txt index 4beb99ccfdfb..ffcdf46d7a80 100644 --- a/mlir/lib/Dialect/Arith/IR/CMakeLists.txt +++ b/mlir/lib/Dialect/Arith/IR/CMakeLists.txt @@ -22,6 +22,7 @@ add_mlir_dialect_library(MLIRArithDialect MLIRArithOpsInterfacesIncGen LINK_LIBS PUBLIC + MLIRTransformUtils MLIRCastInterfaces MLIRDialect MLIRInferIntRangeCommon diff --git a/mlir/lib/Dialect/Bufferization/CMakeLists.txt b/mlir/lib/Dialect/Bufferization/CMakeLists.txt index 215ec562c981..6e0e69ed4170 100644 --- a/mlir/lib/Dialect/Bufferization/CMakeLists.txt +++ b/mlir/lib/Dialect/Bufferization/CMakeLists.txt @@ -2,3 +2,4 @@ add_subdirectory(IR) add_subdirectory(Pipelines) add_subdirectory(TransformOps) add_subdirectory(Transforms) +add_subdirectory(Extensions) diff --git a/mlir/lib/Dialect/Bufferization/Extensions/AllExtensions.cpp b/mlir/lib/Dialect/Bufferization/Extensions/AllExtensions.cpp new file mode 100644 index 000000000000..3a1a61ab221d --- /dev/null +++ b/mlir/lib/Dialect/Bufferization/Extensions/AllExtensions.cpp @@ -0,0 +1,41 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/Bufferization/Extensions/AllExtensions.h" + +#include "mlir/Dialect/MemRef/IR/MemRef.h" +#include "mlir/IR/BuiltinDialect.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/DialectRegistry.h" +#include "mlir/Transforms/BufferizationUtils.h" + +using namespace mlir; +using namespace mlir::bufferization; + +namespace { +/// Default (one-shot) bufferization interface for the builtin dialect +struct BuiltinBufferizerInterface : DialectBufferizerInterface { + using DialectBufferizerInterface::DialectBufferizerInterface; + + Type getTensorTypeFromMemRefType(Type type) const override { + return memref::getTensorTypeFromMemRefType(type); + } +}; +} // namespace + +void mlir::bufferization::registerAllExtensions(DialectRegistry ®istry) { + registerBufferizerExtensionForBuiltinDialect(registry); +} + +void mlir::bufferization::registerBufferizerExtensionForBuiltinDialect( + DialectRegistry ®istry) { + // default one-shot bufferization interface on *builtin* dialect + registry.addExtension(+[](MLIRContext *ctx, BuiltinDialect *dialect) { + dialect->addInterfaces(); + }); +} diff --git a/mlir/lib/Dialect/Bufferization/Extensions/CMakeLists.txt b/mlir/lib/Dialect/Bufferization/Extensions/CMakeLists.txt new file mode 100644 index 000000000000..df63de6c169f --- /dev/null +++ b/mlir/lib/Dialect/Bufferization/Extensions/CMakeLists.txt @@ -0,0 +1,11 @@ +add_mlir_dialect_library(MLIRBufferizationAllExtensions + AllExtensions.cpp + + ADDITIONAL_HEADER_DIRS + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Bufferization/Extensions + + LINK_LIBS PUBLIC + MLIRDialect + MLIRIR + MLIRTransformUtils + ) diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp index d51d63f243ea..8db3696adb31 100644 --- a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp +++ b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp @@ -711,8 +711,7 @@ void bufferization::replaceOpWithBufferizedValues(RewriterBase &rewriter, if (llvm::isa(opResult.getType())) { // The OpResult is a tensor. Such values are replaced with memrefs during // bufferization. - assert((llvm::isa(replacement.getType()) || - llvm::isa(replacement.getType())) && + assert(llvm::isa(replacement.getType()) && "tensor op result should be replaced with a memref value"); // The existing uses of the OpResult still expect a tensor. Insert a // ToTensorOp. Throughout bufferization, this ToTensorOp will gradually diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp index 04a8ff30ee94..740dfd47c0b7 100644 --- a/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp +++ b/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp @@ -13,7 +13,9 @@ #include "mlir/Dialect/MemRef/IR/MemRef.h" #include "mlir/Dialect/SparseTensor/IR/SparseTensor.h" #include "mlir/Dialect/Tensor/IR/Tensor.h" +#include "mlir/IR/BuiltinTypeInterfaces.h" #include "mlir/IR/Matchers.h" +#include "mlir/Transforms/BufferizationUtils.h" #include using namespace mlir; @@ -130,6 +132,12 @@ LogicalResult mlir::bufferization::foldToMemrefToTensorPair( return success(); } +Type mlir::bufferization::getTensorTypeFromMemRefType(Type type) { + MLIRContext *ctx = type.getContext(); + BufferizerInterface interface(ctx); + return interface.getTensorTypeFromMemRefType(type); +} + void mlir::bufferization::populateDynamicDimSizes( OpBuilder &b, Location loc, Value shapedValue, SmallVector &dynamicDims) { diff --git a/mlir/lib/Dialect/Bufferization/IR/CMakeLists.txt b/mlir/lib/Dialect/Bufferization/IR/CMakeLists.txt index 63dcc1eb233e..03ffe9bbe6b9 100644 --- a/mlir/lib/Dialect/Bufferization/IR/CMakeLists.txt +++ b/mlir/lib/Dialect/Bufferization/IR/CMakeLists.txt @@ -27,4 +27,5 @@ add_mlir_dialect_library(MLIRBufferizationDialect MLIRSubsetOpInterface MLIRTensorDialect MLIRMemRefDialect + MLIRBufferizationAllExtensions ) diff --git a/mlir/lib/Dialect/CMakeLists.txt b/mlir/lib/Dialect/CMakeLists.txt index 80b0ef068d96..41e4bbed12c2 100644 --- a/mlir/lib/Dialect/CMakeLists.txt +++ b/mlir/lib/Dialect/CMakeLists.txt @@ -34,7 +34,9 @@ add_subdirectory(Quant) add_subdirectory(SCF) add_subdirectory(Shape) add_subdirectory(SparseTensor) -add_subdirectory(SPIRV) +if(MLIR_DIALECT_SPIRV_ENABLE) + add_subdirectory(SPIRV) +endif() add_subdirectory(Tensor) add_subdirectory(Tosa) add_subdirectory(Transform) @@ -42,7 +44,7 @@ add_subdirectory(UB) add_subdirectory(Utils) add_subdirectory(Vector) add_subdirectory(X86Vector) -add_subdirectory(XeGPU) +# add_subdirectory(XeGPU) set(LLVM_OPTIONAL_SOURCES Traits.cpp diff --git a/mlir/lib/Dialect/LLVMIR/CMakeLists.txt b/mlir/lib/Dialect/LLVMIR/CMakeLists.txt index 392065b859ee..c4831a0937a4 100644 --- a/mlir/lib/Dialect/LLVMIR/CMakeLists.txt +++ b/mlir/lib/Dialect/LLVMIR/CMakeLists.txt @@ -29,6 +29,7 @@ add_mlir_dialect_library(MLIRLLVMDialect Core LINK_LIBS PUBLIC + MLIRTransformUtils MLIRCallInterfaces MLIRControlFlowInterfaces MLIRDataLayoutInterfaces diff --git a/mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp b/mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp index 7d3d868b326c..729e0fb3d2e2 100644 --- a/mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp +++ b/mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp @@ -153,7 +153,7 @@ DiagnosedSilenceableFailure transform::CreateAsyncGroupsOp::applyToOne( /// Returns true if the given type has the default memory space. static bool hasDefaultMemorySpace(BaseMemRefType type) { - return !type.getMemorySpace() || type.getMemorySpaceAsInt() == 0; + return !type.getMemorySpace(); } /// Returns true if the given type has the shared (workgroup) memory space. diff --git a/mlir/lib/Dialect/Quant/IR/QuantOps.cpp b/mlir/lib/Dialect/Quant/IR/QuantOps.cpp index c9a6bbc9ceee..124733286ce8 100644 --- a/mlir/lib/Dialect/Quant/IR/QuantOps.cpp +++ b/mlir/lib/Dialect/Quant/IR/QuantOps.cpp @@ -28,7 +28,8 @@ using namespace mlir::quant::detail; void QuantizationDialect::initialize() { addTypes(); + UniformQuantizedPerAxisType, QuantileQuantizedType, + QuantileQuantizedPerAxisType>(); addOperations< #define GET_OP_LIST #include "mlir/Dialect/Quant/QuantOps.cpp.inc" diff --git a/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp b/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp index 81e3b914755b..5a3500ec4278 100644 --- a/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp +++ b/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp @@ -32,28 +32,38 @@ LogicalResult QuantizedType::verify(function_ref emitError, unsigned flags, Type storageType, Type expressedType, int64_t storageTypeMin, int64_t storageTypeMax) { - // Verify that the storage type is integral. - // This restriction may be lifted at some point in favor of using bf16 - // or f16 as exact representations on hardware where that is advantageous. - auto intStorageType = llvm::dyn_cast(storageType); - if (!intStorageType) - return emitError() << "storage type must be integral"; - unsigned integralWidth = intStorageType.getWidth(); - - // Verify storage width. - if (integralWidth == 0 || integralWidth > MaxStorageBits) - return emitError() << "illegal storage type size: " << integralWidth; - // Verify storageTypeMin and storageTypeMax. bool isSigned = (flags & QuantizationFlags::Signed) == QuantizationFlags::Signed; - int64_t defaultIntegerMin = - getDefaultMinimumForInteger(isSigned, integralWidth); - int64_t defaultIntegerMax = - getDefaultMaximumForInteger(isSigned, integralWidth); - if (storageTypeMax - storageTypeMin <= 0 || - storageTypeMin < defaultIntegerMin || - storageTypeMax > defaultIntegerMax) { + + // Integral storage type width checks + if (storageType.isa()) { + unsigned integralWidth = + llvm::dyn_cast(storageType).getWidth(); + + if (integralWidth == 0 || integralWidth > MaxStorageBits) + return emitError() << "illegal storage type size: " << integralWidth; + } + + int64_t defaultMin, defaultMax; + if (storageType.isa()) { + const auto width = llvm::dyn_cast(storageType).getWidth(); + defaultMin = QuantizedType::getDefaultMinimumForInteger(isSigned, width); + defaultMax = QuantizedType::getDefaultMaximumForInteger(isSigned, width); + } else if (storageType.isa()) { + defaultMin = QuantizedType::getDefaultMinimumForF8E5M2(); + defaultMax = QuantizedType::getDefaultMaximumForF8E5M2(); + } else if (storageType.isa()) { + defaultMin = QuantizedType::getDefaultMinimumForF8E4M3FN(); + defaultMax = QuantizedType::getDefaultMaximumForF8E4M3FN(); + } else { + return emitError() << "illegal storage type, supported types are: integral " + "types, Float8E4M3FNType and Float8E5M2Type "; + } + + // Verify storageTypeMin and storageTypeMax. + if (storageTypeMax - storageTypeMin <= 0 || storageTypeMin < defaultMin || + storageTypeMax > defaultMax) { return emitError() << "illegal storage min and storage max: (" << storageTypeMin << ":" << storageTypeMax << ")"; } @@ -289,12 +299,17 @@ LogicalResult UniformQuantizedType::verify( return emitError() << "expressed type must be floating point"; // Verify scale. - if (scale <= 0.0 || std::isinf(scale) || std::isnan(scale)) + if (std::isinf(scale) || std::isnan(scale)) return emitError() << "illegal scale: " << scale; return success(); } +bool UniformQuantizedType::classof(mlir::Type type) { + return type.getTypeID() == mlir::TypeID::get() || + type.getTypeID() == mlir::TypeID::get(); +} + double UniformQuantizedType::getScale() const { return getImpl()->scale; } int64_t UniformQuantizedType::getZeroPoint() const { @@ -349,13 +364,18 @@ LogicalResult UniformQuantizedPerAxisType::verify( // Verify scale. for (double scale : scales) { - if (scale <= 0.0 || std::isinf(scale) || std::isnan(scale)) + if (std::isinf(scale) || std::isnan(scale)) return emitError() << "illegal scale: " << scale; } return success(); } +bool UniformQuantizedPerAxisType::classof(mlir::Type type) { + return type.getTypeID() == mlir::TypeID::get() || + type.getTypeID() == mlir::TypeID::get(); +} + ArrayRef UniformQuantizedPerAxisType::getScales() const { return getImpl()->getScales(); } @@ -368,6 +388,174 @@ int32_t UniformQuantizedPerAxisType::getQuantizedDimension() const { return getImpl()->quantizedDimension; } +QuantileQuantizedType +QuantileQuantizedType::get(unsigned flags, Type storageType, Type quantileType, + Type expressedType, ArrayRef quantiles, + double scale, int64_t zeroPoint, + int64_t storageTypeMin, int64_t storageTypeMax) { + return Base::get(storageType.getContext(), flags, storageType, quantileType, + expressedType, quantiles, scale, zeroPoint, storageTypeMin, + storageTypeMax); +} + +QuantileQuantizedType QuantileQuantizedType::getChecked( + function_ref emitError, unsigned flags, + Type storageType, Type quantileType, Type expressedType, + ArrayRef quantiles, double scale, int64_t zeroPoint, + int64_t storageTypeMin, int64_t storageTypeMax) { + return Base::getChecked(emitError, storageType.getContext(), flags, + storageType, quantileType, expressedType, quantiles, + scale, zeroPoint, storageTypeMin, storageTypeMax); +} +LogicalResult QuantileQuantizedType::verify( + function_ref emitError, unsigned flags, + Type storageType, Type quantileType, Type expressedType, + ArrayRef quantiles, double scale, int64_t zeroPoint, + int64_t storageTypeMin, int64_t storageTypeMax) { + if (failed(UniformQuantizedType::verify(emitError, flags, storageType, + expressedType, scale, zeroPoint, + storageTypeMin, storageTypeMax))) { + return failure(); + } + + unsigned typeWidth{}; + if (storageType.isa()) { + typeWidth = llvm::dyn_cast(storageType).getWidth(); + } else if (storageType.isa() || + storageType.isa()) { + // Both Float8E5M2Type and Float8E4M3FNType derive from FloatType. + typeWidth = llvm::dyn_cast(storageType).getWidth(); + } else { + return emitError() << "illegal storage type, supported types are: integral " + "types, Float8E4M3FNType and Float8E5M2Type "; + } + + const size_t storageTypeRange = storageTypeMax - storageTypeMin + 1; + const size_t typeWidthSize = 1 << typeWidth; + const size_t expectedSize = + (storageTypeRange < typeWidthSize) ? storageTypeRange : typeWidthSize; + + const auto quantileArraySize = quantiles.size(); + if (quantileArraySize != expectedSize) { + return emitError() << "quantiles array size needs to be equal to " + "2^(bit_size(storageType)), or (storageTypeMax - " + "storageTypeMin + 1) when max and min differ from " + "the type limits; expected: " + << expectedSize << ", found: " << quantileArraySize; + } + + // Verify quantiles + for (double quantile : quantiles) { + if (std::isinf(quantile) || std::isnan(quantile)) { + return emitError() << "illegal quantile value: " << quantile; + } + } + + return success(); +} + +bool QuantileQuantizedType::classof(mlir::Type type) { + return type.getTypeID() == mlir::TypeID::get(); +} + +Type QuantileQuantizedType::getQuantileType() const { + return getImpl()->quantileType; +} + +unsigned QuantileQuantizedType::getQuantileTypeIntegralWidth() const { + return getImpl()->getQuantileType().getIntOrFloatBitWidth(); +} + +ArrayRef QuantileQuantizedType::getQuantiles() const { + return getImpl()->getQuantiles(); +} + +QuantileQuantizedPerAxisType QuantileQuantizedPerAxisType::get( + unsigned flags, Type storageType, Type quantileType, Type expressedType, + ArrayRef quantiles, ArrayRef scales, + ArrayRef zeroPoints, int32_t quantizedDimension, + int64_t storageTypeMin, int64_t storageTypeMax) { + return Base::get(storageType.getContext(), flags, storageType, quantileType, + expressedType, quantiles, scales, zeroPoints, + quantizedDimension, storageTypeMin, storageTypeMax); +} + +QuantileQuantizedPerAxisType QuantileQuantizedPerAxisType::getChecked( + function_ref emitError, unsigned flags, + Type storageType, Type quantileType, Type expressedType, + ArrayRef quantiles, ArrayRef scales, + ArrayRef zeroPoints, int32_t quantizedDimension, + int64_t storageTypeMin, int64_t storageTypeMax) { + return Base::getChecked(emitError, storageType.getContext(), flags, + storageType, quantileType, expressedType, quantiles, + scales, zeroPoints, quantizedDimension, + storageTypeMin, storageTypeMax); +} + +LogicalResult QuantileQuantizedPerAxisType::verify( + function_ref emitError, unsigned flags, + Type storageType, Type quantileType, Type expressedType, + ArrayRef quantiles, ArrayRef scales, + ArrayRef zeroPoints, int32_t quantizedDimension, + int64_t storageTypeMin, int64_t storageTypeMax) { + if (failed(UniformQuantizedPerAxisType::verify( + emitError, flags, storageType, expressedType, scales, zeroPoints, + quantizedDimension, storageTypeMin, storageTypeMax))) { + return failure(); + } + + unsigned typeWidth{}; + if (storageType.isa()) { + typeWidth = llvm::dyn_cast(storageType).getWidth(); + } else if (storageType.isa() || + storageType.isa()) { + // Both Float8E5M2Type and Float8E4M3FNType derive from FloatType. + typeWidth = llvm::dyn_cast(storageType).getWidth(); + } else { + return emitError() << "illegal storage type, supported types are: integral " + "types, Float8E4M3FNType and Float8E5M2Type "; + } + + const size_t storageTypeRange = storageTypeMax - storageTypeMin + 1; + const size_t typeWidthSize = 1 << typeWidth; + const size_t expectedSize = + (storageTypeRange < typeWidthSize) ? storageTypeRange : typeWidthSize; + + const auto quantileArraySize = quantiles.size(); + if (quantileArraySize != expectedSize) { + return emitError() << "quantiles array size needs to be equal to " + "2^(bit_size(storageType)), or (storageTypeMax - " + "storageTypeMin + 1) when max and min differ from " + "the type limits; expected: " + << expectedSize << ", found: " << quantileArraySize; + } + + // Verify quantiles + for (double quantile : quantiles) { + if (std::isinf(quantile) || std::isnan(quantile)) { + return emitError() << "illegal quantile value: " << quantile; + } + } + + return success(); +} + +bool QuantileQuantizedPerAxisType::classof(mlir::Type type) { + return type.getTypeID() == mlir::TypeID::get(); +} + +Type QuantileQuantizedPerAxisType::getQuantileType() const { + return getImpl()->quantileType; +} + +unsigned QuantileQuantizedPerAxisType::getQuantileTypeIntegralWidth() const { + return getImpl()->getQuantileType().getIntOrFloatBitWidth(); +} + +ArrayRef QuantileQuantizedPerAxisType::getQuantiles() const { + return getImpl()->getQuantiles(); +} + CalibratedQuantizedType CalibratedQuantizedType::get(Type expressedType, double min, double max) { return Base::get(expressedType.getContext(), expressedType, min, max); diff --git a/mlir/lib/Dialect/Quant/IR/TypeDetail.h b/mlir/lib/Dialect/Quant/IR/TypeDetail.h index ef098811927c..dc578429734b 100644 --- a/mlir/lib/Dialect/Quant/IR/TypeDetail.h +++ b/mlir/lib/Dialect/Quant/IR/TypeDetail.h @@ -253,6 +253,160 @@ struct UniformQuantizedPerAxisTypeStorage : public QuantizedTypeStorage { int32_t quantizedDimension; }; +struct QuantileQuantizedTypeStorage : public UniformQuantizedTypeStorage { + struct KeyTy : public UniformQuantizedTypeStorage::KeyTy { + KeyTy(unsigned flags, Type storageType, Type quantileType, + Type expressedType, ArrayRef quantiles, double scale, + int64_t zeroPoint, int64_t storageTypeMin, int64_t storageTypeMax) + : UniformQuantizedTypeStorage::KeyTy(flags, storageType, expressedType, + scale, zeroPoint, storageTypeMin, + storageTypeMax), + quantileType(quantileType), quantiles(quantiles) {} + + Type quantileType; + ArrayRef quantiles; + Type getQuantileType() const { return quantileType; } + ArrayRef getQuantiles() const { return quantiles; } + + // Check for equality of two structures that share KeyTy data members + // (by name). + template + static bool genericIsEqual(const T &lhs, const U &rhs) { + return UniformQuantizedTypeStorage::KeyTy::genericIsEqual(lhs, rhs) && + lhs.getQuantileType() == rhs.getQuantileType() && + lhs.getQuantiles() == rhs.getQuantiles(); + } + + bool operator==(const KeyTy &other) const { + return genericIsEqual(*this, other); + } + + unsigned getHashValue() const { + int64_t scaleBits = llvm::bit_cast(scale); + int64_t *quantilesCast = llvm::bit_cast(quantiles.data()); + ArrayRef quantilesBits(quantilesCast, quantiles.size()); + return llvm::hash_combine( + flags, storageType, quantileType, expressedType, + llvm::hash_combine_range(quantilesBits.begin(), quantilesBits.end()), + scaleBits, zeroPoint, storageTypeMin, storageTypeMax); + } + }; + + QuantileQuantizedTypeStorage(const KeyTy &key, ArrayRef quantiles) + : UniformQuantizedTypeStorage(key), quantileType(key.getQuantileType()), + quantilesElements(quantiles.data()), + quantilesParamsSize(quantiles.size()) {} + + bool operator==(const KeyTy &key) const { + return KeyTy::genericIsEqual(*this, key); + } + + /// Construction. + static QuantileQuantizedTypeStorage * + construct(TypeStorageAllocator &allocator, const KeyTy &key) { + ArrayRef quantiles = allocator.copyInto(key.quantiles); + return new (allocator.allocate()) + QuantileQuantizedTypeStorage(key, quantiles); + } + + static unsigned hashKey(const KeyTy &key) { return key.getHashValue(); } + + Type getQuantileType() const { return quantileType; } + + ArrayRef getQuantiles() const { + return ArrayRef(quantilesElements, quantilesParamsSize); + } + + Type quantileType; + const double *quantilesElements; + unsigned quantilesParamsSize; +}; + +struct QuantileQuantizedPerAxisTypeStorage + : public UniformQuantizedPerAxisTypeStorage { + struct KeyTy : public UniformQuantizedPerAxisTypeStorage::KeyTy { + KeyTy(unsigned flags, Type storageType, Type quantileType, + Type expressedType, ArrayRef quantiles, + ArrayRef scales, ArrayRef zeroPoints, + int32_t quantizedDimension, int64_t storageTypeMin, + int64_t storageTypeMax) + : UniformQuantizedPerAxisTypeStorage::KeyTy( + flags, storageType, expressedType, scales, zeroPoints, + quantizedDimension, storageTypeMin, storageTypeMax), + quantileType(quantileType), quantiles(quantiles) {} + + Type quantileType; + ArrayRef quantiles; + Type getQuantileType() const { return quantileType; } + ArrayRef getQuantiles() const { return quantiles; } + + // Check for equality of two structures that share KeyTy data members + // (by name). + template + static bool genericIsEqual(const T &lhs, const U &rhs) { + return UniformQuantizedPerAxisTypeStorage::KeyTy::genericIsEqual(lhs, + rhs) && + lhs.getQuantileType() == rhs.getQuantileType() && + lhs.getQuantiles() == rhs.getQuantiles(); + } + + bool operator==(const KeyTy &other) const { + return genericIsEqual(*this, other); + } + + unsigned getHashValue() const { + int64_t *scalesCast = llvm::bit_cast(scales.data()); + ArrayRef scalesBits(scalesCast, scales.size()); + int64_t *quantilesCast = llvm::bit_cast(quantiles.data()); + ArrayRef quantilesBits(quantilesCast, quantiles.size()); + return llvm::hash_combine( + flags, storageType, quantileType, expressedType, + llvm::hash_combine_range(quantilesBits.begin(), quantilesBits.end()), + llvm::hash_combine_range(scalesBits.begin(), scalesBits.end()), + llvm::hash_combine_range(zeroPoints.begin(), zeroPoints.end()), + storageTypeMin, storageTypeMax); + } + }; + + // We pass quantiles, scales and zeroPoints in directly rather than relying on + // KeyTy because we have to create new reallocated versions in `construct` + // below. + QuantileQuantizedPerAxisTypeStorage(const KeyTy &key, + ArrayRef quantiles, + ArrayRef scales, + ArrayRef zeroPoints) + : UniformQuantizedPerAxisTypeStorage(key, scales, zeroPoints), + quantileType(key.getQuantileType()), + quantilesElements(quantiles.data()), + quantilesParamsSize(quantiles.size()) {} + + bool operator==(const KeyTy &key) const { + return KeyTy::genericIsEqual(*this, key); + } + + /// Construction. + static QuantileQuantizedPerAxisTypeStorage * + construct(TypeStorageAllocator &allocator, const KeyTy &key) { + ArrayRef quantiles = allocator.copyInto(key.quantiles); + ArrayRef scales = allocator.copyInto(key.scales); + ArrayRef zeroPoints = allocator.copyInto(key.zeroPoints); + return new (allocator.allocate()) + QuantileQuantizedPerAxisTypeStorage(key, quantiles, scales, zeroPoints); + } + + static unsigned hashKey(const KeyTy &key) { return key.getHashValue(); } + + Type getQuantileType() const { return quantileType; } + + ArrayRef getQuantiles() const { + return ArrayRef(quantilesElements, quantilesParamsSize); + } + + Type quantileType; + const double *quantilesElements; + unsigned quantilesParamsSize; +}; // namespace detail + struct CalibratedQuantizedTypeStorage : public QuantizedTypeStorage { struct KeyTy { KeyTy(Type expressedType, double min, double max) diff --git a/mlir/lib/Dialect/Quant/IR/TypeParser.cpp b/mlir/lib/Dialect/Quant/IR/TypeParser.cpp index 926a8a0aa13d..1fd148dd4736 100644 --- a/mlir/lib/Dialect/Quant/IR/TypeParser.cpp +++ b/mlir/lib/Dialect/Quant/IR/TypeParser.cpp @@ -21,9 +21,9 @@ using namespace mlir; using namespace quant; -static IntegerType parseStorageType(DialectAsmParser &parser, bool &isSigned) { +static Type parseStorageType(DialectAsmParser &parser, bool &isSigned) { auto typeLoc = parser.getCurrentLocation(); - IntegerType type; + Type type; // Parse storage type (alpha_ident, integer_literal). StringRef identifier; @@ -32,20 +32,32 @@ static IntegerType parseStorageType(DialectAsmParser &parser, bool &isSigned) { if (result.has_value()) { if (!succeeded(*result)) return nullptr; - isSigned = !type.isUnsigned(); - storageTypeWidth = type.getWidth(); - } else if (succeeded(parser.parseKeyword(&identifier))) { - // Otherwise, this must be an unsigned integer (`u` integer-literal). - if (!identifier.consume_front("u")) { - parser.emitError(typeLoc, "illegal storage type prefix"); + if (auto intType = llvm::dyn_cast(type)) { + isSigned = !intType.isUnsigned(); + storageTypeWidth = intType.getWidth(); + } else if (llvm::dyn_cast(type) || + llvm::dyn_cast(type)) { + storageTypeWidth = 8; + isSigned = true; + } else { + parser.emitError(typeLoc, "illegal quantized storage type alias"); return nullptr; } - if (identifier.getAsInteger(10, storageTypeWidth)) { - parser.emitError(typeLoc, "expected storage type width"); + } else if (succeeded(parser.parseKeyword(&identifier))) { + // Otherwise, this must be an unsigned integer (`u` integer-literal) + if (identifier.consume_front("u")) { + if (identifier.getAsInteger(10, storageTypeWidth)) { + parser.emitError(typeLoc, "expected storage type width"); + return nullptr; + } + isSigned = false; + type = parser.getBuilder().getIntegerType(storageTypeWidth); + + } else { + parser.emitError(typeLoc, "illegal quantized storage type alias"); return nullptr; } - isSigned = false; - type = parser.getBuilder().getIntegerType(storageTypeWidth); + } else { return nullptr; } @@ -60,35 +72,93 @@ static IntegerType parseStorageType(DialectAsmParser &parser, bool &isSigned) { return type; } -static ParseResult parseStorageRange(DialectAsmParser &parser, - IntegerType storageType, bool isSigned, - int64_t &storageTypeMin, +static Type parseQuantileType(DialectAsmParser &parser) { + auto typeLoc = parser.getCurrentLocation(); + Type type; + + // Parse storage type (alpha_ident, integer_literal). + StringRef identifier; + unsigned storageTypeWidth = 0; + OptionalParseResult result = parser.parseOptionalType(type); + if (result.has_value()) { + if (!succeeded(*result)) + return nullptr; + + if (!type.isa() && !type.isa()) { + parser.emitError(typeLoc, "illegal quantile type alias"); + return nullptr; + } + } else if (succeeded(parser.parseKeyword(&identifier))) { + // Otherwise, this must be an unsigned integer (`u` integer-literal) + if (identifier.consume_front("u")) { + if (identifier.getAsInteger(10, storageTypeWidth)) { + parser.emitError(typeLoc, "expected quantile type width"); + return nullptr; + } + constexpr bool isSigned = false; + type = parser.getBuilder().getIntegerType(storageTypeWidth, isSigned); + + } else { + parser.emitError(typeLoc, "illegal quantile type alias"); + return nullptr; + } + } else { + return nullptr; + } + + return type; +} + +static ParseResult +checkStorageRange(DialectAsmParser &parser, int64_t storageTypeMin, + int64_t storageTypeMax, int64_t defaultStorageTypeMin, + int64_t defaultStorageTypeMax, SMLoc minLoc, SMLoc maxLoc) { + if (storageTypeMin < defaultStorageTypeMin) { + return parser.emitError(minLoc, "illegal storage type minimum: ") + << storageTypeMin; + } + if (storageTypeMax > defaultStorageTypeMax) { + return parser.emitError(maxLoc, "illegal storage type maximum: ") + << storageTypeMax; + } + return success(); +} + +static ParseResult parseStorageRange(DialectAsmParser &parser, Type storageType, + bool isSigned, int64_t &storageTypeMin, int64_t &storageTypeMax) { - int64_t defaultIntegerMin = QuantizedType::getDefaultMinimumForInteger( - isSigned, storageType.getWidth()); - int64_t defaultIntegerMax = QuantizedType::getDefaultMaximumForInteger( - isSigned, storageType.getWidth()); + int64_t defaultMin, defaultMax; + if (storageType.isa()) { + const auto width = llvm::dyn_cast(storageType).getWidth(); + defaultMin = QuantizedType::getDefaultMinimumForInteger(isSigned, width); + defaultMax = QuantizedType::getDefaultMaximumForInteger(isSigned, width); + } else if (storageType.isa()) { + defaultMin = QuantizedType::getDefaultMinimumForF8E5M2(); + defaultMax = QuantizedType::getDefaultMaximumForF8E5M2(); + } else if (storageType.isa()) { + defaultMin = QuantizedType::getDefaultMinimumForF8E4M3FN(); + defaultMax = QuantizedType::getDefaultMaximumForF8E4M3FN(); + } else { + defaultMin = std::numeric_limits::max(); + defaultMax = std::numeric_limits::min(); + } + if (failed(parser.parseOptionalLess())) { - storageTypeMin = defaultIntegerMin; - storageTypeMax = defaultIntegerMax; + storageTypeMin = defaultMin; + storageTypeMax = defaultMax; return success(); } // Explicit storage min and storage max. + // F8 min and max values are integers, so parseInteger() is used. SMLoc minLoc = parser.getCurrentLocation(), maxLoc; if (parser.parseInteger(storageTypeMin) || parser.parseColon() || parser.getCurrentLocation(&maxLoc) || parser.parseInteger(storageTypeMax) || parser.parseGreater()) return failure(); - if (storageTypeMin < defaultIntegerMin) { - return parser.emitError(minLoc, "illegal storage type minimum: ") - << storageTypeMin; - } - if (storageTypeMax > defaultIntegerMax) { - return parser.emitError(maxLoc, "illegal storage type maximum: ") - << storageTypeMax; - } - return success(); + + return checkStorageRange(parser, storageTypeMin, storageTypeMax, defaultMin, + defaultMax, minLoc, maxLoc); } static FloatType parseExpressedTypeAndRange(DialectAsmParser &parser, @@ -118,7 +188,7 @@ static FloatType parseExpressedTypeAndRange(DialectAsmParser &parser, /// storage-type ::= (`i` | `u`) integer-literal /// expressed-type-spec ::= `:` `f` integer-literal static Type parseAnyType(DialectAsmParser &parser) { - IntegerType storageType; + Type storageType; FloatType expressedType; unsigned typeFlags = 0; int64_t storageTypeMin; @@ -163,8 +233,9 @@ static ParseResult parseQuantParams(DialectAsmParser &parser, double &scale, int64_t &zeroPoint) { // scale[:zeroPoint]? // scale. - if (parser.parseFloat(scale)) + if (parser.parseFloat(scale)) { return failure(); + } // zero point. zeroPoint = 0; @@ -176,7 +247,7 @@ static ParseResult parseQuantParams(DialectAsmParser &parser, double &scale, return parser.parseInteger(zeroPoint); } -/// Parses a UniformQuantizedType. +/// Parses a UniformQuantizedType or a QuantileQuantizedType. /// /// uniform_type ::= uniform_per_layer /// | uniform_per_axis @@ -191,14 +262,34 @@ static ParseResult parseQuantParams(DialectAsmParser &parser, double &scale, /// axis-spec ::= `:` integer-literal /// scale-zero ::= float-literal `:` integer-literal /// scale-zero-list ::= `{` scale-zero (`,` scale-zero)* `}` -static Type parseUniformType(DialectAsmParser &parser) { - IntegerType storageType; +/// +/// quantile_type ::= quantile_per_layer +/// | quantile_per_axis +/// quantile_per_layer ::= `quantile<` storage-spec quantile-type-spec +/// expressed-type-spec `,` quantiles-list `,` +/// scale-zero `>` +/// quantile_per_axis ::= `quantile<` storage-spec quantile-type-spec +/// expressed-type-spec axis-spec `,` quantiles-list +/// scale-zero-list `>` +/// storage-spec ::= storage-type (`<` storage-range `>`)? +/// storage-range ::= integer-literal `:` integer-literal +/// storage-type ::= (`i` | `u`) integer-literal +/// quantile-type-spec ::= `:` ((`i` | `u` | `f`) integer-literal | `f8E5M2` | +/// `f8E4M3FN`) +/// expressed-type-spec ::= `:` `f` integer-literal axis-spec ::= +/// `:` integer-literal quantiles-list ::= `{` quantile (`,` quantile)* `}` +/// scale-zero ::= `:` float-literal `:` integer-literal +/// scale-zero-list ::= `:` `{` scale-zero (`,` scale-zero)* `}` +static Type parseUniformType(DialectAsmParser &parser, bool isQuantile) { + Type storageType; + Type quantileType; FloatType expressedType; unsigned typeFlags = 0; int64_t storageTypeMin; int64_t storageTypeMax; bool isPerAxis = false; int32_t quantizedDimension; + SmallVector quantiles; SmallVector scales; SmallVector zeroPoints; @@ -223,6 +314,17 @@ static Type parseUniformType(DialectAsmParser &parser) { return nullptr; } + // quantile type. + if (isQuantile) { + if (parser.parseColon()) { + return nullptr; + } + quantileType = parseQuantileType(parser); + if (!quantileType) { + return nullptr; + } + } + // Expressed type. if (parser.parseColon() || parser.parseType(expressedType)) { return nullptr; @@ -240,6 +342,28 @@ static Type parseUniformType(DialectAsmParser &parser) { return nullptr; } + // Quantile list + if (isQuantile) { + if (parser.parseLBrace()) { + return nullptr; + } + + do { + quantiles.emplace_back(); + if (parser.parseFloat(quantiles.back())) { + return nullptr; + } + } while (succeeded(parser.parseOptionalComma())); + + if (parser.parseRBrace()) { + return nullptr; + } + + if (parser.parseColon()) { + return nullptr; + } + } + // Parameter specification. // For per-axis, ranges are in a {} delimitted list. if (isPerAxis) { @@ -275,6 +399,24 @@ static Type parseUniformType(DialectAsmParser &parser) { nullptr); } + if (isQuantile) { + ArrayRef quantilesRef(quantiles.begin(), quantiles.end()); + + if (isPerAxis) { + ArrayRef scalesRef(scales.begin(), scales.end()); + ArrayRef zeroPointsRef(zeroPoints.begin(), zeroPoints.end()); + + return parser.getChecked( + typeFlags, storageType, quantileType, expressedType, quantilesRef, + scalesRef, zeroPointsRef, quantizedDimension, storageTypeMin, + storageTypeMax); + } + + return parser.getChecked( + typeFlags, storageType, quantileType, expressedType, quantilesRef, + scales.front(), zeroPoints.front(), storageTypeMin, storageTypeMax); + } + if (isPerAxis) { ArrayRef scalesRef(scales.begin(), scales.end()); ArrayRef zeroPointsRef(zeroPoints.begin(), zeroPoints.end()); @@ -318,13 +460,16 @@ static Type parseCalibratedType(DialectAsmParser &parser) { /// Parse a type registered to this dialect. Type QuantizationDialect::parseType(DialectAsmParser &parser) const { + // All types start with an identifier that we switch on. StringRef typeNameSpelling; if (failed(parser.parseKeyword(&typeNameSpelling))) return nullptr; if (typeNameSpelling == "uniform") - return parseUniformType(parser); + return parseUniformType(parser, false); + if (typeNameSpelling == "quantile") + return parseUniformType(parser, true); if (typeNameSpelling == "any") return parseAnyType(parser); if (typeNameSpelling == "calibrated") @@ -339,24 +484,60 @@ static void printStorageType(QuantizedType type, DialectAsmPrinter &out) { // storage type unsigned storageWidth = type.getStorageTypeIntegralWidth(); bool isSigned = type.isSigned(); - if (isSigned) { + if (type.getStorageType().isa()) { + out << "f8E5M2"; + } else if (type.getStorageType().isa()) { + out << "f8E4M3FN"; + } else if (isSigned) { out << "i" << storageWidth; } else { out << "u" << storageWidth; } // storageTypeMin and storageTypeMax if not default. - int64_t defaultIntegerMin = - QuantizedType::getDefaultMinimumForInteger(isSigned, storageWidth); - int64_t defaultIntegerMax = - QuantizedType::getDefaultMaximumForInteger(isSigned, storageWidth); - if (defaultIntegerMin != type.getStorageTypeMin() || - defaultIntegerMax != type.getStorageTypeMax()) { + int64_t defaultMin = + type.getStorageType().isa() + ? QuantizedType::getDefaultMinimumForInteger(isSigned, storageWidth) + : type.getStorageType().isa() + ? QuantizedType::getDefaultMinimumForF8E5M2() + : type.getStorageType().isa() + ? QuantizedType::getDefaultMinimumForF8E4M3FN() + : std::numeric_limits::max(); + + int64_t defaultMax = + type.getStorageType().isa() + ? QuantizedType::getDefaultMaximumForInteger(isSigned, storageWidth) + : type.getStorageType().isa() + ? QuantizedType::getDefaultMaximumForF8E5M2() + : type.getStorageType().isa() + ? QuantizedType::getDefaultMaximumForF8E4M3FN() + : std::numeric_limits::min(); + + if (defaultMin != type.getStorageTypeMin() || + defaultMax != type.getStorageTypeMax()) { out << "<" << type.getStorageTypeMin() << ":" << type.getStorageTypeMax() << ">"; } } +static void printQuantileType(Type quantileType, DialectAsmPrinter &out) { + if (auto intType = llvm::dyn_cast(quantileType)) { + const unsigned storageTypeWidth = intType.getWidth(); + if (intType.isUnsigned()) { + out << ":u" << storageTypeWidth; + } else { + out << ":i" << storageTypeWidth; + } + } else if (quantileType.isa()) { + out << ":f8E5M2"; + } else if (quantileType.isa()) { + out << ":f8E4M3FN"; + } else { + // Float types + out << ":" << quantileType; + } +} + static void printQuantParams(double scale, int64_t zeroPoint, DialectAsmPrinter &out) { out << scale; @@ -410,6 +591,56 @@ static void printUniformQuantizedPerAxisType(UniformQuantizedPerAxisType type, out << "}>"; } +/// Helper that prints a QuantileQuantizedType. +static void printQuantileQuantizedType(QuantileQuantizedType type, + DialectAsmPrinter &out) { + out << "quantile<"; + printStorageType(type, out); + printQuantileType(type.getQuantileType(), out); + out << ":" << type.getExpressedType() << ", "; + + // scheme specific parameters + ArrayRef quantiles = type.getQuantiles(); + out << "{"; + llvm::interleave( + llvm::seq(0, quantiles.size()), out, + [&](size_t index) { out << quantiles[index]; }, ","); + out << "}:"; + + printQuantParams(type.getScale(), type.getZeroPoint(), out); + out << ">"; +} + +/// Helper that prints a QuantileQuantizedPerAxisType. +static void printQuantileQuantizedPerAxisType(QuantileQuantizedPerAxisType type, + DialectAsmPrinter &out) { + out << "quantile<"; + printStorageType(type, out); + printQuantileType(type.getQuantileType(), out); + out << ":" << type.getExpressedType() << ":"; + out << type.getQuantizedDimension(); + out << ", "; + + // scheme specific parameters + ArrayRef quantiles = type.getQuantiles(); + out << "{"; + llvm::interleave( + llvm::seq(0, quantiles.size()), out, + [&](size_t index) { out << quantiles[index]; }, ","); + out << "}:"; + + ArrayRef scales = type.getScales(); + ArrayRef zeroPoints = type.getZeroPoints(); + out << "{"; + llvm::interleave( + llvm::seq(0, scales.size()), out, + [&](size_t index) { + printQuantParams(scales[index], zeroPoints[index], out); + }, + ","); + out << "}>"; +} + /// Helper that prints a CalibratedQuantizedType. static void printCalibratedQuantizedType(CalibratedQuantizedType type, DialectAsmPrinter &out) { @@ -422,6 +653,11 @@ static void printCalibratedQuantizedType(CalibratedQuantizedType type, void QuantizationDialect::printType(Type type, DialectAsmPrinter &os) const { if (auto anyType = llvm::dyn_cast(type)) printAnyQuantizedType(anyType, os); + else if (auto uniformType = llvm::dyn_cast(type)) + printQuantileQuantizedType(uniformType, os); + else if (auto perAxisType = + llvm::dyn_cast(type)) + printQuantileQuantizedPerAxisType(perAxisType, os); else if (auto uniformType = llvm::dyn_cast(type)) printUniformQuantizedType(uniformType, os); else if (auto perAxisType = llvm::dyn_cast(type)) diff --git a/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp index 87464ccb7172..e6b52cf387cb 100644 --- a/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp +++ b/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp @@ -76,9 +76,9 @@ struct CastOpInterface // Case 3: Ranked tensor -> ranked tensor. The offsets and strides do not // change. auto rankedResultType = cast(castOp.getType()); - return MemRefType::get( + return cast(MemRefType::get( rankedResultType.getShape(), rankedResultType.getElementType(), - llvm::cast(*maybeSrcBufferType).getLayout(), memorySpace); + llvm::cast(*maybeSrcBufferType).getLayout(), memorySpace)); } LogicalResult bufferize(Operation *op, RewriterBase &rewriter, @@ -156,8 +156,8 @@ struct CollapseShapeOpInterface tensorResultType, srcBufferType.getMemorySpace()); } - return memref::CollapseShapeOp::computeCollapsedType( - srcBufferType, collapseShapeOp.getReassociationIndices()); + return cast(memref::CollapseShapeOp::computeCollapsedType( + srcBufferType, collapseShapeOp.getReassociationIndices())); } LogicalResult bufferize(Operation *op, RewriterBase &rewriter, @@ -324,7 +324,7 @@ struct ExpandShapeOpInterface expandShapeOp.getReassociationIndices()); if (failed(maybeResultType)) return failure(); - return *maybeResultType; + return cast(*maybeResultType); } LogicalResult bufferize(Operation *op, RewriterBase &rewriter, @@ -751,9 +751,9 @@ struct PadOpInterface if (failed(maybeSrcBufferType)) return failure(); MemRefLayoutAttrInterface layout; - return MemRefType::get(padOp.getResultType().getShape(), + return cast(MemRefType::get(padOp.getResultType().getShape(), padOp.getResultType().getElementType(), layout, - maybeSrcBufferType->getMemorySpace()); + maybeSrcBufferType->getMemorySpace())); } LogicalResult bufferize(Operation *op, RewriterBase &rewriter, diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp index e5b1291afce2..c6f2db23e394 100644 --- a/mlir/lib/IR/AsmPrinter.cpp +++ b/mlir/lib/IR/AsmPrinter.cpp @@ -392,6 +392,19 @@ class AsmPrinter::Impl { /// Returns the output stream of the printer. raw_ostream &getStream() { return os; } + + /// Print a newline and indent the printer to the start of the current + /// operation. + void printNewline() { + os << newLine; + os.indent(currentIndent); + } + + /// Increase indentation. + void increaseIndent() { currentIndent += indentWidth; } + + /// Decrease indentation. + void decreaseIndent() { currentIndent -= indentWidth; } template inline void interleaveComma(const Container &c, UnaryFunctor eachFn) const { @@ -507,6 +520,12 @@ class AsmPrinter::Impl { /// A tracker for the number of new lines emitted during printing. NewLineCounter newLine; + + /// The number of spaces used for indenting nested operations. + const static unsigned indentWidth = 2; + + /// This is the current indentation level for nested structures. + unsigned currentIndent = 0; }; } // namespace mlir @@ -959,6 +978,9 @@ class DummyAliasDialectAsmPrinter : public DialectAsmPrinter { /// The following are hooks of `DialectAsmPrinter` that are not necessary for /// determining potential aliases. + void printNewline() override {} + void increaseIndent() override {} + void decreaseIndent() override {} void printFloat(const APFloat &) override {} void printKeywordOrString(StringRef) override {} void printString(StringRef) override {} @@ -2739,6 +2761,12 @@ void AsmPrinter::Impl::printDialectAttribute(Attribute attr) { { llvm::raw_string_ostream attrNameStr(attrName); Impl subPrinter(attrNameStr, state); + + // The values of currentIndent and newLine are assigned to the created subprinter, + // so that the indent level and number of printed lines can be tracked. + subPrinter.currentIndent = currentIndent; + subPrinter.newLine = newLine; + DialectAsmPrinter printer(subPrinter); dialect.printAttribute(attr, printer); } @@ -2753,6 +2781,12 @@ void AsmPrinter::Impl::printDialectType(Type type) { { llvm::raw_string_ostream typeNameStr(typeName); Impl subPrinter(typeNameStr, state); + + // The values of currentIndent and newLine are assigned to the created subprinter, + // so that the indent level and number of printed lines can be tracked. + subPrinter.currentIndent = currentIndent; + subPrinter.newLine = newLine; + DialectAsmPrinter printer(subPrinter); dialect.printType(type, printer); } @@ -2793,6 +2827,21 @@ raw_ostream &AsmPrinter::getStream() const { return impl->getStream(); } +void AsmPrinter::printNewline() { + assert(impl && "expected AsmPrinter::printNewLine to be overriden"); + impl->printNewline(); +} + +void AsmPrinter::increaseIndent() { + assert(impl && "expected AsmPrinter::increaseIndent to be overriden"); + impl->increaseIndent(); +} + +void AsmPrinter::decreaseIndent() { + assert(impl && "expected AsmPrinter::decreaseIndent to be overriden"); + impl->decreaseIndent(); +} + /// Print the given floating point value in a stablized form. void AsmPrinter::printFloat(const APFloat &value) { assert(impl && "expected AsmPrinter::printFloat to be overriden"); @@ -3118,19 +3167,6 @@ class OperationPrinter : public AsmPrinter::Impl, private OpAsmPrinter { printTrailingLocation(loc); } - /// Print a newline and indent the printer to the start of the current - /// operation. - void printNewline() override { - os << newLine; - os.indent(currentIndent); - } - - /// Increase indentation. - void increaseIndent() override { currentIndent += indentWidth; } - - /// Decrease indentation. - void decreaseIndent() override { currentIndent -= indentWidth; } - /// Print a block argument in the usual format of: /// %ssaName : type {attr1=42} loc("here") /// where location printing is controlled by the standard internal option. @@ -3256,12 +3292,6 @@ class OperationPrinter : public AsmPrinter::Impl, private OpAsmPrinter { // top-level we start with "builtin" as the default, so that the top-level // `module` operation prints as-is. SmallVector defaultDialectStack{"builtin"}; - - /// The number of spaces used for indenting nested operations. - const static unsigned indentWidth = 2; - - // This is the current indentation level for nested structures. - unsigned currentIndent = 0; }; } // namespace diff --git a/mlir/lib/IR/BuiltinTypes.cpp b/mlir/lib/IR/BuiltinTypes.cpp index faa944937e00..a67a2ada7658 100644 --- a/mlir/lib/IR/BuiltinTypes.cpp +++ b/mlir/lib/IR/BuiltinTypes.cpp @@ -266,45 +266,14 @@ VectorType VectorType::cloneWith(std::optional> shape, getScalableDims()); } -//===----------------------------------------------------------------------===// -// TensorType -//===----------------------------------------------------------------------===// - -Type TensorType::getElementType() const { - return llvm::TypeSwitch(*this) - .Case( - [](auto type) { return type.getElementType(); }); -} - -bool TensorType::hasRank() const { return !llvm::isa(*this); } - -ArrayRef TensorType::getShape() const { - return llvm::cast(*this).getShape(); -} - -TensorType TensorType::cloneWith(std::optional> shape, - Type elementType) const { - if (llvm::dyn_cast(*this)) { - if (shape) - return RankedTensorType::get(*shape, elementType); - return UnrankedTensorType::get(elementType); - } - - auto rankedTy = llvm::cast(*this); - if (!shape) - return RankedTensorType::get(rankedTy.getShape(), elementType, - rankedTy.getEncoding()); - return RankedTensorType::get(shape.value_or(rankedTy.getShape()), elementType, - rankedTy.getEncoding()); -} - -RankedTensorType TensorType::clone(::llvm::ArrayRef shape, - Type elementType) const { - return ::llvm::cast(cloneWith(shape, elementType)); -} - -RankedTensorType TensorType::clone(::llvm::ArrayRef shape) const { - return ::llvm::cast(cloneWith(shape, getElementType())); +/// Return true if the specified element type is ok in a tensor. +bool TensorType::isValidElementType(Type type) { + // Note: Non standard/builtin types are allowed to exist within tensor + // types. Dialects are expected to verify that tensor types have a valid + // element type within that dialect. + return llvm::isa(type) || + !llvm::isa(type.getDialect()); } // Check if "elementType" can be an element type of a tensor. @@ -316,20 +285,16 @@ checkTensorElementType(function_ref emitError, return success(); } -/// Return true if the specified element type is ok in a tensor. -bool TensorType::isValidElementType(Type type) { - // Note: Non standard/builtin types are allowed to exist within tensor - // types. Dialects are expected to verify that tensor types have a valid - // element type within that dialect. - return llvm::isa(type) || - !llvm::isa(type.getDialect()); -} - //===----------------------------------------------------------------------===// // RankedTensorType //===----------------------------------------------------------------------===// +RankedTensorType RankedTensorType::cloneWith(std::optional> shape, + Type elementType) const { + return RankedTensorType::get(shape.value_or(getShape()), elementType, + getEncoding()); +} + LogicalResult RankedTensorType::verify(function_ref emitError, ArrayRef shape, Type elementType, @@ -347,6 +312,14 @@ RankedTensorType::verify(function_ref emitError, // UnrankedTensorType //===----------------------------------------------------------------------===// +TensorType UnrankedTensorType::cloneWith(std::optional> shape, + Type elementType) const { + if (shape) + return RankedTensorType::get(*shape, elementType); + + return UnrankedTensorType::get(elementType); +} + LogicalResult UnrankedTensorType::verify(function_ref emitError, Type elementType) { @@ -354,53 +327,9 @@ UnrankedTensorType::verify(function_ref emitError, } //===----------------------------------------------------------------------===// -// BaseMemRefType +// BaseMemRefTypeInterface //===----------------------------------------------------------------------===// -Type BaseMemRefType::getElementType() const { - return llvm::TypeSwitch(*this) - .Case( - [](auto type) { return type.getElementType(); }); -} - -bool BaseMemRefType::hasRank() const { return !llvm::isa(*this); } - -ArrayRef BaseMemRefType::getShape() const { - return llvm::cast(*this).getShape(); -} - -BaseMemRefType BaseMemRefType::cloneWith(std::optional> shape, - Type elementType) const { - if (llvm::dyn_cast(*this)) { - if (!shape) - return UnrankedMemRefType::get(elementType, getMemorySpace()); - MemRefType::Builder builder(*shape, elementType); - builder.setMemorySpace(getMemorySpace()); - return builder; - } - - MemRefType::Builder builder(llvm::cast(*this)); - if (shape) - builder.setShape(*shape); - builder.setElementType(elementType); - return builder; -} - -MemRefType BaseMemRefType::clone(::llvm::ArrayRef shape, - Type elementType) const { - return ::llvm::cast(cloneWith(shape, elementType)); -} - -MemRefType BaseMemRefType::clone(::llvm::ArrayRef shape) const { - return ::llvm::cast(cloneWith(shape, getElementType())); -} - -Attribute BaseMemRefType::getMemorySpace() const { - if (auto rankedMemRefTy = llvm::dyn_cast(*this)) - return rankedMemRefTy.getMemorySpace(); - return llvm::cast(*this).getMemorySpace(); -} - unsigned BaseMemRefType::getMemorySpaceAsInt() const { if (auto rankedMemRefTy = llvm::dyn_cast(*this)) return rankedMemRefTy.getMemorySpaceAsInt(); @@ -484,7 +413,7 @@ bool mlir::detail::isSupportedMemorySpace(Attribute memorySpace) { return true; // Supported built-in attributes. - if (llvm::isa(memorySpace)) + if (llvm::isa(memorySpace)) return true; // Allow custom dialect attributes. @@ -520,6 +449,15 @@ unsigned mlir::detail::getMemorySpaceAsInt(Attribute memorySpace) { return static_cast(llvm::cast(memorySpace).getInt()); } +MemRefType MemRefType::cloneWith(std::optional> shape, + Type elementType) const { + MemRefType::Builder builder(llvm::cast(*this)); + if (shape) + builder.setShape(*shape); + builder.setElementType(elementType); + return builder; +} + unsigned MemRefType::getMemorySpaceAsInt() const { return detail::getMemorySpaceAsInt(getMemorySpace()); } @@ -659,6 +597,15 @@ LogicalResult MemRefType::verify(function_ref emitError, // UnrankedMemRefType //===----------------------------------------------------------------------===// +BaseMemRefType UnrankedMemRefType::cloneWith(std::optional> shape, + Type elementType) const { + if (!shape) + return UnrankedMemRefType::get(elementType, getMemorySpace()); + MemRefType::Builder builder(*shape, elementType); + builder.setMemorySpace(getMemorySpace()); + return (MemRefType)builder; +} + unsigned UnrankedMemRefType::getMemorySpaceAsInt() const { return detail::getMemorySpaceAsInt(getMemorySpace()); } diff --git a/mlir/lib/IR/SymbolTable.cpp b/mlir/lib/IR/SymbolTable.cpp index e83d19553d62..d35e3b9b6ead 100644 --- a/mlir/lib/IR/SymbolTable.cpp +++ b/mlir/lib/IR/SymbolTable.cpp @@ -56,8 +56,9 @@ collectValidReferencesFor(Operation *symbol, StringAttr symbolName, StringAttr symbolNameId = StringAttr::get(ctx, SymbolTable::getSymbolAttrName()); do { - // Each parent of 'symbol' should define a symbol table. - if (!symbolTableOp->hasTrait()) + // Each parent of 'symbol' should define a symbol table or be a symbol container + if (!symbolTableOp->hasTrait() && + !symbolTableOp->hasTrait()) return failure(); // Each parent of 'symbol' should also be a symbol. StringAttr symbolTableName = getNameIfSymbol(symbolTableOp, symbolNameId); @@ -117,7 +118,7 @@ walkSymbolTable(Operation *op, /// Build a symbol table with the symbols within the given operation. SymbolTable::SymbolTable(Operation *symbolTableOp) : symbolTableOp(symbolTableOp) { - assert(symbolTableOp->hasTrait() && + assert((symbolTableOp->hasTrait() || symbolTableOp->hasTrait()) && "expected operation to have SymbolTable trait"); assert(symbolTableOp->getNumRegions() == 1 && "expected operation to have a single region"); @@ -384,7 +385,7 @@ void SymbolTable::walkSymbolTables( /// was found. Operation *SymbolTable::lookupSymbolIn(Operation *symbolTableOp, StringAttr symbol) { - assert(symbolTableOp->hasTrait()); + assert(symbolTableOp->hasTrait() || symbolTableOp->hasTrait()); Region ®ion = symbolTableOp->getRegion(0); if (region.empty()) return nullptr; @@ -425,7 +426,7 @@ static LogicalResult lookupSymbolInImpl( return success(); // Verify that the root is also a symbol table. - if (!symbolTableOp->hasTrait()) + if (!symbolTableOp->hasTrait() && !symbolTableOp->hasTrait()) return failure(); // Otherwise, lookup each of the nested non-leaf references and ensure that @@ -702,7 +703,7 @@ static SmallVector collectSymbolScopes(Operation *symbol, Operation *limitIt = symbol->getParentOp(); for (size_t i = 0, e = references.size(); i != e; ++i, limitIt = limitIt->getParentOp()) { - assert(limitIt->hasTrait()); + assert(limitIt->hasTrait() || limitIt->hasTrait()); scopes.push_back({references[i], &limitIt->getRegion(0)}); } return scopes; @@ -866,23 +867,26 @@ bool SymbolTable::symbolKnownUseEmpty(Operation *symbol, Region *from) { /// Generates a new symbol reference attribute with a new leaf reference. static SymbolRefAttr generateNewRefAttr(SymbolRefAttr oldAttr, - FlatSymbolRefAttr newLeafAttr) { + SymbolRefAttr newLeafAttr) { if (llvm::isa(oldAttr)) return newLeafAttr; auto nestedRefs = llvm::to_vector<2>(oldAttr.getNestedReferences()); - nestedRefs.back() = newLeafAttr; + nestedRefs.back() = FlatSymbolRefAttr::get(newLeafAttr.getRootReference()); + + nestedRefs.append(newLeafAttr.getNestedReferences().begin(), + newLeafAttr.getNestedReferences().end()); + return SymbolRefAttr::get(oldAttr.getRootReference(), nestedRefs); } /// The implementation of SymbolTable::replaceAllSymbolUses below. template static LogicalResult -replaceAllSymbolUsesImpl(SymbolT symbol, StringAttr newSymbol, IRUnitT *limit) { +replaceAllSymbolUsesImpl(SymbolT symbol, SymbolRefAttr newSymbol, IRUnitT *limit) { // Generate a new attribute to replace the given attribute. - FlatSymbolRefAttr newLeafAttr = FlatSymbolRefAttr::get(newSymbol); for (SymbolScope &scope : collectSymbolScopes(symbol, limit)) { SymbolRefAttr oldAttr = scope.symbol; - SymbolRefAttr newAttr = generateNewRefAttr(scope.symbol, newLeafAttr); + SymbolRefAttr newAttr = generateNewRefAttr(scope.symbol, newSymbol); AttrTypeReplacer replacer; replacer.addReplacement( [&](SymbolRefAttr attr) -> std::pair { @@ -895,11 +899,12 @@ replaceAllSymbolUsesImpl(SymbolT symbol, StringAttr newSymbol, IRUnitT *limit) { auto oldNestedRefs = oldAttr.getNestedReferences(); auto nestedRefs = attr.getNestedReferences(); if (oldNestedRefs.empty()) - return {SymbolRefAttr::get(newSymbol, nestedRefs), - WalkResult::skip()}; + return {newAttr, WalkResult::skip()}; auto newNestedRefs = llvm::to_vector<4>(nestedRefs); - newNestedRefs[oldNestedRefs.size() - 1] = newLeafAttr; + newNestedRefs[oldNestedRefs.size() - 1] = FlatSymbolRefAttr::get(newAttr.getRootReference()); + newNestedRefs.append(newAttr.getNestedReferences().begin(), + newAttr.getNestedReferences().end()); return {SymbolRefAttr::get(attr.getRootReference(), newNestedRefs), WalkResult::skip()}; } @@ -924,21 +929,38 @@ replaceAllSymbolUsesImpl(SymbolT symbol, StringAttr newSymbol, IRUnitT *limit) { LogicalResult SymbolTable::replaceAllSymbolUses(StringAttr oldSymbol, StringAttr newSymbol, Operation *from) { - return replaceAllSymbolUsesImpl(oldSymbol, newSymbol, from); + auto newSymRef = mlir::FlatSymbolRefAttr::get(newSymbol); + return replaceAllSymbolUsesImpl(oldSymbol, newSymRef, from); } LogicalResult SymbolTable::replaceAllSymbolUses(Operation *oldSymbol, StringAttr newSymbol, Operation *from) { - return replaceAllSymbolUsesImpl(oldSymbol, newSymbol, from); + auto newSymRef = mlir::FlatSymbolRefAttr::get(newSymbol); + return replaceAllSymbolUsesImpl(oldSymbol, newSymRef, from); } LogicalResult SymbolTable::replaceAllSymbolUses(StringAttr oldSymbol, StringAttr newSymbol, Region *from) { - return replaceAllSymbolUsesImpl(oldSymbol, newSymbol, from); + auto newSymRef = mlir::FlatSymbolRefAttr::get(newSymbol); + return replaceAllSymbolUsesImpl(oldSymbol, newSymRef, from); } LogicalResult SymbolTable::replaceAllSymbolUses(Operation *oldSymbol, StringAttr newSymbol, Region *from) { + auto newSymRef = mlir::FlatSymbolRefAttr::get(newSymbol); + return replaceAllSymbolUsesImpl(oldSymbol, newSymRef, from); +} + +LogicalResult SymbolTable::replaceAllSymbolUses(Operation* oldSymbol, + SymbolRefAttr newSymbol, + Operation* from) { + return replaceAllSymbolUsesImpl(oldSymbol, newSymbol, from); +} + + +LogicalResult SymbolTable::replaceAllSymbolUses(Operation* oldSymbol, + SymbolRefAttr newSymbol, + Region* from) { return replaceAllSymbolUsesImpl(oldSymbol, newSymbol, from); } @@ -1076,7 +1098,7 @@ SymbolUserMap::SymbolUserMap(SymbolTableCollection &symbolTable, } void SymbolUserMap::replaceAllUsesWith(Operation *symbol, - StringAttr newSymbolName) { + SymbolRefAttr newSymbolName) { auto it = symbolToUsers.find(symbol); if (it == symbolToUsers.end()) return; @@ -1103,6 +1125,11 @@ void SymbolUserMap::replaceAllUsesWith(Operation *symbol, } } +void SymbolUserMap::replaceAllUsesWith(Operation *symbol, + StringAttr newSymbolName) { + replaceAllUsesWith(symbol, mlir::FlatSymbolRefAttr::get(newSymbolName)); +} + //===----------------------------------------------------------------------===// // Visibility parsing implementation. //===----------------------------------------------------------------------===// diff --git a/mlir/lib/Pass/Pass.cpp b/mlir/lib/Pass/Pass.cpp index 57a6c20141d2..a61fbff88d81 100644 --- a/mlir/lib/Pass/Pass.cpp +++ b/mlir/lib/Pass/Pass.cpp @@ -78,6 +78,12 @@ void Pass::copyOptionValuesFrom(const Pass *other) { passOptions.copyOptionValuesFrom(other->passOptions); } +/// Copy the option values from 'other', which are PassPipeline options. +/// Here we copy only those options that have the same argument name. +void Pass::copyOptionValuesFrom(const PassOptions &other) { + passOptions.matchAndCopyOptionValuesFrom(other); +} + /// Prints out the pass in the textual representation of pipelines. If this is /// an adaptor pass, print its pass managers. void Pass::printAsTextualPipeline(raw_ostream &os) { diff --git a/mlir/lib/Pass/PassRegistry.cpp b/mlir/lib/Pass/PassRegistry.cpp index 483cbe80faba..59ad2ec1adf0 100644 --- a/mlir/lib/Pass/PassRegistry.cpp +++ b/mlir/lib/Pass/PassRegistry.cpp @@ -68,6 +68,32 @@ static void printOptionHelp(StringRef arg, StringRef desc, size_t indent, // PassRegistry //===----------------------------------------------------------------------===// +/// Prints the passes that were previously registered and stored in passRegistry +void mlir::printRegisteredPasses() { + size_t maxWidth = 0; + for (auto &entry : *passRegistry) + maxWidth = std::max(maxWidth, entry.second.getOptionWidth() + 4); + + // Functor used to print the ordered entries of a registration map. + auto printOrderedEntries = [&](StringRef header, auto &map) { + llvm::SmallVector orderedEntries; + for (auto &kv : map) + orderedEntries.push_back(&kv.second); + llvm::array_pod_sort( + orderedEntries.begin(), orderedEntries.end(), + [](PassRegistryEntry *const *lhs, PassRegistryEntry *const *rhs) { + return (*lhs)->getPassArgument().compare((*rhs)->getPassArgument()); + }); + + llvm::outs().indent(0) << header << ":\n"; + for (PassRegistryEntry *entry : orderedEntries) + entry->printHelpStr(/*indent=*/2, maxWidth); + }; + + // Print the available passes. + printOrderedEntries("Passes", *passRegistry); +} + /// Print the help information for this pass. This includes the argument, /// description, and any pass options. `descIndent` is the indent that the /// descriptions should be aligned. @@ -208,6 +234,19 @@ void detail::PassOptions::copyOptionValuesFrom(const PassOptions &other) { std::get<0>(optionsIt)->copyValueFrom(*std::get<1>(optionsIt)); } +/// Copy only those options that have the same argument name. +void detail::PassOptions::matchAndCopyOptionValuesFrom(const PassOptions &other) { + for (auto* optionsIt : other.options) { + const auto& it = llvm::find_if(options, [&](OptionBase * option) { + return option->getArgStr() == optionsIt->getArgStr(); + }); + + if (it != options.end()) { + (*it)->copyValueFrom(*optionsIt); + } + } +} + /// Parse in the next argument from the given options string. Returns a tuple /// containing [the key of the option, the value of the option, updated /// `options` string pointing after the parsed option]. diff --git a/mlir/lib/Support/Timing.cpp b/mlir/lib/Support/Timing.cpp index ac16eb7d224c..2d852d36a283 100644 --- a/mlir/lib/Support/Timing.cpp +++ b/mlir/lib/Support/Timing.cpp @@ -34,9 +34,6 @@ using namespace detail; using DisplayMode = DefaultTimingManager::DisplayMode; using OutputFormat = DefaultTimingManager::OutputFormat; -constexpr llvm::StringLiteral kTimingDescription = - "... Execution time report ..."; - //===----------------------------------------------------------------------===// // TimingManager //===----------------------------------------------------------------------===// @@ -110,50 +107,6 @@ TimingIdentifier TimingIdentifier::get(StringRef str, TimingManager &tm) { namespace { -class OutputTextStrategy : public OutputStrategy { -public: - OutputTextStrategy(raw_ostream &os) : OutputStrategy(os) {} - - void printHeader(const TimeRecord &total) override { - // Figure out how many spaces to description name. - unsigned padding = (80 - kTimingDescription.size()) / 2; - os << "===" << std::string(73, '-') << "===\n"; - os.indent(padding) << kTimingDescription << '\n'; - os << "===" << std::string(73, '-') << "===\n"; - - // Print the total time followed by the section headers. - os << llvm::format(" Total Execution Time: %.4f seconds\n\n", total.wall); - if (total.user != total.wall) - os << " ----User Time----"; - os << " ----Wall Time---- ----Name----\n"; - } - - void printFooter() override { os.flush(); } - - void printTime(const TimeRecord &time, const TimeRecord &total) override { - if (total.user != total.wall) { - os << llvm::format(" %8.4f (%5.1f%%)", time.user, - 100.0 * time.user / total.user); - } - os << llvm::format(" %8.4f (%5.1f%%) ", time.wall, - 100.0 * time.wall / total.wall); - } - - void printListEntry(StringRef name, const TimeRecord &time, - const TimeRecord &total, bool lastEntry) override { - printTime(time, total); - os << name << "\n"; - } - - void printTreeEntry(unsigned indent, StringRef name, const TimeRecord &time, - const TimeRecord &total) override { - printTime(time, total); - os.indent(indent) << name << "\n"; - } - - void printTreeEntryEnd(unsigned indent, bool lastEntry) override {} -}; - class OutputJsonStrategy : public OutputStrategy { public: OutputJsonStrategy(raw_ostream &os) : OutputStrategy(os) {} diff --git a/mlir/lib/Target/CMakeLists.txt b/mlir/lib/Target/CMakeLists.txt index c3ec1b4f1e3f..8c167aaae6c8 100644 --- a/mlir/lib/Target/CMakeLists.txt +++ b/mlir/lib/Target/CMakeLists.txt @@ -1,4 +1,6 @@ add_subdirectory(Cpp) -add_subdirectory(SPIRV) +if(MLIR_DIALECT_SPIRV_ENABLE) + add_subdirectory(SPIRV) +endif() add_subdirectory(LLVMIR) add_subdirectory(LLVM) diff --git a/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp b/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp index 831e1e675a44..ce6477eaedac 100644 --- a/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp +++ b/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp @@ -30,6 +30,7 @@ #include "mlir/Parser/Parser.h" #include "mlir/Pass/Pass.h" #include "mlir/Pass/PassManager.h" +#include "mlir/Pass/PassRegistry.h" #include "mlir/Support/FileUtilities.h" #include "mlir/Support/Timing.h" #include "mlir/Support/ToolUtilities.h" @@ -118,6 +119,10 @@ struct MlirOptMainConfigCLOptions : public MlirOptMainConfig { "parsing"), cl::location(useExplicitModuleFlag), cl::init(false)); + static cl::opt listPasses( + "list-passes", cl::desc("Print the list of registered passes and exit"), + cl::location(listPassesFlag), cl::init(false)); + static cl::opt runReproducer( "run-reproducer", cl::desc("Run the pipeline stored in the reproducer"), cl::location(runReproducerFlag), cl::init(false)); @@ -522,6 +527,11 @@ static LogicalResult printRegisteredDialects(DialectRegistry ®istry) { return success(); } +static LogicalResult printRegisteredPassesAndReturn() { + mlir::printRegisteredPasses(); + return success(); +} + LogicalResult mlir::MlirOptMain(llvm::raw_ostream &outputStream, std::unique_ptr buffer, DialectRegistry ®istry, @@ -529,6 +539,9 @@ LogicalResult mlir::MlirOptMain(llvm::raw_ostream &outputStream, if (config.shouldShowDialects()) return printRegisteredDialects(registry); + if (config.shouldListPasses()) + return printRegisteredPassesAndReturn(); + // The split-input-file mode is a very specific mode that slices the file // up into small pieces and checks each independently. // We use an explicit threadpool to avoid creating and joining/destroying @@ -553,18 +566,49 @@ LogicalResult mlir::MlirOptMain(llvm::raw_ostream &outputStream, config.outputSplitMarker()); } -LogicalResult mlir::MlirOptMain(int argc, char **argv, - llvm::StringRef inputFilename, - llvm::StringRef outputFilename, - DialectRegistry ®istry) { +LogicalResult mlir::MlirOptMain(int argc, char **argv, llvm::StringRef toolName, + DialectRegistry ®istry, + const AdditionalRegistrationFn &additionalRegistration) { + static cl::opt inputFilename( + cl::Positional, cl::desc(""), cl::init("-")); + + static cl::opt outputFilename("o", cl::desc("Output filename"), + cl::value_desc("filename"), + cl::init("-")); InitLLVM y(argc, argv); + // Register any command line options. + registerAsmPrinterCLOptions(); + registerMLIRContextCLOptions(); + registerPassManagerCLOptions(); + registerDefaultTimingManagerCLOptions(); + tracing::DebugCounter::registerCLOptions(); + + // Build the list of dialects as a header for the --help message. + std::string helpHeader = (toolName + "\nAvailable Dialects: ").str(); + { + llvm::raw_string_ostream os(helpHeader); + interleaveComma(registry.getDialectNames(), os, + [&](auto name) { os << name; }); + } + + // It is not possible to place a call after command line parser + // since not all options are registered at the moment + additionalRegistration(helpHeader); + + MlirOptMainConfig::registerCLOptions(registry); + + // Parse pass names in main to ensure static initialization completed. + cl::ParseCommandLineOptions(argc, argv, helpHeader); MlirOptMainConfig config = MlirOptMainConfig::createFromCLOptions(); if (config.shouldShowDialects()) return printRegisteredDialects(registry); + if (config.shouldListPasses()) + return printRegisteredPassesAndReturn(); + // When reading from stdin and the input is a tty, it is often a user mistake // and the process "appears to be stuck". Print a message to let the user know // about it! @@ -593,14 +637,3 @@ LogicalResult mlir::MlirOptMain(int argc, char **argv, output->keep(); return success(); } - -LogicalResult mlir::MlirOptMain(int argc, char **argv, llvm::StringRef toolName, - DialectRegistry ®istry) { - - // Register and parse command line options. - std::string inputFilename, outputFilename; - std::tie(inputFilename, outputFilename) = - registerAndParseCLIOptions(argc, argv, toolName, registry); - - return MlirOptMain(argc, argv, inputFilename, outputFilename, registry); -} diff --git a/mlir/lib/Transforms/Utils/BufferizationUtils.cpp b/mlir/lib/Transforms/Utils/BufferizationUtils.cpp new file mode 100644 index 000000000000..428de4eb5015 --- /dev/null +++ b/mlir/lib/Transforms/Utils/BufferizationUtils.cpp @@ -0,0 +1,25 @@ +//===- BufferizationUtils.cpp ---- Utilities for bufferization-------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file implements (one-shot) bufferization utilities. +// +//===----------------------------------------------------------------------===// + +#include "mlir/Transforms/BufferizationUtils.h" + +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" + +namespace mlir { +Type BufferizerInterface::getTensorTypeFromMemRefType(Type type) const { + Dialect *dialect = &type.getDialect(); + const auto *handle = getInterfaceFor(dialect); + assert(handle && "The dialect must have BufferizerInterface implemented."); + return handle->getTensorTypeFromMemRefType(type); +} +} // namespace mlir diff --git a/mlir/lib/Transforms/Utils/CMakeLists.txt b/mlir/lib/Transforms/Utils/CMakeLists.txt index b5788c679edc..5e9cb6e36800 100644 --- a/mlir/lib/Transforms/Utils/CMakeLists.txt +++ b/mlir/lib/Transforms/Utils/CMakeLists.txt @@ -10,6 +10,7 @@ add_mlir_library(MLIRTransformUtils LoopInvariantCodeMotionUtils.cpp OneToNTypeConversion.cpp RegionUtils.cpp + BufferizationUtils.cpp ADDITIONAL_HEADER_DIRS ${MLIR_MAIN_INCLUDE_DIR}/mlir/Transforms diff --git a/mlir/lib/Transforms/Utils/Inliner.cpp b/mlir/lib/Transforms/Utils/Inliner.cpp index 8acfc96d2b61..615ffd1f79b3 100644 --- a/mlir/lib/Transforms/Utils/Inliner.cpp +++ b/mlir/lib/Transforms/Utils/Inliner.cpp @@ -688,7 +688,8 @@ Inliner::Impl::inlineCallsInSCC(InlinerInterfaceImpl &inlinerIface, useList.mergeUsesAfterInlining(it.targetNode, it.sourceNode); // then erase the call. - call.erase(); + const auto *callInterface = inlinerIface.getInterfaceFor(call->getDialect()); + callInterface->eraseCall(call); // If we inlined in place, mark the node for deletion. if (inlineInPlace) { diff --git a/mlir/lib/Transforms/Utils/InliningUtils.cpp b/mlir/lib/Transforms/Utils/InliningUtils.cpp index ba146920fae2..fed0dc9d6fba 100644 --- a/mlir/lib/Transforms/Utils/InliningUtils.cpp +++ b/mlir/lib/Transforms/Utils/InliningUtils.cpp @@ -54,6 +54,19 @@ static void remapInlinedOperands(iterator_range inlinedBlocks, block.walk(remapOperands); } +//===----------------------------------------------------------------------===// +// DialectInlinerInterface +//===----------------------------------------------------------------------===// + +void DialectInlinerInterface::eraseCall(Operation *call) const { + call->erase(); +} + +std::tuple + DialectInlinerInterface::getInlineBlockAndPoint(Operation *call) const { + return std::make_tuple(call->getBlock(), std::next(call->getIterator())); +} + //===----------------------------------------------------------------------===// // InlinerInterface //===----------------------------------------------------------------------===// @@ -501,9 +514,11 @@ LogicalResult mlir::inlineCall(InlinerInterface &interface, if (!interface.isLegalToInline(call, callable, shouldCloneInlinedRegion)) return cleanupState(); + auto [inlineBlock, inlinePoint] = callInterface->getInlineBlockAndPoint(call); + // Attempt to inline the call. - if (failed(inlineRegionImpl(interface, src, call->getBlock(), - ++call->getIterator(), mapper, callResults, + if (failed(inlineRegionImpl(interface, src, inlineBlock, + inlinePoint, mapper, callResults, callableResultTypes, call.getLoc(), shouldCloneInlinedRegion, call))) return cleanupState(); diff --git a/mlir/test/Conversion/TosaToTensor/tosa-to-tensor-invalid.mlir b/mlir/test/Conversion/TosaToTensor/tosa-to-tensor-invalid.mlir deleted file mode 100644 index 36eb4d4669b0..000000000000 --- a/mlir/test/Conversion/TosaToTensor/tosa-to-tensor-invalid.mlir +++ /dev/null @@ -1,8 +0,0 @@ -// RUN: mlir-opt --split-input-file -pass-pipeline="builtin.module(func.func(tosa-to-tensor))" %s -verify-diagnostics - -// CHECK-LABEL: @slice_resultType_unranked -func.func @slice_resultType_unranked(%arg0: tensor) -> (tensor<*xf32>) { - // expected-error@+1 {{failed to legalize operation 'tosa.slice'}} - %0 = "tosa.slice"(%arg0) {start = array, size = array} : (tensor) -> (tensor<*xf32>) - return %0 : tensor<*xf32> -} diff --git a/mlir/test/Conversion/TosaToTensor/tosa-to-tensor.mlir b/mlir/test/Conversion/TosaToTensor/tosa-to-tensor.mlir deleted file mode 100644 index 1e62e25176a0..000000000000 --- a/mlir/test/Conversion/TosaToTensor/tosa-to-tensor.mlir +++ /dev/null @@ -1,660 +0,0 @@ -// RUN: mlir-opt --split-input-file --tosa-to-tensor %s -o -| FileCheck %s - -// ----- - -// CHECK-LABEL: test_reshape_0d_same_s2s_explicit -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor -// CHECK: return %[[ARG_0]] : tensor -func.func @test_reshape_0d_same_s2s_explicit(%arg0: tensor) -> tensor { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor) -> tensor - return %0 : tensor -} - -// ----- - -// CHECK-LABEL: test_reshape_0d_up_s2d_auto -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor -// CHECK: %[[VAL_0:.*]] = tensor.expand_shape %[[ARG_0]] [] output_shape [1] : tensor into tensor<1xf32> -// CHECK: %[[VAL_1:.*]] = tensor.cast %[[VAL_0]] : tensor<1xf32> to tensor -// CHECK: return %[[VAL_1]] : tensor -func.func @test_reshape_0d_up_s2d_auto(%arg0: tensor) -> tensor { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor) -> tensor - return %0 : tensor -} - -// ----- - -// CHECK-LABEL: test_reshape_0d_up_s2d_explicit -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor -// CHECK: %[[VAL_0:.*]] = tensor.expand_shape %[[ARG_0]] [] output_shape [1] : tensor into tensor<1xf32> -// CHECK: %[[VAL_1:.*]] = tensor.cast %[[VAL_0]] : tensor<1xf32> to tensor -// CHECK: return %[[VAL_1]] : tensor -func.func @test_reshape_0d_up_s2d_explicit(%arg0: tensor) -> tensor { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor) -> tensor - return %0 : tensor -} - -// ----- - -// CHECK-LABEL: test_reshape_0d_up_s2s_auto -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor -// CHECK: %[[VAL_0:.*]] = tensor.expand_shape %[[ARG_0]] [] output_shape [1] : tensor into tensor<1xf32> -// CHECK: return %[[VAL_0]] : tensor<1xf32> -func.func @test_reshape_0d_up_s2s_auto(%arg0: tensor) -> tensor<1xf32> { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor) -> tensor<1xf32> - return %0 : tensor<1xf32> -} - -// ----- - -// CHECK-LABEL: test_reshape_0d_up_s2s_explicit -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor -// CHECK: %[[VAL_0:.*]] = tensor.expand_shape %[[ARG_0]] [] output_shape [1] : tensor into tensor<1xf32> -// CHECK: return %[[VAL_0]] : tensor<1xf32> -func.func @test_reshape_0d_up_s2s_explicit(%arg0: tensor) -> tensor<1xf32> { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor) -> tensor<1xf32> - return %0 : tensor<1xf32> -} - -// ----- - -// CHECK-LABEL: test_reshape_1d_down_d2s_explicit -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor -// CHECK: %[[VAL_0:.*]] = tensor.cast %[[ARG_0]] : tensor to tensor<1xf32> -// CHECK: %[[VAL_1:.*]] = tensor.collapse_shape %[[VAL_0]] [] : tensor<1xf32> into tensor -// CHECK: return %[[VAL_1]] : tensor -func.func @test_reshape_1d_down_d2s_explicit(%arg0: tensor) -> tensor { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor) -> tensor - return %0 : tensor -} - -// ----- - -// CHECK-LABEL: test_reshape_1d_down_s2s_explicit -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor<1xf32> -// CHECK: %[[VAL_0:.*]] = tensor.collapse_shape %[[ARG_0]] [] : tensor<1xf32> into tensor -// CHECK: return %[[VAL_0]] : tensor -func.func @test_reshape_1d_down_s2s_explicit(%arg0: tensor<1xf32>) -> tensor { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor<1xf32>) -> tensor - return %0 : tensor -} - -// ----- - -// CHECK-LABEL: test_reshape_1d_up_d2d_auto -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor -// CHECK: %[[C0:.*]] = arith.constant 0 : index -// CHECK: %[[DIM:.*]] = tensor.dim %arg0, %[[C0]] : tensor -// CHECK: %[[C2:.*]] = arith.constant 2 : index -// CHECK: %[[VAL_0:.*]] = arith.divui %[[DIM]], %[[C2]] : index -// CHECK: %[[EXPANDED:.*]] = tensor.expand_shape %[[ARG_0]] {{\[\[}}0, 1]] output_shape [2, %[[VAL_0]]] : tensor into tensor<2x?xf32> -// CHECK: return %[[EXPANDED]] : tensor<2x?xf32> -func.func @test_reshape_1d_up_d2d_auto(%arg0: tensor) -> tensor<2x?xf32> { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor) -> tensor<2x?xf32> - return %0 : tensor<2x?xf32> -} - -// ----- - -// CHECK-LABEL: test_reshape_1d_up_s2s_explicit -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor<6xf32> -// CHECK: %[[VAL_0:.*]] = tensor.expand_shape %[[ARG_0]] {{\[\[}}0, 1]] output_shape [2, 3] : tensor<6xf32> into tensor<2x3xf32> -// CHECK: return %[[VAL_0]] : tensor<2x3xf32> -func.func @test_reshape_1d_up_s2s_explicit(%arg0: tensor<6xf32>) -> tensor<2x3xf32> { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor<6xf32>) -> tensor<2x3xf32> - return %0 : tensor<2x3xf32> -} - -// ----- - -// CHECK-LABEL: test_reshape_2d_down_d2d_auto -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor<2x?xf32> -// CHECK: %[[VAL_0:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1]] : tensor<2x?xf32> into tensor -// CHECK: return %[[VAL_0]] : tensor -func.func @test_reshape_2d_down_d2d_auto(%arg0: tensor<2x?xf32>) -> tensor { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor<2x?xf32>) -> tensor - return %0 : tensor -} - -// ----- - -// CHECK-LABEL: test_reshape_2d_down_s2s_explicit -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor<2x3xf32> -// CHECK: %[[VAL_0:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1]] : tensor<2x3xf32> into tensor<6xf32> -// CHECK: return %[[VAL_0]] : tensor<6xf32> -func.func @test_reshape_2d_down_s2s_explicit(%arg0: tensor<2x3xf32>) -> tensor<6xf32> { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor<2x3xf32>) -> tensor<6xf32> - return %0 : tensor<6xf32> -} - -// ----- - -// CHECK-LABEL: test_reshape_2d_same_d2d_auto -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor -// CHECK: %[[VAL_0:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1]] : tensor into tensor -// CHECK: %[[C0:.*]] = arith.constant 0 : index -// CHECK: %[[DIM:.*]] = tensor.dim %[[VAL_0]], %[[C0]] : tensor -// CHECK: %[[C2:.*]] = arith.constant 2 : index -// CHECK: %[[DIV:.*]] = arith.divui %[[DIM]], %[[C2]] : index -// CHECK: %[[EXPANDED:.*]] = tensor.expand_shape %[[VAL_0]] {{\[\[}}0, 1]] output_shape [2, %[[DIV]]] : tensor into tensor<2x?xf32> -// CHECK: return %[[EXPANDED]] : tensor<2x?xf32> -func.func @test_reshape_2d_same_d2d_auto(%arg0: tensor) -> tensor<2x?xf32> { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor) -> tensor<2x?xf32> - return %0 : tensor<2x?xf32> -} - -// ----- - -// CHECK-LABEL: test_reshape_2d_same_s2d_auto -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor<2x4xf32> -// CHECK: %[[VAL_0:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1]] : tensor<2x4xf32> into tensor<8xf32> -// CHECK: %[[VAL_1:.*]] = tensor.expand_shape %[[VAL_0]] {{\[\[}}0, 1]] output_shape [4, 2] : tensor<8xf32> into tensor<4x2xf32> -// CHECK: %[[VAL_2:.*]] = tensor.cast %[[VAL_1]] : tensor<4x2xf32> to tensor -// CHECK: return %[[VAL_2]] : tensor -func.func @test_reshape_2d_same_s2d_auto(%arg0: tensor<2x4xf32>) -> tensor { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor<2x4xf32>) -> tensor - return %0 : tensor -} - -// ----- - -// CHECK-LABEL: test_reshape_2d_same_s2d_explicit -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor<2x4xf32> -// CHECK: %[[VAL_0:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1]] : tensor<2x4xf32> into tensor<8xf32> -// CHECK: %[[VAL_1:.*]] = tensor.expand_shape %[[VAL_0]] {{\[\[}}0, 1]] output_shape [4, 2] : tensor<8xf32> into tensor<4x2xf32> -// CHECK: %[[VAL_2:.*]] = tensor.cast %[[VAL_1]] : tensor<4x2xf32> to tensor -// CHECK: return %[[VAL_2]] : tensor -func.func @test_reshape_2d_same_s2d_explicit(%arg0: tensor<2x4xf32>) -> tensor { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor<2x4xf32>) -> tensor - return %0 : tensor -} - -// ----- - -// CHECK-LABEL: test_reshape_2d_same_s2s_explicit -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor<3x2xf32> -// CHECK: %[[VAL_0:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1]] : tensor<3x2xf32> into tensor<6xf32> -// CHECK: %[[VAL_1:.*]] = tensor.expand_shape %[[VAL_0]] {{\[\[}}0, 1]] output_shape [2, 3] : tensor<6xf32> into tensor<2x3xf32> -// CHECK: return %[[VAL_1]] : tensor<2x3xf32> -func.func @test_reshape_2d_same_s2s_explicit(%arg0: tensor<3x2xf32>) -> tensor<2x3xf32> { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor<3x2xf32>) -> tensor<2x3xf32> - return %0 : tensor<2x3xf32> -} - -// ----- - -// CHECK-LABEL: test_reshape_3d_same_d2d_auto_empty -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor<3x2x?xf32> -// CHECK: %[[VAL_0:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1, 2]] : tensor<3x2x?xf32> into tensor -// CHECK: %[[C0:.*]] = arith.constant 0 : index -// CHECK: %[[DIM:.*]] = tensor.dim %[[VAL_0]], %[[C0]] : tensor -// CHECK: %[[C0_0:.*]] = arith.constant 0 : index -// CHECK: %[[DIV:.*]] = arith.divui %[[DIM]], %[[C0_0]] : index -// CHECK: %[[VAL_1:.*]] = tensor.expand_shape %[[VAL_0]] {{\[\[}}0, 1, 2]] output_shape [0, 3, %[[DIV]]] : tensor into tensor<0x3x?xf32> -// CHECK: %[[VAL_2:.*]] = tensor.cast %[[VAL_1]] : tensor<0x3x?xf32> to tensor -// CHECK: return %[[VAL_2]] : tensor -func.func @test_reshape_3d_same_d2d_auto_empty(%arg0: tensor<3x2x?xf32>) -> tensor { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor<3x2x?xf32>) -> tensor - return %0 : tensor -} - -// ----- - -// CHECK-LABEL: test_reshape_3d_same_d2d_auto -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor<2x?x?xf32> -// CHECK: %[[VAL_0:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1, 2]] : tensor<2x?x?xf32> into tensor -// CHECK: %[[C0:.*]] = arith.constant 0 : index -// CHECK: %[[DIM:.*]] = tensor.dim %[[VAL_0]], %[[C0]] : tensor -// CHECK: %[[C8:.*]] = arith.constant 8 : index -// CHECK: %[[DIV:.*]] = arith.divui %[[DIM]], %[[C8]] : index -// CHECK: %[[VAL_1:.*]] = tensor.expand_shape %[[VAL_0]] {{\[\[}}0, 1, 2]] output_shape [2, %[[DIV]], 4] : tensor into tensor<2x?x4xf32> -// CHECK: %[[VAL_2:.*]] = tensor.cast %[[VAL_1]] : tensor<2x?x4xf32> to tensor -// CHECK: return %[[VAL_2]] : tensor -func.func @test_reshape_3d_same_d2d_auto(%arg0: tensor<2x?x?xf32>) -> tensor { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor<2x?x?xf32>) -> tensor - return %0 : tensor -} - -// ----- - -// CHECK-LABEL: test_reshape_3d_same_d2d_auto_identity -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor -// CHECK: %[[VAL_0:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1, 2]] : tensor into tensor -// CHECK: %[[C0:.*]] = arith.constant 0 : index -// CHECK: %[[DIM:.*]] = tensor.dim %[[VAL_0]], %[[C0]] : tensor -// CHECK: %[[C6:.*]] = arith.constant 6 : index -// CHECK: %[[DIV:.*]] = arith.divui %[[DIM]], %[[C6]] : index -// CHECK: %[[VAL_1:.*]] = tensor.expand_shape %[[VAL_0]] {{\[\[}}0, 1, 2]] output_shape [2, 3, %[[DIV]]] : tensor into tensor<2x3x?xf32> -// CHECK: return %[[VAL_1]] : tensor<2x3x?xf32> -func.func @test_reshape_3d_same_d2d_auto_identity(%arg0: tensor) -> tensor<2x3x?xf32> { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor) -> tensor<2x3x?xf32> - return %0 : tensor<2x3x?xf32> -} - -// ----- - -// CHECK-LABEL: test_reshape_3d_same_d2d_explicit_empty -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor<3x2x?xf32> -// CHECK: %[[VAL_0:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1, 2]] : tensor<3x2x?xf32> into tensor -// CHECK: %[[C0:.*]] = arith.constant 0 : index -// CHECK: %[[DIM:.*]] = tensor.dim %[[VAL_0]], %[[C0]] : tensor -// CHECK: %[[C6:.*]] = arith.constant 6 : index -// CHECK: %[[DIV:.*]] = arith.divui %[[DIM]], %[[C6]] : index -// CHECK: %[[EXPANDED:.*]] = tensor.expand_shape %[[VAL_0]] {{\[\[}}0, 1, 2]] output_shape [%[[DIV]], 3, 2] : tensor into tensor -// CHECK: %[[VAL_2:.*]] = tensor.cast %[[EXPANDED]] : tensor to tensor -// CHECK: return %[[VAL_2]] : tensor -func.func @test_reshape_3d_same_d2d_explicit_empty(%arg0: tensor<3x2x?xf32>) -> tensor { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor<3x2x?xf32>) -> tensor - return %0 : tensor -} - -// ----- - -// CHECK-LABEL: test_reshape_3d_same_d2d_explicit -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor -// CHECK: %[[VAL_0:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1, 2]] : tensor into tensor -// CHECK: %[[C0:.*]] = arith.constant 0 : index -// CHECK: %[[DIM:.*]] = tensor.dim %[[VAL_0]], %[[C0]] : tensor -// CHECK: %[[C12:.*]] = arith.constant 12 : index -// CHECK: %[[DIV:.*]] = arith.divui %[[DIM]], %[[C12]] : index -// CHECK: %[[EXPANDED:.*]] = tensor.expand_shape %[[VAL_0]] {{\[\[}}0, 1, 2]] output_shape [%[[DIV]], 3, 4] : tensor into tensor -// CHECK: %[[VAL_2:.*]] = tensor.cast %[[EXPANDED]] : tensor to tensor -// CHECK: return %[[VAL_2]] : tensor -func.func @test_reshape_3d_same_d2d_explicit(%arg0: tensor) -> tensor { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor) -> tensor - return %0 : tensor -} - -// ----- - -// CHECK-LABEL: test_reshape_3d_same_d2d_explicit_identity -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor -// CHECK: %[[VAL_0:.*]] = tensor.cast %[[ARG_0]] : tensor to tensor<2x3x?xf32> -// CHECK: return %[[VAL_0]] : tensor<2x3x?xf32> -func.func @test_reshape_3d_same_d2d_explicit_identity(%arg0: tensor) -> tensor<2x3x?xf32> { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor) -> tensor<2x3x?xf32> - return %0 : tensor<2x3x?xf32> -} - -// ----- - -// CHECK-LABEL: test_reshape_3d_same_d2s_auto -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor -// CHECK: %[[VAL_0:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1, 2]] : tensor into tensor -// CHECK: %[[C0:.*]] = arith.constant 0 : index -// CHECK: %[[DIM:.*]] = tensor.dim %[[VAL_0]], %[[C0]] : tensor -// CHECK: %[[C8:.*]] = arith.constant 8 : index -// CHECK: %[[DIV:.*]] = arith.divui %[[DIM]], %[[C8]] : index -// CHECK: %[[EXPANDED:.*]] = tensor.expand_shape %[[VAL_0]] {{\[\[}}0, 1, 2]] output_shape [2, %[[DIV]], 4] : tensor into tensor<2x?x4xf32> -// CHECK: %[[VAL_2:.*]] = tensor.cast %[[EXPANDED]] : tensor<2x?x4xf32> to tensor<2x3x4xf32> -// CHECK: return %[[VAL_2]] : tensor<2x3x4xf32> -func.func @test_reshape_3d_same_d2s_auto(%arg0: tensor) -> tensor<2x3x4xf32> { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor) -> tensor<2x3x4xf32> - return %0 : tensor<2x3x4xf32> -} - -// ----- - -// CHECK-LABEL: test_reshape_3d_same_d2s_explicit -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor -// CHECK: %[[VAL_0:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1, 2]] : tensor into tensor -// CHECK: %[[C0:.*]] = arith.constant 0 : index -// CHECK: %[[DIM:.*]] = tensor.dim %[[VAL_0]], %[[C0]] : tensor -// CHECK: %[[C12:.*]] = arith.constant 12 : index -// CHECK: %[[DIV:.*]] = arith.divui %[[DIM]], %[[C12]] : index -// CHECK: %[[EXPANDED:.*]] = tensor.expand_shape %[[VAL_0]] {{\[\[}}0, 1, 2]] output_shape [%[[DIV]], 3, 4] : tensor into tensor -// CHECK: %[[VAL_2:.*]] = tensor.cast %[[EXPANDED]] : tensor to tensor<2x3x4xf32> -// CHECK: return %[[VAL_2]] : tensor<2x3x4xf32> -func.func @test_reshape_3d_same_d2s_explicit(%arg0: tensor) -> tensor<2x3x4xf32> { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor) -> tensor<2x3x4xf32> - return %0 : tensor<2x3x4xf32> -} - -// ----- - -// CHECK-LABEL: test_reshape_3d_same_s2s_explicit_identity -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor<2x3x4xf32> -// CHECK: return %[[ARG_0]] : tensor<2x3x4xf32> -func.func @test_reshape_3d_same_s2s_explicit_identity(%arg0: tensor<2x3x4xf32>) -> tensor<2x3x4xf32> { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor<2x3x4xf32>) -> tensor<2x3x4xf32> - return %0 : tensor<2x3x4xf32> -} - -// ----- - -// CHECK-LABEL: test_reshape_3d_up_d2s_explicit -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor -// CHECK: %[[COLLAPSED:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1, 2]] : tensor into tensor -// CHECK: %[[C0:.*]] = arith.constant 0 : index -// CHECK: %[[DIM:.*]] = tensor.dim %[[COLLAPSED]], %[[C0]] : tensor -// CHECK: %[[C6:.*]] = arith.constant 6 : index -// CHECK: %[[VAL_0:.*]] = arith.divui %[[DIM]], %[[C6]] : index -// CHECK: %[[EXPANDED:.*]] = tensor.expand_shape %[[COLLAPSED]] {{\[\[}}0, 1, 2, 3]] output_shape [%[[VAL_0]], 3, 2, 1] : tensor into tensor -// CHECK: %[[CAST:.*]] = tensor.cast %[[EXPANDED]] : tensor to tensor<1x3x2x1xf32> -// CHECK: return %[[CAST]] : tensor<1x3x2x1xf32> -func.func @test_reshape_3d_up_d2s_explicit(%input: tensor) -> tensor<1x3x2x1xf32> { - %0 = tosa.reshape %input {new_shape = array} : (tensor) -> tensor<1x3x2x1xf32> - return %0 : tensor<1x3x2x1xf32> -} - -// ----- - -// CHECK-LABEL: test_reshape_4d_down_d2s_explicit -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor -// CHECK: %[[VAL_0:.*]] = tensor.cast %[[ARG_0]] : tensor to tensor<1x1x1x1xf32> -// CHECK: %[[VAL_1:.*]] = tensor.collapse_shape %[[VAL_0]] [] : tensor<1x1x1x1xf32> into tensor -// CHECK: return %[[VAL_1]] : tensor -func.func @test_reshape_4d_down_d2s_explicit(%arg0: tensor) -> tensor { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor) -> tensor - return %0 : tensor -} - -// ----- - -// CHECK-LABEL: test_reshape_5d_down_d2d_auto -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor -// CHECK: %[[COLLAPSED:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1, 2, 3, 4]] : tensor into tensor -// CHECK: %[[C0:.*]] = arith.constant 0 : index -// CHECK: %[[DIM:.*]] = tensor.dim %[[COLLAPSED]], %[[C0]] : tensor -// CHECK: %[[C6:.*]] = arith.constant 6 : index -// CHECK: %[[VAL_0:.*]] = arith.divui %[[DIM]], %[[C6]] : index -// CHECK: %[[EXPANDED:.*]] = tensor.expand_shape %[[COLLAPSED]] {{\[\[}}0, 1, 2]] output_shape [%[[VAL_0]], 2, 3] : tensor into tensor -// CHECK: return %[[EXPANDED]] : tensor -func.func @test_reshape_5d_down_d2d_auto(%arg0: tensor) -> tensor { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor) -> tensor - return %0 : tensor -} - -// ----- - -// CHECK-LABEL: test_reshape_6d_down_d2d_auto -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor<1x2x?x5x7x11xf32> -// CHECK: %[[COLLAPSED:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1, 2, 3, 4, 5]] : tensor<1x2x?x5x7x11xf32> into tensor -// CHECK: %[[C0:.*]] = arith.constant 0 : index -// CHECK: %[[DIM:.*]] = tensor.dim %[[COLLAPSED]], %[[C0]] : tensor -// CHECK: %[[C385:.*]] = arith.constant 385 : index -// CHECK: %[[VAL_0:.*]] = arith.divui %[[DIM]], %[[C385]] : index -// CHECK: %[[EXPANDED:.*]] = tensor.expand_shape %[[COLLAPSED]] {{\[\[}}0, 1, 2]] output_shape [%[[VAL_0]], 5, 77] : tensor into tensor -// CHECK: return %[[EXPANDED]] : tensor -func.func @test_reshape_6d_down_d2d_auto(%arg0: tensor<1x2x?x5x7x11xf32>) -> tensor { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor<1x2x?x5x7x11xf32>) -> tensor - return %0 : tensor -} - -// ----- - -// CHECK-LABEL: test_reshape_6d_down_s2s_auto -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor<1x2x3x5x7x11xf32> -// CHECK: %[[VAL_0:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1, 2], [3], [4, 5]] : tensor<1x2x3x5x7x11xf32> into tensor<6x5x77xf32> -// CHECK: return %[[VAL_0]] : tensor<6x5x77xf32> -func.func @test_reshape_6d_down_s2s_auto(%arg0: tensor<1x2x3x5x7x11xf32>) -> tensor<6x5x77xf32> { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor<1x2x3x5x7x11xf32>) -> tensor<6x5x77xf32> - return %0 : tensor<6x5x77xf32> -} - -// ----- - -// This test would previously fail on GCC with certain compiler flags. -// The GCC issue would cause invalid IR after tosa-to-tensor, so this test -// locks down that the code goes through tosa-to-tensor and verifies. -// -// See https://github.com/llvm/llvm-project/pull/91521 for a full description. - -// CHECK-LABEL: reshape_bug_fix -// CHECK: tensor.expand_shape -func.func @reshape_bug_fix(%arg0: tensor) -> tensor<1x1x1x?xf32> { - %0 = tosa.reshape %arg0 {new_shape = array} : (tensor) -> tensor<1x1x1x?xf32> - return %0 : tensor<1x1x1x?xf32> -} - -// ----- - -// CHECK-LABEL: test_reshape_6d_down_s2s_explicit -// CHECK-SAME: %[[ARG_0:[a-zA-Z0-9_]+]]: tensor<1x2x3x5x7x11xf32> -// CHECK: %[[VAL_0:.*]] = tensor.collapse_shape %[[ARG_0]] {{\[\[}}0, 1, 2], [3], [4, 5]] : tensor<1x2x3x5x7x11xf32> into tensor<6x5x77xf32> -// CHECK: return %[[VAL_0]] : tensor<6x5x77xf32> -func.func @test_reshape_6d_down_s2s_explicit(%arg0: tensor<1x2x3x5x7x11xf32>) -> tensor<6x5x77xf32> { - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor<1x2x3x5x7x11xf32>) -> tensor<6x5x77xf32> - return %0 : tensor<6x5x77xf32> -} - -// ----- - -// CHECK-LABEL: @test_reshape_samerank_unsigned -// CHECK-SAME: (%[[ARG0:.*]]: tensor<3x2xui8>) -func.func @test_reshape_samerank_unsigned(%arg0: tensor<3x2xui8>) -> tensor<2x3xui8> { - // CHECK-NEXT: %[[CAST1:.*]] = builtin.unrealized_conversion_cast %[[ARG0]] : tensor<3x2xui8> to tensor<3x2xi8> - // CHECK-NEXT: %[[RESHAPE1:.*]] = tensor.collapse_shape %[[CAST1]] {{\[}}[0, 1]] : tensor<3x2xi8> into tensor<6xi8> - // CHECK-NEXT: %[[RESHAPE2:.*]] = tensor.expand_shape %[[RESHAPE1]] {{\[}}[0, 1]] output_shape {{\[}}2, 3] : tensor<6xi8> into tensor<2x3xi8> - // CHECK-NEXT: %[[CAST2:.*]] = builtin.unrealized_conversion_cast %[[RESHAPE2]] : tensor<2x3xi8> to tensor<2x3xui8 - %0 = "tosa.reshape"(%arg0) {new_shape = array} : (tensor<3x2xui8>) -> tensor<2x3xui8> - // CHECK-NEXT: return %[[CAST2]] - return %0 : tensor<2x3xui8> -} - -// ----- - -// CHECK-LABEL: func @slice -func.func @slice(%arg0: tensor<6xf32>) ->() { - // CHECK: [[SLICE:%.+]] = tensor.extract_slice %arg0[2] [1] [1] - %0 = "tosa.slice"(%arg0) {start = array, size = array} : (tensor<6xf32>) -> (tensor<1xf32>) - return -} - -// ----- - -// CHECK-LABEL: @slice_dyn -func.func @slice_dyn(%arg0: tensor) -> (tensor) { - // CHECK: %[[C0:.+]] = arith.constant 0 : index - // CHECK: %[[DIM:.+]] = tensor.dim %arg0, %[[C0]] - // CHECK: %[[C2:.+]] = arith.constant 2 : index - // CHECK: %[[SUB:.+]] = arith.subi %[[DIM]], %[[C2]] - // CHECK: tensor.extract_slice %arg0[2] [%[[SUB]]] [1] - %0 = "tosa.slice"(%arg0) {start = array, size = array} : (tensor) -> (tensor) - return %0 : tensor -} - -// ----- - -// CHECK-LABEL: @pad_float -// CHECK-SAME: (%[[ARG0:[0-9a-zA-Z_]*]]: -func.func @pad_float(%arg0 : tensor<1x2xf32>) -> (tensor<4x9xf32>) { - %0 = arith.constant dense<[[1, 2], [3, 4]]> : tensor<2x2xi32> - // TODO: Output contains multiple "arith.constant 1 : index". - // CHECK-DAG: [[INDEX1:%.+]] = arith.constant 1 : index - // CHECK-DAG: [[INDEX2:%.+]] = arith.constant 2 : index - // CHECK-DAG: [[INDEX3:%.+]] = arith.constant 3 : index - // CHECK-DAG: [[INDEX4:%.+]] = arith.constant 4 : index - // CHECK-DAG: [[CST:%.+]] = arith.constant 0.000000e+00 : f32 - // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, [[INDEX3]]] high{{\[}}[[INDEX2]], [[INDEX4]]] { - // CHECK: tensor.yield [[CST]] - // CHECK: } : tensor<1x2xf32> to tensor<4x9xf32> - %1 = "tosa.pad"(%arg0, %0) : (tensor<1x2xf32>, tensor<2x2xi32>) -> (tensor<4x9xf32>) - return %1 : tensor<4x9xf32> -} - -func.func @pad_int(%arg0 : tensor<1x2xi32>) -> (tensor<4x9xi32>) { - %0 = arith.constant dense<[[1, 2], [3, 4]]> : tensor<2x2xi32> - // CHECK: [[CST:%.+]] = arith.constant 0 : i32 - // CHECK: tensor.pad - // CHECK: tensor.yield [[CST]] - %1 = "tosa.pad"(%arg0, %0) : (tensor<1x2xi32>, tensor<2x2xi32>) -> (tensor<4x9xi32>) - return %1 : tensor<4x9xi32> -} - -func.func @pad_quant(%arg0 : tensor<1x2xi32>) -> (tensor<4x9xi32>) { - %0 = arith.constant dense<[[1, 2], [3, 4]]> : tensor<2x2xi32> - // CHECK: [[CST:%.+]] = arith.constant 42 : i32 - // CHECK: tensor.pad - // CHECK: tensor.yield [[CST]] - %1 = "tosa.pad"(%arg0, %0) {quantization_info = #tosa.pad_quant} : (tensor<1x2xi32>, tensor<2x2xi32>) -> (tensor<4x9xi32>) - return %1 : tensor<4x9xi32> -} - -// ----- - -func.func @pad_float_explicit(%arg0 : tensor<1x2xf32>) -> (tensor<4x9xf32>) { - %0 = arith.constant dense<[[1, 2], [3, 4]]> : tensor<2x2xi32> - // TODO: Output contains multiple "arith.constant 1 : index". - // CHECK-DAG: [[INDEX1:%.+]] = arith.constant 1 : index - // CHECK-DAG: [[INDEX2:%.+]] = arith.constant 2 : index - // CHECK-DAG: [[INDEX3:%.+]] = arith.constant 3 : index - // CHECK-DAG: [[INDEX4:%.+]] = arith.constant 4 : index - // CHECK-DAG: [[CST:%.+]] = arith.constant 4.200000e+01 : f32 - // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, [[INDEX3]]] high{{\[}}[[INDEX2]], [[INDEX4]]] { - // CHECK: tensor.yield [[CST]] - // CHECK: } : tensor<1x2xf32> to tensor<4x9xf32> - %1 = arith.constant dense<42.0> : tensor - %2 = "tosa.pad"(%arg0, %0, %1) : (tensor<1x2xf32>, tensor<2x2xi32>, tensor) -> (tensor<4x9xf32>) - return %2 : tensor<4x9xf32> -} - -// ----- - -func.func @pad_dyn_input(%arg0 : tensor) -> (tensor) { - %0 = arith.constant dense<[[1, 2], [3, 4]]> : tensor<2x2xi32> - // TODO: Output contains multiple "arith.constant 1 : index". - // CHECK-DAG: [[INDEX1:%.+]] = arith.constant 1 : index - // CHECK-DAG: [[INDEX2:%.+]] = arith.constant 2 : index - // CHECK-DAG: [[INDEX3:%.+]] = arith.constant 3 : index - // CHECK-DAG: [[INDEX4:%.+]] = arith.constant 4 : index - // CHECK-DAG: [[CST:%.+]] = arith.constant 0.000000e+00 : f32 - // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, [[INDEX3]]] high{{\[}}[[INDEX2]], [[INDEX4]]] { - // CHECK: tensor.yield [[CST]] - // CHECK: } : tensor to tensor - %1 = "tosa.pad"(%arg0, %0) : (tensor, tensor<2x2xi32>) -> (tensor) - return %1 : tensor -} - -func.func @pad_dyn_padding(%arg0 : tensor<1x2xf32>) -> (tensor) { - %0 = arith.constant dense<[[-1, 2], [3, 4]]> : tensor<2x2xi32> - // TODO: Output contains multiple "arith.constant 1 : index". - // CHECK-DAG: [[INDEX1:%.+]] = arith.constant 1 : index - // CHECK-DAG: [[INDEX2:%.+]] = arith.constant 2 : index - // CHECK-DAG: [[INDEX3:%.+]] = arith.constant 3 : index - // CHECK-DAG: [[INDEX4:%.+]] = arith.constant 4 : index - // CHECK-DAG: [[CST:%.+]] = arith.constant 0.000000e+00 : f32 - // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, [[INDEX3]]] high{{\[}}[[INDEX2]], [[INDEX4]]] { - // CHECK: tensor.yield [[CST]] - // CHECK: } : tensor<1x2xf32> to tensor - %1 = "tosa.pad"(%arg0, %0) : (tensor<1x2xf32>, tensor<2x2xi32>) -> (tensor) - return %1 : tensor -} - -// ----- - -// CHECK-LABEL: @concat -// CHECK-SAME: %[[ARG0:.+]]: tensor<5x1xf32> -// CHECK-SAME: %[[ARG1:.+]]: tensor<6x1xf32> -func.func @concat(%arg0: tensor<5x1xf32>, %arg1: tensor<6x1xf32>) -> () { - // CHECK-DAG: [[INIT:%.+]] = tensor.empty() : tensor<11x1xf32> - // CHECK-DAG: [[INSERT0:%.+]] = tensor.insert_slice %[[ARG0]] into [[INIT]][0, 0] [5, 1] [1, 1] - // CHECK-DAG: [[INSERT1:%.+]] = tensor.insert_slice %[[ARG1]] into [[INSERT0]][5, 0] [6, 1] [1, 1] - %0 = "tosa.concat"(%arg0, %arg1) { axis = 0 : i32} : (tensor<5x1xf32>, tensor<6x1xf32>) -> (tensor<11x1xf32>) - - // CHECK-DAG: [[INIT:%.+]] = tensor.empty() : tensor<5x2xf32> - // CHECK-DAG: [[INSERT0:%.+]] = tensor.insert_slice %[[ARG0]] into [[INIT]][0, 0] [5, 1] [1, 1] - // CHECK: [[INSERT1:%.+]] = tensor.insert_slice %[[ARG0]] into [[INSERT0]][0, 1] [5, 1] [1, 1] - %1 = "tosa.concat"(%arg0, %arg0) { axis = 1 : i32} : (tensor<5x1xf32>, tensor<5x1xf32>) -> (tensor<5x2xf32>) - return -} - -// ----- - -// CHECK-LABEL: @concat_non_axis_dyn -// CHECK-SAME: (%[[ARG0:[0-9a-zA-Z_]*]]: -// CHECK-SAME: %[[ARG1:[0-9a-zA-Z_]*]] -func.func @concat_non_axis_dyn(%arg0: tensor<5x?xf32>, %arg1: tensor<6x?xf32>) -> () { - // CHECK-DAG: %[[AXIS:.+]] = arith.constant 0 - // CHECK-DAG: %[[IDX1:.+]] = arith.constant 1 - // CHECK-DAG: %[[DIM0:.+]] = tensor.dim %[[ARG0]], %[[IDX1]] - // CHECK-DAG: %[[INIT:.+]] = tensor.empty(%[[DIM0]]) : tensor<11x?xf32> - // CHECK-DAG: %[[IDX1_1:.+]] = arith.constant 1 : index - // CHECK-DAG: %[[DIM1:.+]] = tensor.dim %[[ARG0]], %[[IDX1_1]] - // CHECK-DAG: %[[INSERT0:.+]] = tensor.insert_slice %[[ARG0]] into %[[INIT]][0, 0] [5, %[[DIM1]]] [1, 1] - // CHECK-DAG: %[[IDX1_2:.+]] = arith.constant 1 : index - // CHECK-DAG: %[[DIM2:.+]] = tensor.dim %[[ARG1]], %[[IDX1_2]] : tensor<6x?xf32> - // CHECK: %[[INSERT1:.+]] = tensor.insert_slice %[[ARG1]] into %[[INSERT0]][5, 0] [6, %[[DIM2]]] [1, 1] - %0 = "tosa.concat"(%arg0, %arg1) { axis = 0 : i32} : (tensor<5x?xf32>, tensor<6x?xf32>) -> (tensor<11x?xf32>) - return -} - -// ----- - -// CHECK-LABEL: @concat_axis_dyn -// CHECK-SAME: (%[[ARG0:[0-9a-zA-Z_]*]]: -// CHECK-SAME: %[[ARG1:[0-9a-zA-Z_]*]]: -func.func @concat_axis_dyn(%arg0: tensor, %arg1: tensor) -> () { - // CHECK-DAG: %[[AXIS:.+]] = arith.constant 0 : index - // CHECK-DAG: %[[IDX0:.+]] = arith.constant 0 : index - // CHECK-DAG: %[[DIM0:.+]] = tensor.dim %[[ARG0]], %[[IDX0]] : tensor - // CHECK-DAG: %[[DIM1:.+]] = tensor.dim %[[ARG1]], %[[AXIS]] : tensor - // CHECK-DAG: %[[SUM:.+]] = arith.addi %[[DIM0]], %[[DIM1]] : index - // CHECK-DAG: %[[INIT:.+]] = tensor.empty(%[[SUM]]) : tensor - // CHECK-DAG: %[[IDX0_1:.+]] = arith.constant 0 : index - // CHECK-DAG: %[[DIM2:.+]] = tensor.dim %[[ARG0]], %[[IDX0_1]] : tensor - // CHECK-DAG: %[[INSERT0:.+]] = tensor.insert_slice %[[ARG0]] into %[[INIT]][0, 0] [%[[DIM2]], 3] [1, 1] : tensor into tensor - // CHECK-DAG: %[[IDX0_2:.+]] = arith.constant 0 : index - // CHECK-DAG: %[[DIM3:.+]] = tensor.dim %[[ARG1]], %[[IDX0_2]] : tensor - // CHECK: %[[INSERT1:.+]] = tensor.insert_slice %[[ARG1]] into %[[INSERT0]][%[[DIM0]], 0] [%[[DIM3]], 3] [1, 1] : tensor into tensor - - %0 = "tosa.concat"(%arg0, %arg1) { axis = 0 : i32} : (tensor, tensor) -> (tensor) - return -} - -// ----- - -// CHECK-LABEL: @concat_axis_dyn_mixed -// CHECK-SAME: (%[[ARG0:[0-9a-zA-Z_]*]]: -// CHECK-SAME: %[[ARG1:[0-9a-zA-Z_]*]]: -// CHECK-SAME: %[[ARG2:[0-9a-zA-Z_]*]]: -func.func @concat_axis_dyn_mixed(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> () { - // CHECK-DAG: %[[C0:.+]] = arith.constant 0 : index - // CHECK-DAG: %[[C0_0:.+]] = arith.constant 0 : index - // CHECK-DAG: %[[OFFSET0:.+]] = tensor.dim %[[ARG0]], %[[C0_0]] : tensor - // CHECK-DAG: %[[DIM1_0:.+]] = tensor.dim %[[ARG1]], %[[C0]] : tensor - // CHECK-DAG: %[[OFFSET1:.+]] = arith.addi %[[OFFSET0]], %[[DIM1_0]] : index - // CHECK-DAG: %[[DIM2_2:.+]] = tensor.dim %[[ARG2]], %[[C0]] : tensor - // CHECK-DAG: %[[OFFSET2:.+]] = arith.addi %[[OFFSET1]], %[[DIM2_2]] : index - // CHECK-DAG: %[[INIT:.+]] = tensor.empty() : tensor<5x1xf32> - // CHECK-DAG: %[[C0_3:.+]] = arith.constant 0 : index - // CHECK-DAG: %[[DIM_4:.+]] = tensor.dim %[[ARG0]], %[[C0_3]] : tensor - // CHECK-DAG: %[[INSERT0:.+]] = tensor.insert_slice %[[ARG0]] into %[[INIT]][0, 0] [%[[DIM_4]], 1] [1, 1] : tensor into tensor<5x1xf32> - // CHECK-DAG: %[[C0_4:.+]] = arith.constant 0 : index - // CHECK-DAG: %[[DIM_6:.+]] = tensor.dim %[[ARG1]], %[[C0_4]] : tensor - // CHECK-DAG: %[[INSERT1:.+]] = tensor.insert_slice %[[ARG1]] into %[[INSERT0]][%[[OFFSET0]], 0] [%[[DIM_6]], 1] [1, 1] : tensor into tensor<5x1xf32> - // CHECK-DAG: %[[C0_8:.+]] = arith.constant 0 : index - // CHECK-DAG: %[[DIM_9:.+]] = tensor.dim %[[ARG2]], %[[C0_8]] : tensor - // CHECK-DAG: %[[INSERT3:.+]] = tensor.insert_slice %[[ARG2]] into %[[INSERT1]][%[[OFFSET1]], 0] [%[[DIM_9]], 1] [1, 1] : tensor into tensor<5x1xf32> - - // CHECK: return - - %0 = "tosa.concat"(%arg0, %arg1, %arg2) <{axis = 0 : i32}> : (tensor, tensor, tensor) -> tensor<5x1xf32> - return -} - -// ----- - -// CHECK-LABEL: @concat_non_axis_dyn_mixed -// CHECK-SAME: (%[[ARG0:[0-9a-zA-Z_]*]]: -// CHECK-SAME: %[[ARG1:[0-9a-zA-Z_]*]]: -// CHECK-SAME: %[[ARG2:[0-9a-zA-Z_]*]]: -func.func @concat_non_axis_dyn_mixed(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> () { - // CHECK-DAG: %[[UNUSED0:.+]] = arith.constant 0 : index - // CHECK-DAG: %[[UNUSED1:.+]] = tensor.dim %[[ARG0]], %[[UNUSED0]] : tensor - - // CHECK-DAG: %[[INIT:.+]] = tensor.empty() : tensor<5x3xf32> - // CHECK-DAG: %[[C0_0:.+]] = arith.constant 0 : index - // CHECK-DAG: %[[DIM0_0:.+]] = tensor.dim %[[ARG0]], %[[C0_0]] : tensor - // CHECK-DAG: %[[INSERT0:.+]] = tensor.insert_slice %[[ARG0]] into %[[INIT]][0, 0] [%[[DIM0_0]], 1] [1, 1] : tensor into tensor<5x3xf32> - // CHECK-DAG: %[[C0_1:.+]] = arith.constant 0 : index - // CHECK-DAG: %[[DIM1_0:.+]] = tensor.dim %[[ARG1]], %[[C0_1]] : tensor - // CHECK-DAG: %[[INSERT1:.+]] = tensor.insert_slice %[[ARG1]] into %[[INSERT0]][0, 1] [%[[DIM1_0]], 1] [1, 1] : tensor into tensor<5x3xf32> - // CHECK-DAG: %[[C0_2:.+]] = arith.constant 0 : index - // CHECK-DAG: %[[DIM2_0:.+]] = tensor.dim %[[ARG2]], %[[C0_2]] : tensor - // CHECK-DAG: %[[INSERT2:.+]] = tensor.insert_slice %[[ARG2]] into %[[INSERT1]][0, 2] [%[[DIM2_0]], 1] [1, 1] : tensor into tensor<5x3xf32> - // CHECK: return - - %0 = "tosa.concat"(%arg0, %arg1, %arg2) <{axis = 1 : i32}> : (tensor, tensor, tensor) -> tensor<5x3xf32> - return -} diff --git a/mlir/test/Dialect/LLVMIR/global.mlir b/mlir/test/Dialect/LLVMIR/global.mlir index 3fa7636d4dd6..0649e814bfdf 100644 --- a/mlir/test/Dialect/LLVMIR/global.mlir +++ b/mlir/test/Dialect/LLVMIR/global.mlir @@ -132,7 +132,7 @@ llvm.mlir.global internal constant @constant(37.0) : !llvm.label // ----- func.func @foo() { - // expected-error @+1 {{op symbol's parent must have the SymbolTable trait}} + // expected-error @+1 {{must appear at the module level}} llvm.mlir.global internal @bar(42) : i32 return diff --git a/mlir/test/Dialect/LLVMIR/invalid.mlir b/mlir/test/Dialect/LLVMIR/invalid.mlir index fe288dab973f..6433b61b7275 100644 --- a/mlir/test/Dialect/LLVMIR/invalid.mlir +++ b/mlir/test/Dialect/LLVMIR/invalid.mlir @@ -90,20 +90,6 @@ func.func @alloca_non_integer_alignment() { // ----- -func.func @gep_missing_input_result_type(%pos : i64, %base : !llvm.ptr) { - // expected-error@+1 {{2 operands present, but expected 0}} - llvm.getelementptr %base[%pos] : () -> (), i64 -} - -// ----- - -func.func @gep_missing_input_type(%pos : i64, %base : !llvm.ptr) { - // expected-error@+1 {{2 operands present, but expected 0}} - llvm.getelementptr %base[%pos] : () -> (!llvm.ptr), i64 -} - -// ----- - func.func @gep_missing_result_type(%pos : i64, %base : !llvm.ptr) { // expected-error@+1 {{op requires one result}} llvm.getelementptr %base[%pos] : (!llvm.ptr, i64) -> (), i64 diff --git a/mlir/test/Dialect/Linalg/transform-op-replace.mlir b/mlir/test/Dialect/Linalg/transform-op-replace.mlir index 1a40912977de..2801522e81ac 100644 --- a/mlir/test/Dialect/Linalg/transform-op-replace.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-replace.mlir @@ -12,10 +12,8 @@ module attributes {transform.with_named_sequence} { transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) { %0 = transform.structured.match ops{["func.func"]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.replace %0 { - builtin.module { - func.func @foo() { - "dummy_op"() : () -> () - } + func.func @foo() { + "dummy_op"() : () -> () } } : (!transform.any_op) -> !transform.any_op transform.yield diff --git a/mlir/test/Dialect/Quant/Bytecode/types.mlir b/mlir/test/Dialect/Quant/Bytecode/types.mlir index 359a58557087..be080d730976 100644 --- a/mlir/test/Dialect/Quant/Bytecode/types.mlir +++ b/mlir/test/Dialect/Quant/Bytecode/types.mlir @@ -64,3 +64,58 @@ module @parseUniformPerAxisMixed attributes { bytecode.test = !quant.uniform } {} +//===----------------------------------------------------------------------===// +// QuantileQuantized +//===----------------------------------------------------------------------===// + +// CHECK-LABEL: parseQuantilePerLayerFp16 +module @parseQuantilePerLayerFp16 attributes { + // CHECK: !quant.quantile + bytecode.test = !quant.quantile +} {} + +// CHECK-LABEL: parseQuantilePerLayerBf16 +module @parseQuantilePerLayerBf16 attributes { + // CHECK: !quant.quantile + bytecode.test = !quant.quantile +} {} + +// CHECK-LABEL: parseQuantilePerLayerI8 +module @parseQuantilePerLayerI8 attributes { + // CHECK: !quant.quantile + bytecode.test = !quant.quantile +} {} + +// CHECK-LABEL: parseQuantilePerLayerU8 +module @parseQuantilePerLayerU8 attributes { + // CHECK: !quant.quantile + bytecode.test = !quant.quantile +} {} + +//===----------------------------------------------------------------------===// +// QuantileQuantizedPerAxis +//===----------------------------------------------------------------------===// + +// CHECK-LABEL: parseQuantilePerAxisScaleZero +module @parseQuantilePerAxisScaleZero attributes { + // CHECK: !quant.quantile + bytecode.test = !quant.quantile +} {} + +// CHECK-LABEL: parseQuantilePerAxisScaleZeroU4 +module @parseQuantilePerAxisScaleZeroU4 attributes { + // CHECK: !quant.quantile + bytecode.test = !quant.quantile:f16:f32:1, {-1.0000,-0.8667,-0.7333,-0.6000,-0.4667,-0.3333,-0.2000,-0.0667,0.0667,0.2000,0.3333,0.4667,0.6000,0.7333,0.8667,1.0000}:{2.000000e+02:-120,9.987200e-01:127}> +} {} + +// CHECK-LABEL: parseQuantilePerAxisScaleNoZero +module @parseQuantilePerAxisScaleNoZero attributes { + // CHECK: !quant.quantile + bytecode.test = !quant.quantile +} {} + +// CHECK-LABEL: parseQuantilePerAxisMixed +module @parseQuantilePerAxisMixed attributes { + // CHECK: !quant.quantile + bytecode.test = !quant.quantile +} {} diff --git a/mlir/test/Dialect/Quant/parse-any-invalid.mlir b/mlir/test/Dialect/Quant/parse-any-invalid.mlir index 41c5f9307071..7ea4ddc61db8 100644 --- a/mlir/test/Dialect/Quant/parse-any-invalid.mlir +++ b/mlir/test/Dialect/Quant/parse-any-invalid.mlir @@ -17,12 +17,12 @@ // ----- // Unrecognized storage type: illegal prefix -// expected-error@+1 {{illegal storage type prefix}} +// expected-error@+1 {{illegal quantized storage type alias}} !qalias = !quant.any:f32> // ----- // Unrecognized storage type: no width -// expected-error@+1 {{illegal storage type prefix}} +// expected-error@+1 {{illegal quantized storage type alias}} !qalias = !quant.any:f32> // ----- diff --git a/mlir/test/Dialect/Quant/parse-quantile-invalid.mlir b/mlir/test/Dialect/Quant/parse-quantile-invalid.mlir new file mode 100644 index 000000000000..005faa60e3cb --- /dev/null +++ b/mlir/test/Dialect/Quant/parse-quantile-invalid.mlir @@ -0,0 +1,188 @@ +// RUN: mlir-opt %s -split-input-file -verify-diagnostics + +// ----- +// Illegal missing quantileType +// expected-error@+1 {{expected ':'}} +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Illegal quantileType value +// expected-error@+1 {{illegal quantile type alias}} +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Illegal quantile array size +// expected-error@+1 {{quantiles array size needs to be equal to 2^(bit_size(storageType)), or (storageTypeMax - storageTypeMin + 1) when max and min differ from the type limits; expected: 256, found: 2}} +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Illegal quantile array size (per axis type) +// expected-error@+1 {{quantiles array size needs to be equal to 2^(bit_size(storageType)), or (storageTypeMax - storageTypeMin + 1) when max and min differ from the type limits; expected: 256, found: 2}} +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Unrecognized token: trailing +// expected-error@+1 {{expected '>'}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.99872:127 23> + +// ----- +// Unrecognized token: missing storage type maximum +// expected-error@+1 {{expected ':'}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.99872:127> + +// ----- +// Unrecognized token: missing closing angle bracket +// expected-error@+1 {{unbalanced '<' character in pretty dialect name}} +!qalias = !quant> + +// ----- +// Unrecognized token: missing type colon +// expected-error@+1 {{expected ':'}} +!qalias = !quant.quantilef16:f32, {-1.0,1.0}:0.99872:127> + +// ----- +// Unrecognized token: missing comma +// expected-error@+1 {{expected ','}} +!qalias = !quant.quantile + +// ----- +// Unrecognized storage type: illegal prefix +// expected-error@+1 {{illegal quantized storage type alias}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.99872:127> + +// ----- +// Unrecognized storage type: no width +// expected-error@+1 {{illegal quantized storage type alias}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.99872:127> + +// ----- +// Unrecognized storage type: storage size > 32 +// expected-error@+1 {{illegal storage type size: 33}} +!qalias = !quant.quantile + +// ----- +// Unrecognized storage type: storage size < 0 +// expected-error@+1 {{illegal quantized storage type alias}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.99872:127> + +// ----- +// Unrecognized storage type: storage size +// expected-error@+1 {{invalid integer width}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.99872:127> + +// ----- +// Illegal storage min/max: max - min < 0 +// expected-error@+1 {{illegal storage min and storage max: (2:1)}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.99872:127> + +// ----- +// Illegal storage min/max: max - min == 0 +// expected-error@+1 {{illegal storage min and storage max: (1:1)}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.99872:127> + +// ----- +// Illegal storage min/max: max > defaultMax +// expected-error@+1 {{illegal storage type maximum: 9}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.99872:127> + +// ----- +// Illegal storage min/max: min < defaultMin +// expected-error@+1 {{illegal storage type minimum: -9}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.99872:127> + +// ----- +// Illegal storage min/max: max > defaultMax +// expected-error@+1 {{illegal storage type maximum: 60000}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.99872:127> + +// ----- +// Illegal storage min/max: min < defaultMin +// expected-error@+1 {{illegal storage type minimum: -60000}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.99872:127> + +// ----- +// Illegal storage min/max: max > defaultMax +// expected-error@+1 {{illegal storage type maximum: 500}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.99872:127> + +// ----- +// Illegal storage min/max: min < defaultMin +// expected-error@+1 {{illegal storage type minimum: -500}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.99872:127> + +// ----- +// Illegal uniform params: invalid scale +// expected-error@+1 {{expected floating point literal}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:abc:127> + +// ----- +// Illegal uniform params: invalid zero point separator +// expected-error@+1 {{expected '>'}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.1abc> + +// ----- +// Illegal uniform params: missing zero point +// expected-error@+1 {{expected integer value}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.1:> + +// ----- +// Illegal uniform params: invalid zero point +// expected-error@+1 {{expected integer value}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:0.1:abc> + +// ----- +// Illegal expressed type: f33 +// expected-error@+1 {{expected non-function type}} +!qalias = !quant.quantile:f16:f33, {-1.0,1.0}:0.99872:127> + +// ----- +// Illegal uniform params: missing quantized dimension +// expected-error@+1 {{expected integer value}} +!qalias = !quant.quantile:f16:f32:, {-1.0,1.0}:{2.000000e+02:-19.987200e-01:1}> + +// ----- +// Illegal uniform params: unspecified quantized dimension, when multiple scales +// provided. +// expected-error@+1 {{expected floating point literal}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}:{2.000000e+02,-19.987200e-01:1}> + +// ----- +// Illegal quantile params: unspecified quantile values +// expected-error@+1 {{expected floating point literal}} +!qalias = !quant.quantile:f16:f32, {}:0.99872:127> + +// ----- +// Illegal quantile params: missing quantile values +// expected-error@+1 {{expected floating point literal}} +!qalias = !quant.quantile:f16:f32, {-1.0,}:0.99872:127> + +// ----- +// Illegal quantile params: missing colon separator +// expected-error@+1 {{expected ':'}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0}0.99872:127> + +// ----- +// Illegal quantile params: unbalanced } +// expected-error@+1 {{unbalanced '{' character in pretty dialect name}} +!qalias = !quant.quantile:f16:f32, {-1.0,1.0:0.99872:127> + +// ----- +// Illegal quantile params: missing { +// expected-error@+1 {{unbalanced '<' character in pretty dialect name}} +!qalias = !quant.quantile:f16:f32, -1.0,1.0}:0.99872:127> diff --git a/mlir/test/Dialect/Quant/parse-quantile.mlir b/mlir/test/Dialect/Quant/parse-quantile.mlir new file mode 100644 index 000000000000..1af567478e71 --- /dev/null +++ b/mlir/test/Dialect/Quant/parse-quantile.mlir @@ -0,0 +1,183 @@ +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file | FileCheck %s + +// ----- +// All per-layer params specified: +// [signed] storageType, storageTypeMin, storageTypeMax, expressedType, scale, zeroPoint +// CHECK: !quant.quantile:f16:f32, {-1.000000e+00,-8.667000e-01,-7.333000e-01,-6.000000e-01,-4.667000e-01,-3.333000e-01,-2.000000e-01,-0.066699999999999995,0.066699999999999995,2.000000e-01,3.333000e-01,4.667000e-01,6.000000e-01,7.333000e-01,8.667000e-01,1.000000e+00}:9.987200e-01:127> +!qalias = !quant.quantile:f16:f32, {-1.0000,-0.8667,-0.7333,-0.6000,-0.4667,-0.3333,-0.2000,-0.0667,0.0667,0.2000,0.3333,0.4667,0.6000,0.7333,0.8667,1.0000}:0.99872:127> +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Trailing whitespace. +// CHECK: !quant.quantile +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Default min/max value optimization for integers. +// CHECK: !quant.quantile +!qalias = !quant.quantile:f16:f32, {-1.0000,-0.8667,-0.7333,-0.6000,-0.4667,-0.3333,-0.2000,-0.0667,0.0667,0.2000,0.3333,0.4667,0.6000,0.7333,0.8667,1.0000}:0.99872:127 > +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Default min/max value optimization for f8E5M2. +// CHECK: !quant.quantile +!qalias = !quant.quantile:f16:f32, {-1.0000,-0.9922,-0.9843,-0.9765,-0.9686,-0.9608,-0.9529,-0.9451,-0.9373,-0.9294,-0.9216,-0.9137,-0.9059,-0.8980,-0.8902,-0.8824,-0.8745,-0.8667,-0.8588,-0.8510,-0.8431,-0.8353,-0.8275,-0.8196,-0.8118,-0.8039,-0.7961,-0.7882,-0.7804,-0.7725,-0.7647,-0.7569,-0.7490,-0.7412,-0.7333,-0.7255,-0.7176,-0.7098,-0.7020,-0.6941,-0.6863,-0.6784,-0.6706,-0.6627,-0.6549,-0.6471,-0.6392,-0.6314,-0.6235,-0.6157,-0.6078,-0.6000,-0.5922,-0.5843,-0.5765,-0.5686,-0.5608,-0.5529,-0.5451,-0.5373,-0.5294,-0.5216,-0.5137,-0.5059,-0.4980,-0.4902,-0.4824,-0.4745,-0.4667,-0.4588,-0.4510,-0.4431,-0.4353,-0.4275,-0.4196,-0.4118,-0.4039,-0.3961,-0.3882,-0.3804,-0.3725,-0.3647,-0.3569,-0.3490,-0.3412,-0.3333,-0.3255,-0.3176,-0.3098,-0.3020,-0.2941,-0.2863,-0.2784,-0.2706,-0.2627,-0.2549,-0.2471,-0.2392,-0.2314,-0.2235,-0.2157,-0.2078,-0.2000,-0.1922,-0.1843,-0.1765,-0.1686,-0.1608,-0.1529,-0.1451,-0.1373,-0.1294,-0.1216,-0.1137,-0.1059,-0.0980,-0.0902,-0.0824,-0.0745,-0.0667,-0.0588,-0.0510,-0.0431,-0.0353,-0.0275,-0.0196,-0.0118,-0.0039,0.0039,0.0118,0.0196,0.0275,0.0353,0.0431,0.0510,0.0588,0.0667,0.0745,0.0824,0.0902,0.0980,0.1059,0.1137,0.1216,0.1294,0.1373,0.1451,0.1529,0.1608,0.1686,0.1765,0.1843,0.1922,0.2000,0.2078,0.2157,0.2235,0.2314,0.2392,0.2471,0.2549,0.2627,0.2706,0.2784,0.2863,0.2941,0.3020,0.3098,0.3176,0.3255,0.3333,0.3412,0.3490,0.3569,0.3647,0.3725,0.3804,0.3882,0.3961,0.4039,0.4118,0.4196,0.4275,0.4353,0.4431,0.4510,0.4588,0.4667,0.4745,0.4824,0.4902,0.4980,0.5059,0.5137,0.5216,0.5294,0.5373,0.5451,0.5529,0.5608,0.5686,0.5765,0.5843,0.5922,0.6000,0.6078,0.6157,0.6235,0.6314,0.6392,0.6471,0.6549,0.6627,0.6706,0.6784,0.6863,0.6941,0.7020,0.7098,0.7176,0.7255,0.7333,0.7412,0.7490,0.7569,0.7647,0.7725,0.7804,0.7882,0.7961,0.8039,0.8118,0.8196,0.8275,0.8353,0.8431,0.8510,0.8588,0.8667,0.8745,0.8824,0.8902,0.8980,0.9059,0.9137,0.9216,0.9294,0.9373,0.9451,0.9529,0.9608,0.9686,0.9765,0.9843,0.9922,1.0000}:0.99872:127 > +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Default min/max value optimization for f8E4M3FN. +// CHECK: !quant.quantile +!qalias = !quant.quantile:f16:f32, {-1.0000,-0.9922,-0.9843,-0.9765,-0.9686,-0.9608,-0.9529,-0.9451,-0.9373,-0.9294,-0.9216,-0.9137,-0.9059,-0.8980,-0.8902,-0.8824,-0.8745,-0.8667,-0.8588,-0.8510,-0.8431,-0.8353,-0.8275,-0.8196,-0.8118,-0.8039,-0.7961,-0.7882,-0.7804,-0.7725,-0.7647,-0.7569,-0.7490,-0.7412,-0.7333,-0.7255,-0.7176,-0.7098,-0.7020,-0.6941,-0.6863,-0.6784,-0.6706,-0.6627,-0.6549,-0.6471,-0.6392,-0.6314,-0.6235,-0.6157,-0.6078,-0.6000,-0.5922,-0.5843,-0.5765,-0.5686,-0.5608,-0.5529,-0.5451,-0.5373,-0.5294,-0.5216,-0.5137,-0.5059,-0.4980,-0.4902,-0.4824,-0.4745,-0.4667,-0.4588,-0.4510,-0.4431,-0.4353,-0.4275,-0.4196,-0.4118,-0.4039,-0.3961,-0.3882,-0.3804,-0.3725,-0.3647,-0.3569,-0.3490,-0.3412,-0.3333,-0.3255,-0.3176,-0.3098,-0.3020,-0.2941,-0.2863,-0.2784,-0.2706,-0.2627,-0.2549,-0.2471,-0.2392,-0.2314,-0.2235,-0.2157,-0.2078,-0.2000,-0.1922,-0.1843,-0.1765,-0.1686,-0.1608,-0.1529,-0.1451,-0.1373,-0.1294,-0.1216,-0.1137,-0.1059,-0.0980,-0.0902,-0.0824,-0.0745,-0.0667,-0.0588,-0.0510,-0.0431,-0.0353,-0.0275,-0.0196,-0.0118,-0.0039,0.0039,0.0118,0.0196,0.0275,0.0353,0.0431,0.0510,0.0588,0.0667,0.0745,0.0824,0.0902,0.0980,0.1059,0.1137,0.1216,0.1294,0.1373,0.1451,0.1529,0.1608,0.1686,0.1765,0.1843,0.1922,0.2000,0.2078,0.2157,0.2235,0.2314,0.2392,0.2471,0.2549,0.2627,0.2706,0.2784,0.2863,0.2941,0.3020,0.3098,0.3176,0.3255,0.3333,0.3412,0.3490,0.3569,0.3647,0.3725,0.3804,0.3882,0.3961,0.4039,0.4118,0.4196,0.4275,0.4353,0.4431,0.4510,0.4588,0.4667,0.4745,0.4824,0.4902,0.4980,0.5059,0.5137,0.5216,0.5294,0.5373,0.5451,0.5529,0.5608,0.5686,0.5765,0.5843,0.5922,0.6000,0.6078,0.6157,0.6235,0.6314,0.6392,0.6471,0.6549,0.6627,0.6706,0.6784,0.6863,0.6941,0.7020,0.7098,0.7176,0.7255,0.7333,0.7412,0.7490,0.7569,0.7647,0.7725,0.7804,0.7882,0.7961,0.8039,0.8118,0.8196,0.8275,0.8353,0.8431,0.8510,0.8588,0.8667,0.8745,0.8824,0.8902,0.8980,0.9059,0.9137,0.9216,0.9294,0.9373,0.9451,0.9529,0.9608,0.9686,0.9765,0.9843,0.9922,1.0000}:0.99872:127 > +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Required per-layer params specified: +// [unsigned] storageType, expressedType, scale +// CHECK: !quant.quantile +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Exponential scale (-) +// CHECK: !quant.quantile +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Exponential scale (+) +// CHECK: !quant.quantile +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Storage type: f8E5M2 +// CHECK: !quant.quantile +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Storage type: f8E4M3FN +// CHECK: !quant.quantile +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Expressed type: f32 +// CHECK: !quant.quantile +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Expressed type: f32 +// CHECK: !quant.quantile +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Expressed type: f16 +// CHECK: !quant.quantile +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Expressed type: f64 +// CHECK: !quant.quantile +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Expressed type: bf16 +// CHECK: !quant.quantile +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Per-axis scales and zero points (affine) +// CHECK: !quant.quantile +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Per-axis scales and no zero points (fixedpoint) +// CHECK: !quant.quantile +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Per-axis scales and zero points (mixed affine and fixedpoint) +// CHECK: !quant.quantile +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Negative scale checking +// CHECK: !quant.quantile +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Per-axis negative scale checking +// CHECK: !quant.quantile +!qalias = !quant.quantile +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} diff --git a/mlir/test/Dialect/Quant/parse-uniform-invalid.mlir b/mlir/test/Dialect/Quant/parse-uniform-invalid.mlir index a82e8efdb1a3..698f17604f80 100644 --- a/mlir/test/Dialect/Quant/parse-uniform-invalid.mlir +++ b/mlir/test/Dialect/Quant/parse-uniform-invalid.mlir @@ -37,12 +37,12 @@ // ----- // Unrecognized storage type: illegal prefix -// expected-error@+1 {{illegal storage type prefix}} +// expected-error@+1 {{illegal quantized storage type alias}} !qalias = !quant.uniform:f32, 0.99872:127> // ----- // Unrecognized storage type: no width -// expected-error@+1 {{illegal storage type prefix}} +// expected-error@+1 {{illegal quantized storage type alias}} !qalias = !quant.uniform:f32, 0.99872:127> // ----- @@ -52,7 +52,7 @@ // ----- // Unrecognized storage type: storage size < 0 -// expected-error@+1 {{illegal storage type prefix}} +// expected-error@+1 {{illegal quantized storage type alias}} !qalias = !quant.uniform:f32, 0.99872:127> // ----- @@ -80,6 +80,26 @@ // expected-error@+1 {{illegal storage type minimum: -9}} !qalias = !quant.uniform:f32, 0.99872:127> +// ----- +// Illegal storage min/max: max > defaultMax +// expected-error@+1 {{illegal storage type maximum: 60000}} +!qalias = !quant.uniform:f32, 0.99872:127> + +// ----- +// Illegal storage min/max: min < defaultMin +// expected-error@+1 {{illegal storage type minimum: -60000}} +!qalias = !quant.uniform:f32, 0.99872:127> + +// ----- +// Illegal storage min/max: max > defaultMax +// expected-error@+1 {{illegal storage type maximum: 500}} +!qalias = !quant.uniform:f32, 0.99872:127> + +// ----- +// Illegal storage min/max: min < defaultMin +// expected-error@+1 {{illegal storage type minimum: -500}} +!qalias = !quant.uniform:f32, 0.99872:127> + // ----- // Illegal uniform params: invalid scale // expected-error@+1 {{expected floating point literal}} @@ -105,11 +125,6 @@ // expected-error@+1 {{expected non-function type}} !qalias = !quant.uniform:f33, 0.99872:127> -// ----- -// Illegal scale: negative -// expected-error@+1 {{illegal scale: -1.000000}} -!qalias = !quant.uniform:f32, -1.0:127> - // ----- // Illegal uniform params: missing quantized dimension // expected-error@+1 {{expected integer value}} diff --git a/mlir/test/Dialect/Quant/parse-uniform.mlir b/mlir/test/Dialect/Quant/parse-uniform.mlir index 4fbe86d935ea..51d3f14fb976 100644 --- a/mlir/test/Dialect/Quant/parse-uniform.mlir +++ b/mlir/test/Dialect/Quant/parse-uniform.mlir @@ -19,6 +19,33 @@ func.func @parse() -> !qalias { return %0 : !qalias } +// ----- +// Default min/max value optimization for integers. +// CHECK: !quant.uniform +!qalias = !quant.uniform:f32, 0.99872:127 > +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Default min/max value optimization for f8E5M2. +// CHECK: !quant.uniform +!qalias = !quant.uniform:f32, 0.99872:127 > +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Default min/max value optimization for f8E4M3FN. +// CHECK: !quant.uniform +!qalias = !quant.uniform:f32, 0.99872:127 > +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + // ----- // Required per-layer params specified: // [unsigned] storageType, expressedType, scale @@ -47,6 +74,24 @@ func.func @parse() -> !qalias { return %0 : !qalias } +// ----- +// Storage type: f8E5M2 +// CHECK: !quant.uniform +!qalias = !quant.uniform +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Storage type: f8E4M3FN +// CHECK: !quant.uniform +!qalias = !quant.uniform +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + // ----- // Storage type: i16 // CHECK: !quant.uniform @@ -154,3 +199,21 @@ func.func @parse() -> !qalias { %0 = "foo"() : () -> !qalias return %0 : !qalias } + +// ----- +// Negative scale checking +// CHECK: !quant.uniform +!qalias = !quant.uniform +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} + +// ----- +// Per axis negative scale checking +// CHECK: !quant.uniform +!qalias = !quant.uniform +func.func @parse() -> !qalias { + %0 = "foo"() : () -> !qalias + return %0 : !qalias +} diff --git a/mlir/test/Dialect/Test/bufferize.mlir b/mlir/test/Dialect/Test/bufferize.mlir new file mode 100644 index 000000000000..c589ee6086d4 --- /dev/null +++ b/mlir/test/Dialect/Test/bufferize.mlir @@ -0,0 +1,15 @@ +// RUN: mlir-opt --split-input-file --test-bufferize -canonicalize -cse %s | FileCheck %s + +// CHECK-LABEL: func.func @custom_dialect_op( +// CHECK-SAME: %[[ARG:.*]]: !test.test_tensor<[32, 64], f64> +// CHECK-SAME: ) -> !test.test_tensor<[32, 64], f64> { +// CHECK: %[[MEMREF:.*]] = bufferization.to_memref %[[ARG]] : !test.test_memref<[32, 64], f64> +// CHECK: %[[DUMMY:.*]] = "test.dummy_memref_op"(%[[MEMREF]]) : (!test.test_memref<[32, 64], f64>) +// CHECK-SAME: -> !test.test_memref<[32, 64], f64> +// CHECK: %[[OUT:.*]] = bufferization.to_tensor %[[DUMMY]] : !test.test_memref<[32, 64], f64> +// CHECK: return %[[OUT]] : !test.test_tensor<[32, 64], f64> +// CHECK: } +func.func @custom_dialect_op(%arg: !test.test_tensor<[32, 64], f64>) -> !test.test_tensor<[32, 64], f64> { + %out = "test.dummy_tensor_op"(%arg) : (!test.test_tensor<[32, 64], f64>) -> !test.test_tensor<[32, 64], f64> + return %out : !test.test_tensor<[32, 64], f64> +} diff --git a/mlir/test/Dialect/Transform/ops-invalid.mlir b/mlir/test/Dialect/Transform/ops-invalid.mlir index 71a260f1196e..1e2f7ad69ab8 100644 --- a/mlir/test/Dialect/Transform/ops-invalid.mlir +++ b/mlir/test/Dialect/Transform/ops-invalid.mlir @@ -482,9 +482,10 @@ module { // ----- module attributes { transform.with_named_sequence} { + // expected-note @below {{ancestor transform op}} transform.sequence failures(suppress) { ^bb0(%arg0: !transform.any_op): - // expected-error @below {{op symbol's parent must have the SymbolTable trai}} + // expected-error @below {{cannot be defined inside another transform op}} transform.named_sequence @nested() { transform.yield } diff --git a/mlir/test/Dialect/XeGPU/XeGPUOps.mlir b/mlir/test/Dialect/XeGPU/XeGPUOps.mlir deleted file mode 100644 index 00d32d2a2ee9..000000000000 --- a/mlir/test/Dialect/XeGPU/XeGPUOps.mlir +++ /dev/null @@ -1,179 +0,0 @@ -// RUN: mlir-opt %s | FileCheck %s -// Verify the printed output can be parsed. -// RUN: mlir-opt %s | mlir-opt | FileCheck %s -// Verify the generic form can be parsed. -// RUN: mlir-opt -mlir-print-op-generic %s | mlir-opt | FileCheck %s - -// CHECK-LABEL: gpu.module @test { -gpu.module @test { -// CHECK: gpu.func @test_create_nd_tdesc_vc_1(%[[arg0:.*]]: memref<24x32xf32>) { -gpu.func @test_create_nd_tdesc_vc_1(%src: memref<24x32xf32>) { - // CHECK: %[[REG:.*]] = xegpu.create_nd_tdesc %arg0[0, 0] : memref<24x32xf32> -> !xegpu.tensor_desc<8x16xf32> - %1 = xegpu.create_nd_tdesc %src[0, 0] : memref<24x32xf32> -> !xegpu.tensor_desc<8x16xf32> - gpu.return -} - -// CHECK: gpu.func @test_create_nd_tdesc_vc_2(%[[arg0:.*]]: ui64, %[[arg1:.*]]: index, %[[arg2:.*]]: index, %[[arg3:.*]]: index, %[[arg4:.*]]: index) { -gpu.func @test_create_nd_tdesc_vc_2(%src: ui64, %w : index, %h : index, %x : index, %y : index) { - //CHECK: %[[C:.*]] = arith.constant 1 : index - %c1 = arith.constant 1 : index - // CHECK: %[[REG:.*]] = xegpu.create_nd_tdesc %[[arg0]][%[[arg3]], %[[arg4]]], [%[[arg2]], %[[arg1]]], [%[[arg1]], %[[C]]] : ui64 -> !xegpu.tensor_desc<8x16xf32> - %1 = xegpu.create_nd_tdesc %src[%x, %y], [%h, %w], [%w, %c1] : ui64 -> !xegpu.tensor_desc<8x16xf32> - gpu.return -} - -// CHECK: gpu.func @test_create_nd_tdesc_vc_3(%[[arg0:.*]]: memref<24x32xf32>) { -gpu.func @test_create_nd_tdesc_vc_3(%src: memref<24x32xf32>) { - // CHECK: %[[REG:.*]] = xegpu.create_nd_tdesc %[[arg0]][0, 0] : memref<24x32xf32> -> !xegpu.tensor_desc<24x16xf32, #xegpu.tdesc_attr - %1 = xegpu.create_nd_tdesc %src[0, 0] : memref<24x32xf32> -> !xegpu.tensor_desc<24x16xf32, #xegpu.tdesc_attr> - gpu.return -} - -// CHECK: gpu.func @test_prefetch_nd_vc(%[[arg0:.*]]: memref<24x32xf16>) { -gpu.func @test_prefetch_nd_vc(%src: memref<24x32xf16>) { - // CHECK: %[[R0:.*]] = xegpu.create_nd_tdesc %[[arg0]][0, 0] : memref<24x32xf16> -> !xegpu.tensor_desc<8x16xf16> - %1 = xegpu.create_nd_tdesc %src[0, 0] : memref<24x32xf16> -> !xegpu.tensor_desc<8x16xf16> - // CHECK: xegpu.prefetch_nd %[[R0]] <{l1_hint = #xegpu.cache_hint, l2_hint = #xegpu.cache_hint}> : !xegpu.tensor_desc<8x16xf16> - xegpu.prefetch_nd %1 <{l1_hint = #xegpu.cache_hint, l2_hint = #xegpu.cache_hint}>: !xegpu.tensor_desc<8x16xf16> - gpu.return -} - -// CHECK: func @test_load_nd_vc(%[[arg0:.*]]: memref<8x16xf16>) { -gpu.func @test_load_nd_vc(%src: memref<8x16xf16>) { - // CHECK: %[[R0:.*]] = xegpu.create_nd_tdesc %arg0[0, 0] : memref<8x16xf16> -> !xegpu.tensor_desc<8x16xf16> - %1 = xegpu.create_nd_tdesc %src[0, 0] : memref<8x16xf16> -> !xegpu.tensor_desc<8x16xf16> - // CHECK: %[[R1:.*]] = xegpu.load_nd %[[R0]] <{l1_hint = #xegpu.cache_hint, l2_hint = #xegpu.cache_hint, vnni_axis = 0 : i64}> : !xegpu.tensor_desc<8x16xf16> -> vector<4x16x2xf16> - %2 = xegpu.load_nd %1 <{vnni_axis = 0, l1_hint = #xegpu.cache_hint, l2_hint = #xegpu.cache_hint}> - : !xegpu.tensor_desc<8x16xf16> -> vector<4x16x2xf16> - gpu.return -} - -// CHECK: func @test_store_nd_vc(%[[arg0:.*]]: memref<24x32xf16>) { -gpu.func @test_store_nd_vc(%dst: memref<24x32xf16>) { - // CHECK: %[[C:.*]] = arith.constant dense<1.000000e+00> : vector<24x32xf16> - %1 = arith.constant dense<1.0>: vector<24x32xf16> - // CHECK: %[[R0:.*]] = xegpu.create_nd_tdesc %[[arg0]][0, 0] : memref<24x32xf16> -> !xegpu.tensor_desc<24x32xf16> - %2 = xegpu.create_nd_tdesc %dst[0, 0] : memref<24x32xf16> -> !xegpu.tensor_desc<24x32xf16> - // CHECK: xegpu.store_nd %[[C]], %[[R0]] <{l1_hint = #xegpu.cache_hint, l2_hint = #xegpu.cache_hint}> : vector<24x32xf16>, !xegpu.tensor_desc<24x32xf16> - xegpu.store_nd %1, %2 <{l1_hint = #xegpu.cache_hint, l2_hint = #xegpu.cache_hint}>: vector<24x32xf16>, !xegpu.tensor_desc<24x32xf16> - gpu.return -} - -// CHECK: gpu.func @test_create_update_nd_tdesc_vc(%[[arg0:.*]]: memref<24x32xf32>) { -gpu.func @test_create_update_nd_tdesc_vc(%src: memref<24x32xf32>) { - // CHECK: %[[REG:.*]] = xegpu.create_nd_tdesc %arg0[0, 0] : memref<24x32xf32> -> !xegpu.tensor_desc<8x16xf32> - %1 = xegpu.create_nd_tdesc %src[0, 0] : memref<24x32xf32> -> !xegpu.tensor_desc<8x16xf32> - // CHECK: %[[R1:.*]] = xegpu.update_nd_offset %[[REG]], [0, 16] : !xegpu.tensor_desc<8x16xf32> - %2 = xegpu.update_nd_offset %1, [0, 16]: !xegpu.tensor_desc<8x16xf32> - gpu.return -} - -// CHECK: gpu.func @test_create_tdesc_vc(%[[arg0:.*]]: ui64) { -gpu.func @test_create_tdesc_vc(%src: ui64) { - //CHECK: %[[R0:.*]] = xegpu.create_tdesc %arg0 [0, 8, 16, 24] {chunk_size = 2 : i64} : ui64 -> !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - %1 = xegpu.create_tdesc %src[0, 8, 16, 24] {chunk_size = 2} : ui64 -> !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - gpu.return -} - -// CHECK: gpu.func @test_prefetch_vc(%[[arg0:.*]]: ui64) { -gpu.func @test_prefetch_vc(%src: ui64) { - //CHECK: %[[R0:.*]] = xegpu.create_tdesc %arg0 [0, 8, 16, 24] {chunk_size = 2 : i64} : ui64 -> !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - %1 = xegpu.create_tdesc %src[0, 8, 16, 24] {chunk_size = 2} : ui64 -> !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - // CHECK: xegpu.prefetch %[[R0]] <{l1_hint = #xegpu.cache_hint, l2_hint = #xegpu.cache_hint}> : !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - xegpu.prefetch %1 <{l1_hint = #xegpu.cache_hint, l2_hint = #xegpu.cache_hint}>: !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - gpu.return -} - -// CHECK: gpu.func @test_load_gather_vc(%[[arg0:.*]]: ui64) { -gpu.func @test_load_gather_vc(%src: ui64) { - //CHECK: %[[cst:.*]] = arith.constant dense : vector<4xi1> - %0 = arith.constant dense<1>: vector<4xi1> - //CHECK: %[[R0:.*]] = xegpu.create_tdesc %arg0 [0, 8, 16, 24] {chunk_size = 2 : i64} : ui64 -> !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - %1 = xegpu.create_tdesc %src[0, 8, 16, 24] {chunk_size = 2} : ui64 -> !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - //CHECK: %[[R1:.*]] = xegpu.load %[[R0]], %[[cst]] <{l1_hint = #xegpu.cache_hint, l2_hint = #xegpu.cache_hint}> - //CHECK-SAME: !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr>, vector<4xi1> -> vector<4x2xf32> - %2 = xegpu.load %1, %0 <{l1_hint = #xegpu.cache_hint, l2_hint = #xegpu.cache_hint}> - : !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr>, vector<4xi1> -> vector<4x2xf32> - gpu.return -} - -// CHECK: gpu.func @test_store_scatter_vc(%[[arg0:.*]]: ui64) { -gpu.func @test_store_scatter_vc(%src: ui64) { - //CHECK: %[[c0:.*]] = arith.constant dense : vector<4xi1> - %0 = arith.constant dense<1>: vector<4xi1> - //CHECK: %[[c1:.*]] = arith.constant dense<2.900000e+00> : vector<4x2xf32> - %1 = arith.constant dense<2.9>: vector<4x2xf32> - //CHECK: %[[R0:.*]] = xegpu.create_tdesc %arg0 [0, 8, 16, 24] {chunk_size = 2 : i64} : ui64 -> !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - %2 = xegpu.create_tdesc %src[0, 8, 16, 24] {chunk_size = 2} : ui64 -> !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - //CHECK: xegpu.store %[[c1]], %[[R0]], %[[c0]] <{l1_hint = #xegpu.cache_hint, l2_hint = #xegpu.cache_hint}> - //CHECK-SAME: vector<4x2xf32>, !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr>, vector<4xi1> - xegpu.store %1, %2, %0 <{l1_hint = #xegpu.cache_hint, l2_hint = #xegpu.cache_hint}> - : vector<4x2xf32>, !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr>, vector<4xi1> - gpu.return -} - -// CHECK: gpu.func @test_create_update_tdesc_vc(%[[arg0:.*]]: ui64) { -gpu.func @test_create_update_tdesc_vc(%src: ui64) { - //CHECK: %[[R0:.*]] = xegpu.create_tdesc %arg0 [0, 8, 16, 24] {chunk_size = 2 : i64} : ui64 -> !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - %1 = xegpu.create_tdesc %src[0, 8, 16, 24] {chunk_size = 2} : ui64 -> !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - //CHECK: %[[R1:.*]] = xegpu.update_offset %[[R0]], [32, 32, 32, 32] : !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - %2 = xegpu.update_offset %1, [32, 32, 32, 32] : !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - gpu.return -} - -// CHECK: gpu.func @test_dpas_vc(%[[arg0:.*]]: vector<8x8x2xf16>, %[[arg1:.*]]: vector<8x16x2xf16>) -gpu.func @test_dpas_vc(%a : vector<8x8x2xf16>, %b: vector<8x16x2xf16>) { - // CHECK: %0 = xegpu.dpas %[[arg0]], %[[arg1]] : vector<8x8x2xf16>, vector<8x16x2xf16> -> vector<8x16xf32> - %1 = xegpu.dpas %a, %b: vector<8x8x2xf16>, vector<8x16x2xf16> -> vector<8x16xf32> - gpu.return -} - -// CHECK: gpu.func @test_atomic_rmw(%[[arg0:.*]]: ui64, %[[arg1:.*]]: vector<16xf32>, %[[arg2:.*]]: vector<16xi1>) -gpu.func @test_atomic_rmw(%src: ui64, %value : vector<16xf32>, %mask : vector<16xi1>) { - //CHECK: %[[R0:.*]] = xegpu.create_tdesc %[[arg0]] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] : ui64 -> !xegpu.tensor_desc<16xf32, #xegpu.tdesc_attr> - %1 = xegpu.create_tdesc %src[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]: ui64 -> !xegpu.tensor_desc<16xf32, #xegpu.tdesc_attr> - //CHECK: %[[R1:.*]] = xegpu.atomic_rmw addf %[[R0]], %[[arg2]], %[[arg1]] : <16xf32, #xegpu.tdesc_attr>, vector<16xi1>, vector<16xf32> -> vector<16xf32> - xegpu.atomic_rmw addf %1, %mask, %value: !xegpu.tensor_desc<16xf32, #xegpu.tdesc_attr>, vector<16xi1>, vector<16xf32> -> vector<16xf32> - gpu.return -} - -// CHECK: gpu.func @alloc_nbarrier({{.*}}) { -gpu.func @alloc_nbarrier() { - // CHECK: xegpu.alloc_nbarrier - xegpu.alloc_nbarrier 8 - gpu.return -} - -// CHECK: gpu.func @init_nbarrier({{.*}}) { -gpu.func @init_nbarrier() { - //CHECK: %[[c1:.*]] = arith.constant 1 : i8 - //CHECK: %[[c16:.*]] = arith.constant 16 : i8 - %nbarrier_id = arith.constant 1 : i8 - %threads_count = arith.constant 16 : i8 - //CHECK: xegpu.init_nbarrier %[[c1]], %[[c16]] : i8, i8 -> !xegpu.nbarrier - %nbarrier = xegpu.init_nbarrier %nbarrier_id, %threads_count : i8, i8 -> !xegpu.nbarrier - gpu.return -} - -// CHECK: gpu.func @nbarrier_arrive(%[[arg0:.*]]: !xegpu.nbarrier) { -gpu.func @nbarrier_arrive(%nbarrier : !xegpu.nbarrier) { - //CHECK: xegpu.nbarrier_arrive %[[arg0]] : !xegpu.nbarrier - xegpu.nbarrier_arrive %nbarrier : !xegpu.nbarrier - gpu.return -} - -// CHECK: gpu.func @nbarrier_wait(%[[arg0:.*]]: !xegpu.nbarrier) { -gpu.func @nbarrier_wait(%nbarrier : !xegpu.nbarrier) { - //CHECK: xegpu.nbarrier_wait %[[arg0]] : !xegpu.nbarrier - xegpu.nbarrier_wait %nbarrier : !xegpu.nbarrier - gpu.return -} - -// CHECK-LABEL: gpu.func @fence({{.*}}) { -gpu.func @fence() { - //CHECK: xegpu.fence memory_kind = global, fence_scope = workgroup - xegpu.fence memory_kind = global, fence_scope = workgroup - gpu.return -} - -} diff --git a/mlir/test/Dialect/XeGPU/invalid.mlir b/mlir/test/Dialect/XeGPU/invalid.mlir deleted file mode 100644 index 7819ad60b97d..000000000000 --- a/mlir/test/Dialect/XeGPU/invalid.mlir +++ /dev/null @@ -1,187 +0,0 @@ -// RUN: mlir-opt %s -split-input-file -verify-diagnostics - -// ----- -func.func @test_create_nd_tdesc_vc_1(%src: memref<24xf32>) { - // expected-error@+1 {{Expecting the rank of shape, strides, offsets, source memref type (if source is a memref) and TensorDesc should match with each other. They currenlty are 2D.}} - %1 = xegpu.create_nd_tdesc %src[0] : memref<24xf32> -> !xegpu.tensor_desc<8x16xf32> - return -} - -// ----- - -func.func @test_create_nd_tdesc_vc_2(%src: memref<24x32xf32>) { - // expected-error@+1 {{TensorDesc should have the same element type with the source if it is a memref}} - %1 = xegpu.create_nd_tdesc %src[0, 0] : memref<24x32xf32> -> !xegpu.tensor_desc<8x16xf16> - return -} - -// ----- -func.func @test_prefetch_nd_vc_1(%src: memref<24x32xf16>) { - %1 = xegpu.create_nd_tdesc %src[0, 0] : memref<24x32xf16> -> !xegpu.tensor_desc<8x16xf16> - // expected-error@+1 {{invlid l1_hint: #xegpu.cache_hint}} - xegpu.prefetch_nd %1 <{l1_hint = #xegpu.cache_hint}>: !xegpu.tensor_desc<8x16xf16> - return -} - -// ----- -func.func @test_prefetch_nd_vc_2(%src: memref<24xf16>) { - %1 = xegpu.create_tdesc %src[0, 1, 2, 3, 4, 5, 6, 7] - : memref<24xf16> -> !xegpu.tensor_desc<8xf16, #xegpu.tdesc_attr> - // expected-error@+1 {{Expects a non-scattered TensorDesc}} - xegpu.prefetch_nd %1 <{l1_hint = #xegpu.cache_hint}> - : !xegpu.tensor_desc<8xf16, #xegpu.tdesc_attr> - return -} - -// ----- -func.func @test_load_nd_vc_1(%src: memref<8x16xf16>) { - %1 = xegpu.create_nd_tdesc %src[0, 0] : memref<8x16xf16> -> !xegpu.tensor_desc<8x16xf16> - // expected-error@+1 {{invlid l1_hint: #xegpu.cache_hint}} - %2 = xegpu.load_nd %1 <{l1_hint = #xegpu.cache_hint}> - : !xegpu.tensor_desc<8x16xf16> -> vector<4x16x2xf16> - return -} - -// ----- -func.func @test_load_nd_vc_2(%src: memref<16xf16>) { - %1 = xegpu.create_tdesc %src[0, 2, 4, 6, 8, 10, 12, 14] {chunk_size = 2} - : memref<16xf16> -> !xegpu.tensor_desc<8x2xf16, #xegpu.tdesc_attr> - // expected-error@+1 {{Expects a non-scattered TensorDesc.}} - %2 = xegpu.load_nd %1 <{l1_hint = #xegpu.cache_hint}> - : !xegpu.tensor_desc<8x2xf16, #xegpu.tdesc_attr> -> vector<8x2xf16> - return -} - -// ----- -func.func @test_store_nd_vc_1(%dst: memref<24x32xf16>) { - %1 = arith.constant dense<1.0>: vector<24x32xf16> - %2 = xegpu.create_nd_tdesc %dst[0, 0] : memref<24x32xf16> -> !xegpu.tensor_desc<24x32xf16> - // expected-error@+1 {{invlid l1_hint: #xegpu.cache_hint}} - xegpu.store_nd %1, %2 <{l1_hint = #xegpu.cache_hint}>: vector<24x32xf16>, !xegpu.tensor_desc<24x32xf16> - return -} - -// ----- -func.func @test_store_nd_vc_2(%dst: memref<16xf16>) { - %1 = arith.constant dense<1.0>: vector<8x2xf16> - %2 = xegpu.create_tdesc %dst[0, 2, 4, 6, 8, 10, 12, 14] {chunk_size = 2} - : memref<16xf16> -> !xegpu.tensor_desc<8x2xf16, #xegpu.tdesc_attr> - // expected-error@+1 {{Expects a non-scattered TensorDesc}} - xegpu.store_nd %1, %2 <{l1_hint = #xegpu.cache_hint}> - : vector<8x2xf16>, !xegpu.tensor_desc<8x2xf16, #xegpu.tdesc_attr> - return -} - -// ----- -func.func @test_update_nd_offset_1(%dst: memref<16xf16>) { - %1 = xegpu.create_tdesc %dst[0, 2, 4, 6, 8, 10, 12, 14] {chunk_size = 2} - : memref<16xf16> -> !xegpu.tensor_desc<8x2xf16, #xegpu.tdesc_attr> - // expected-error@+1 {{Expects a non-scattered TensorDesc}} - xegpu.update_nd_offset %1, [0, 2] : !xegpu.tensor_desc<8x2xf16, #xegpu.tdesc_attr> - return -} - -// ----- -func.func @test_create_tdesc_vc_1(%src: ui64) { - // expected-error@+1 {{Expects a scattered TensorDesc}} - %1 = xegpu.create_tdesc %src[0, 2, 4, 6, 8, 10, 12, 14] {chunk_size = 2} - : ui64 -> !xegpu.tensor_desc<8x2xf16> - return -} - -// ----- -func.func @test_create_tdesc_vc_2(%src: ui64) { - // expected-error@+1 {{Incorrect TensorDesc shape}} - %1 = xegpu.create_tdesc %src[0, 2, 4, 6, 8, 10, 12, 14] {chunk_size = 2} - : ui64 -> !xegpu.tensor_desc<8x4xf16, #xegpu.tdesc_attr> - return -} - -// ----- -func.func @test_prefetch_vc_1(%src: memref<24x32xf16>) { - %1 = xegpu.create_nd_tdesc %src[0, 0] : memref<24x32xf16> -> !xegpu.tensor_desc<24x32xf16> - // expected-error@+1 {{Expects a scattered TensorDesc}} - xegpu.prefetch %1 <{l1_hint = #xegpu.cache_hint}>: !xegpu.tensor_desc<24x32xf16> - return -} - -// ----- -func.func @test_prefetch_vc_2(%src: ui64) { - %1 = xegpu.create_tdesc %src[0, 8, 16, 24] {chunk_size = 2} : ui64 -> !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - // expected-error@+1 {{invlid l1_hint: #xegpu.cache_hint}} - xegpu.prefetch %1 <{l1_hint = #xegpu.cache_hint}>: !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - return -} - -// ----- -func.func @test_load_gather_vc_1(%src: memref<24x32xf16>) { - %0 = arith.constant dense<1>: vector<4xi1> - %1 = xegpu.create_nd_tdesc %src[0, 0] : memref<24x32xf16> -> !xegpu.tensor_desc<4x2xf16> - // expected-error@+1 {{Expects a scattered TensorDesc}} - %2 = xegpu.load %1, %0 <{l1_hint = #xegpu.cache_hint}> - : !xegpu.tensor_desc<4x2xf16>, vector<4xi1> -> vector<4x2xf16> - return -} - -// ----- -func.func @test_load_gather_vc_2(%src: ui64) { - %0 = arith.constant dense<1>: vector<4xi1> - %1 = xegpu.create_tdesc %src[0, 8, 16, 24] {chunk_size = 2} : ui64 - -> !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - // expected-error@+1 {{invlid l1_hint: #xegpu.cache_hint}} - %2 = xegpu.load %1, %0 <{l1_hint = #xegpu.cache_hint}> - : !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr>, vector<4xi1> - -> vector<4x2xf32> - return -} - -// ----- -func.func @test_store_scatter_vc_1(%src: memref<24x32xf32>) { - %0 = arith.constant dense<1>: vector<4xi1> - %1 = arith.constant dense<2.9>: vector<4x2xf32> - %2 = xegpu.create_nd_tdesc %src[0, 0] : memref<24x32xf32> -> !xegpu.tensor_desc<4x2xf32> - // expected-error@+1 {{Expects a scattered TensorDesc}} - xegpu.store %1, %2, %0 <{l1_hint = #xegpu.cache_hint}> - : vector<4x2xf32>, !xegpu.tensor_desc<4x2xf32>, vector<4xi1> - return -} - -// ----- -func.func @test_store_scatter_vc_2(%src: ui64) { - %0 = arith.constant dense<1>: vector<4xi1> - %1 = arith.constant dense<2.9>: vector<4x2xf32> - %2 = xegpu.create_tdesc %src[0, 8, 16, 24] {chunk_size = 2} - : ui64 -> !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr> - // expected-error@+1 {{invlid l1_hint: #xegpu.cache_hint}} - xegpu.store %1, %2, %0 <{l1_hint = #xegpu.cache_hint}> : vector<4x2xf32>, - !xegpu.tensor_desc<4x2xf32, #xegpu.tdesc_attr>, vector<4xi1> - return -} - -// ----- -func.func @test_dpas_vc_1(%a : vector<8x4x2xf16>, %b: vector<8x16x2xf16>) { - // expected-error@+1 {{K-dimension or vnni-factor mismatch}} - %1 = xegpu.dpas %a, %b : vector<8x4x2xf16>, vector<8x16x2xf16> -> vector<8x16xf32> - return -} - -// ----- -func.func @test_dpas_vc_2(%a : vector<8x16xf16>, %b: vector<8x16x2xf16>) { - // expected-error@+1 {{lhs and rhs rank does not match for dpas op, or their rank is not 3}} - %1 = xegpu.dpas %a, %b : vector<8x16xf16>, vector<8x16x2xf16> -> vector<8x16xf32> - return -} - -// ----- -func.func @test_dpas_vc_3(%a : vector<8x16xf16>, %b: vector<16x16xf16>) { - // expected-error@+1 {{lhs and rhs rank does not match for dpas op, or their rank is not 3}} - %1 = xegpu.dpas %a, %b : vector<8x16xf16>, vector<16x16xf16> -> vector<8x16xf32> - return -} - -// ----- -func.func @test_dpas_vc_4(%a : vector<8x8x2xf16>, %b: vector<8x16x2xf16>, %c : vector<8x16xf16>) { - // expected-error@+1 {{Accumulator and Result for dpas op should have the same type}} - %1 = xegpu.dpas %a, %b, %c : vector<8x8x2xf16>, vector<8x16x2xf16>, vector<8x16xf16> -> vector<8x16xf32> - return -} \ No newline at end of file diff --git a/mlir/test/Dialect/XeGPU/xegpu-fold-alias-ops.mlir b/mlir/test/Dialect/XeGPU/xegpu-fold-alias-ops.mlir deleted file mode 100644 index d32954127fce..000000000000 --- a/mlir/test/Dialect/XeGPU/xegpu-fold-alias-ops.mlir +++ /dev/null @@ -1,20 +0,0 @@ -// RUN: mlir-opt -xegpu-fold-alias-ops -split-input-file %s | FileCheck %s - -func.func @fold_subview_with_xegpu_create_nd_tdesc(%arg0 : memref<256x256xf32>, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index) ->(!xegpu.tensor_desc<8x16xf32>) { - %subview = memref.subview %arg0[%arg1, %arg2] [32, 32] [1, 1] : - memref<256x256xf32> to memref<32x32xf32, strided<[256, 1], offset: ?>> - %0 = xegpu.create_nd_tdesc %subview[%arg3, %arg4] : - memref<32x32xf32, strided<[256, 1], offset: ?>> -> !xegpu.tensor_desc<8x16xf32> - return %0 : !xegpu.tensor_desc<8x16xf32> -} - -// CHECK-DAG: #[[MAP:.+]] = affine_map<()[s0, s1] -> (s0 + s1)> -// CHECK: func @fold_subview_with_xegpu_create_nd_tdesc -// CHECK-SAME: %[[ARG0:[a-zA-Z0-9]+]]: memref<256x256xf32> -// CHECK-SAME: %[[ARG1:[a-zA-Z0-9]+]]: index -// CHECK-SAME: %[[ARG2:[a-zA-Z0-9]+]]: index -// CHECK-SAME: %[[ARG3:[a-zA-Z0-9]+]]: index -// CHECK-SAME: %[[ARG4:[a-zA-Z0-9]+]]: index -// CHECK-DAG: %[[IDX0:.+]] = affine.apply #[[MAP]]()[%[[ARG1]], %[[ARG3]]] -// CHECK-DAG: %[[IDX1:.+]] = affine.apply #[[MAP]]()[%[[ARG2]], %[[ARG4]]] -// CHECK: xegpu.create_nd_tdesc %[[ARG0]][%[[IDX0]], %[[IDX1]]] : memref<256x256xf32> -> !xegpu.tensor_desc<8x16xf32> diff --git a/mlir/test/IR/invalid-func-op.mlir b/mlir/test/IR/invalid-func-op.mlir index 8fd7af22e959..d995689ebb8d 100644 --- a/mlir/test/IR/invalid-func-op.mlir +++ b/mlir/test/IR/invalid-func-op.mlir @@ -31,7 +31,7 @@ func.func @func_op() { // ----- func.func @func_op() { - // expected-error@+1 {{op symbol's parent must have the SymbolTable trait}} + // expected-error@+1 {{entry block must have 1 arguments to match function signature}} func.func @mixed_named_arguments(f32) { ^entry: return @@ -42,7 +42,7 @@ func.func @func_op() { // ----- func.func @func_op() { - // expected-error@+1 {{op symbol's parent must have the SymbolTable trait}} + // expected-error@+1 {{type of entry block argument #0('i32') must match the type of the corresponding argument in function signature('f32')}} func.func @mixed_named_arguments(f32) { ^entry(%arg : i32): return diff --git a/mlir/test/IR/invalid.mlir b/mlir/test/IR/invalid.mlir index 861f4ef6c020..cd79dac6115d 100644 --- a/mlir/test/IR/invalid.mlir +++ b/mlir/test/IR/invalid.mlir @@ -675,3 +675,19 @@ func.func @error_at_end_of_line() { // ----- @foo // expected-error {{expected operation name in quotes}} + +// ----- + +func.func @foo() { + cf.br ^bb2 + + ^bb1: + // expected-error@+1 {{forward reference of value '%1' requires explicit type specification}} + test.format_operand_optional_type_op %0, %1 + return + + ^bb2: + %0 = arith.constant 0 : i64 + %1 = memref.alloc() : memref<1xf64> + cf.br ^bb1 +} diff --git a/mlir/test/IR/parser.mlir b/mlir/test/IR/parser.mlir index cace1fefa43d..dd3922081ecc 100644 --- a/mlir/test/IR/parser.mlir +++ b/mlir/test/IR/parser.mlir @@ -1464,3 +1464,13 @@ test.dialect_custom_format_fallback custom_format_fallback // Check that an op with an optional result parses f80 as type. // CHECK: test.format_optional_result_d_op : f80 test.format_optional_result_d_op : f80 + +// Can skip type definition for operands, if they are already defined in the same block +// CHECK-LABEL: func @optional_operand_types +func.func @optional_operand_types(%arg0: i64, %arg1: memref<1xf64>) { + // CHECK: test.format_operand_optional_type_op %arg0, %arg1 + test.format_operand_optional_type_op %arg0, %arg1 + // CHECK: test.format_operand_optional_type_op %arg0, %arg1 + test.format_operand_optional_type_op %arg0, %arg1 : memref<1xf64> + return +} diff --git a/mlir/test/IR/region.mlir b/mlir/test/IR/region.mlir index 0b959915d6bb..bf4b1bb4e5ab 100644 --- a/mlir/test/IR/region.mlir +++ b/mlir/test/IR/region.mlir @@ -87,17 +87,18 @@ func.func @named_region_has_wrong_number_of_blocks() { // CHECK: test.single_no_terminator_op "test.single_no_terminator_op"() ( { - %foo = arith.constant 1 : i32 + func.func @foo1() { return } + func.func @foo2() { return } } ) : () -> () // CHECK: test.variadic_no_terminator_op "test.variadic_no_terminator_op"() ( { - %foo = arith.constant 1 : i32 + func.func @foo1() { return } }, { - %bar = arith.constant 1 : i32 + func.func @foo2() { return } } ) : () -> () diff --git a/mlir/test/IR/test-symbol-rauw.mlir b/mlir/test/IR/test-symbol-rauw.mlir index ba17cf9d1042..1acd834fcde8 100644 --- a/mlir/test/IR/test-symbol-rauw.mlir +++ b/mlir/test/IR/test-symbol-rauw.mlir @@ -51,11 +51,12 @@ module { } } - // CHECK: func @symbol_bar + // FIXME:#73140 + // DISABLED-CHECK: func @symbol_bar func.func @symbol_bar() { - // CHECK: foo.op - // CHECK-SAME: use_1 = @module_a::@replaced_foo - // CHECK-SAME: use_2 = @replaced_module_b::@replaced_module_c::@replaced_foo + // DISABLED-CHECK: foo.op + // DISABLED-CHECK-SAME: use_1 = @module_a::@replaced_foo + // DISABLED-CHECK-SAME: use_2 = @replaced_module_b::@replaced_module_c::@replaced_foo "foo.op"() { use_1 = @module_a::@foo, use_2 = @module_b::@module_c::@foo @@ -97,15 +98,16 @@ module { // ----- +// FIXME:#73140 module { - // CHECK: module @replaced_foo + // DISABLED-CHECK: module @replaced_foo module @foo attributes {sym.new_name = "replaced_foo" } { - // CHECK: func.func private @foo + // DISABLED-CHECK: func.func private @foo func.func private @foo() } - // CHECK: foo.op - // CHECK-SAME: use = @replaced_foo::@foo + // DISABLED-CHECK: foo.op + // DISABLED-CHECK-SAME: use = @replaced_foo::@foo "foo.op"() { use = @foo::@foo } : () -> () diff --git a/mlir/test/IR/traits.mlir b/mlir/test/IR/traits.mlir index 1e046706379c..0402ebe75875 100644 --- a/mlir/test/IR/traits.mlir +++ b/mlir/test/IR/traits.mlir @@ -572,13 +572,15 @@ func.func @failedHasDominanceScopeOutsideDominanceFreeScope() -> () { // Ensure that SSACFG regions of operations in GRAPH regions are // checked for dominance -func.func @illegalInsideDominanceFreeScope(%cond: i1) -> () { +func.func @illegalInsideDominanceFreeScope() -> () { test.graph_region { - scf.if %cond { + func.func @test() -> i1 { + ^bb1: // expected-error @+1 {{operand #0 does not dominate this use}} %2:3 = "bar"(%1) : (i64) -> (i1,i1,i1) // expected-note @+1 {{operand defined here}} - %1 = "baz"(%2#0) : (i1) -> (i64) + %1 = "baz"(%2#0) : (i1) -> (i64) + return %2#1 : i1 } "terminator"() : () -> () } @@ -589,21 +591,20 @@ func.func @illegalInsideDominanceFreeScope(%cond: i1) -> () { // Ensure that SSACFG regions of operations in GRAPH regions are // checked for dominance -func.func @illegalCFGInsideDominanceFreeScope(%cond: i1) -> () { +func.func @illegalCDFGInsideDominanceFreeScope() -> () { test.graph_region { - scf.if %cond { - "test.ssacfg_region"() ({ - ^bb1: - // expected-error @+1 {{operand #0 does not dominate this use}} - %2:3 = "bar"(%1) : (i64) -> (i1,i1,i1) - cf.br ^bb4 - ^bb2: - cf.br ^bb2 - ^bb4: - %1 = "foo"() : ()->i64 // expected-note {{operand defined here}} - }) : () -> () + func.func @test() -> i1 { + ^bb1: + // expected-error @+1 {{operand #0 does not dominate this use}} + %2:3 = "bar"(%1) : (i64) -> (i1,i1,i1) + cf.br ^bb4 + ^bb2: + cf.br ^bb2 + ^bb4: + %1 = "foo"() : ()->i64 // expected-note {{operand defined here}} + return %2#1 : i1 } - "terminator"() : () -> () + "terminator"() : () -> () } return } diff --git a/mlir/test/Transforms/canonicalize-dce.mlir b/mlir/test/Transforms/canonicalize-dce.mlir index 84631947970d..e8608a3aa3e6 100644 --- a/mlir/test/Transforms/canonicalize-dce.mlir +++ b/mlir/test/Transforms/canonicalize-dce.mlir @@ -77,15 +77,15 @@ func.func @f(%arg0: f32, %pred: i1) { // Test case: Recursively DCE into enclosed regions. -// CHECK: func.func @f(%arg0: f32) -// CHECK-NOT: arith.addf +// CHECK: func @f(%arg0: f32) +// CHECK-NEXT: func @g(%arg1: f32) +// CHECK-NEXT: return func.func @f(%arg0: f32) { - "test.region"() ( - { - %0 = "arith.addf"(%arg0, %arg0) : (f32, f32) -> f32 - } - ) : () -> () + func.func @g(%arg1: f32) { + %0 = "arith.addf"(%arg1, %arg1) : (f32, f32) -> f32 + return + } return } diff --git a/mlir/test/Transforms/canonicalize.mlir b/mlir/test/Transforms/canonicalize.mlir index 9b74362b6ee7..316ee0dfe593 100644 --- a/mlir/test/Transforms/canonicalize.mlir +++ b/mlir/test/Transforms/canonicalize.mlir @@ -429,15 +429,16 @@ func.func @write_only_alloca_fold(%v: f32) { // CHECK-LABEL: func @dead_block_elim func.func @dead_block_elim() { // CHECK-NOT: ^bb - builtin.module { - func.func @nested() { - return + func.func @nested() { + return - ^bb1: - return - } + ^bb1: + return } return + +^bb1: + return } // CHECK-LABEL: func @dyn_shape_fold(%arg0: index, %arg1: index) diff --git a/mlir/test/Transforms/constant-fold.mlir b/mlir/test/Transforms/constant-fold.mlir index 981757aed9b1..a7cdd04daae2 100644 --- a/mlir/test/Transforms/constant-fold.mlir +++ b/mlir/test/Transforms/constant-fold.mlir @@ -794,15 +794,12 @@ func.func @cmpf_inf() -> (i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1 // CHECK-LABEL: func @nested_isolated_region func.func @nested_isolated_region() { - // CHECK-NEXT: builtin.module { // CHECK-NEXT: func @isolated_op // CHECK-NEXT: arith.constant 2 - builtin.module { - func.func @isolated_op() { - %0 = arith.constant 1 : i32 - %2 = arith.addi %0, %0 : i32 - "foo.yield"(%2) : (i32) -> () - } + func.func @isolated_op() { + %0 = arith.constant 1 : i32 + %2 = arith.addi %0, %0 : i32 + "foo.yield"(%2) : (i32) -> () } // CHECK: "foo.unknown_region" diff --git a/mlir/test/Transforms/cse.mlir b/mlir/test/Transforms/cse.mlir index 11a331026847..c764d2b9bd57 100644 --- a/mlir/test/Transforms/cse.mlir +++ b/mlir/test/Transforms/cse.mlir @@ -228,14 +228,11 @@ func.func @nested_isolated() -> i32 { // CHECK-NEXT: arith.constant 1 %0 = arith.constant 1 : i32 - // CHECK-NEXT: builtin.module // CHECK-NEXT: @nested_func - builtin.module { - func.func @nested_func() { - // CHECK-NEXT: arith.constant 1 - %foo = arith.constant 1 : i32 - "foo.yield"(%foo) : (i32) -> () - } + func.func @nested_func() { + // CHECK-NEXT: arith.constant 1 + %foo = arith.constant 1 : i32 + "foo.yield"(%foo) : (i32) -> () } // CHECK: "foo.region" diff --git a/mlir/test/Transforms/test-legalizer-full.mlir b/mlir/test/Transforms/test-legalizer-full.mlir index 5f1148cac650..74f312e8144a 100644 --- a/mlir/test/Transforms/test-legalizer-full.mlir +++ b/mlir/test/Transforms/test-legalizer-full.mlir @@ -37,11 +37,9 @@ func.func @recursively_legal_invalid_op() { } /// Operation that is dynamically legal, i.e. the function has a pattern /// applied to legalize the argument type before it becomes recursively legal. - builtin.module { - func.func @dynamic_func(%arg: i64) attributes {test.recursively_legal} { - %ignored = "test.illegal_op_f"() : () -> (i32) - "test.return"() : () -> () - } + func.func @dynamic_func(%arg: i64) attributes {test.recursively_legal} { + %ignored = "test.illegal_op_f"() : () -> (i32) + "test.return"() : () -> () } "test.return"() : () -> () diff --git a/mlir/test/lib/Dialect/Test/CMakeLists.txt b/mlir/test/lib/Dialect/Test/CMakeLists.txt index 967101242e26..024c3ac44fe2 100644 --- a/mlir/test/lib/Dialect/Test/CMakeLists.txt +++ b/mlir/test/lib/Dialect/Test/CMakeLists.txt @@ -43,6 +43,10 @@ add_public_tablegen_target(MLIRTestOpsSyntaxIncGen) add_sharded_ops(TestOps 20) +set(LLVM_TARGET_DEFINITIONS Passes.td) +mlir_tablegen(Passes.h.inc -gen-pass-decls -name Test) +add_public_tablegen_target(MLIRTestPassIncGen) + # Exclude tests from libMLIR.so add_mlir_library(MLIRTestDialect TestAttributes.cpp @@ -57,6 +61,7 @@ add_mlir_library(MLIRTestDialect TestOpsSyntax.cpp TestDialectInterfaces.cpp ${SHARDED_SRCS} + Passes.cpp EXCLUDE_FROM_LIBMLIR @@ -68,6 +73,7 @@ add_mlir_library(MLIRTestDialect MLIRTestOpsIncGen MLIRTestOpsSyntaxIncGen MLIRTestOpsShardGen + MLIRTestPassIncGen LINK_LIBS PUBLIC MLIRControlFlowInterfaces diff --git a/mlir/test/lib/Dialect/Test/Passes.cpp b/mlir/test/lib/Dialect/Test/Passes.cpp new file mode 100644 index 000000000000..8f1dcc52aeba --- /dev/null +++ b/mlir/test/lib/Dialect/Test/Passes.cpp @@ -0,0 +1,55 @@ +//===-- Passes.cpp - MLIR Test Dialect pass definitions ---------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "Passes.h" +#include "TestDialect.h" +#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h" +#include "mlir/IR/BuiltinOps.h" +#include "mlir/Pass/Pass.h" +#include "mlir/Transforms/BufferizationUtils.h" + +namespace test { +#define GEN_PASS_DEF_TESTBUFFERIZE +#include "Passes.h.inc" +} // namespace test + +using namespace mlir; +using namespace test; + +namespace { +// Use this pass to test that one-shot bufferization works in general for custom +// ops and types +// +// TODO: a special pass is used *instead* of -one-shot-bufferize because: +// * one-shot-bufferize does not support function boundary bufferization with +// custom tensors / memrefs +// * one-shot-bufferize would (practically) unconditionally insert tensor +// copies (with / without analysis) and this insertion procedure does not +// support custom tensors / memrefs +struct TestBufferizerPass : test::impl::TestBufferizeBase { + using Base::Base; + + void runOnOperation() final { + bufferization::BufferizationOptions options = + bufferization::getPartialBufferizationOptions(); + options.opFilter.allowDialect(); + + // FIXME: disable tensor copy insertions + options.copyBeforeWrite = false; + if (failed(bufferization::bufferizeOp(getOperation(), options))) { + signalPassFailure(); + } + } +}; +} // namespace + +void test::registerAllTestDialectPasses() { test::registerTestPasses(); } + +std::unique_ptr test::createTestBufferizePass() { + return std::make_unique(); +} diff --git a/mlir/test/lib/Dialect/Test/Passes.h b/mlir/test/lib/Dialect/Test/Passes.h new file mode 100644 index 000000000000..cdc99e9ca26c --- /dev/null +++ b/mlir/test/lib/Dialect/Test/Passes.h @@ -0,0 +1,41 @@ +//===- Passes.h - MLIR Test Dialect pass entrypoints ------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines prototypes that expose pass constructors. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_TEST_PASSES_H +#define MLIR_DIALECT_TEST_PASSES_H + +#include "mlir/Dialect/Bufferization/IR/Bufferization.h" +#include "mlir/Pass/Pass.h" + +#include + +namespace test { + +#define GEN_PASS_DECL +#include "Passes.h.inc" + +std::unique_ptr createTestBufferizePass(); + +//===----------------------------------------------------------------------===// +// Registration +//===----------------------------------------------------------------------===// + +// special registration API for mlir-opt (that implicitly calls this function) +void registerAllTestDialectPasses(); + +/// Generate the code for registering passes. +#define GEN_PASS_REGISTRATION +#include "Passes.h.inc" + +} // namespace test + +#endif // MLIR_DIALECT_TEST_PASSES_H diff --git a/mlir/test/lib/Dialect/Test/Passes.td b/mlir/test/lib/Dialect/Test/Passes.td new file mode 100644 index 000000000000..1e5b5f1197bc --- /dev/null +++ b/mlir/test/lib/Dialect/Test/Passes.td @@ -0,0 +1,25 @@ +//===-- Passes.td - Test pass definition file --------------*- tablegen -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LINALG_PASSES +#define MLIR_DIALECT_LINALG_PASSES + +include "mlir/Pass/PassBase.td" + +def TestBufferize : Pass<"test-bufferize"> { + let summary = "Bufferize the Test dialect"; + let description = [{ + Run one-shot bufferization for test dialect ops. + }]; + let constructor = "test::createTestBufferizePass()"; + let dependentDialects = [ + "mlir::bufferization::BufferizationDialect" + ]; +} + +#endif // MLIR_DIALECT_LINALG_PASSES diff --git a/mlir/test/lib/Dialect/Test/TestAttrDefs.td b/mlir/test/lib/Dialect/Test/TestAttrDefs.td index a0a1cd30ed8a..2c5acb1b99a4 100644 --- a/mlir/test/lib/Dialect/Test/TestAttrDefs.td +++ b/mlir/test/lib/Dialect/Test/TestAttrDefs.td @@ -368,5 +368,11 @@ def NestedPolynomialAttr2 : Test_Attr<"NestedPolynomialAttr2"> { }]; } +def TestAttrNewlineAndIndent : Test_Attr<"TestAttrNewlineAndIndent"> { + let mnemonic = "newline_and_indent"; + let parameters = (ins "::mlir::Type":$indentType); + let hasCustomAssemblyFormat = 1; +} + #endif // TEST_ATTRDEFS diff --git a/mlir/test/lib/Dialect/Test/TestAttributes.cpp b/mlir/test/lib/Dialect/Test/TestAttributes.cpp index b66dfbfcf089..32fef18261ce 100644 --- a/mlir/test/lib/Dialect/Test/TestAttributes.cpp +++ b/mlir/test/lib/Dialect/Test/TestAttributes.cpp @@ -280,6 +280,34 @@ static ParseResult parseCustomFloatAttr(AsmParser &p, StringAttr &typeStrAttr, return success(); } +// TestAttrNewlineAndIndent +//===----------------------------------------------------------------------===// + +Attribute TestAttrNewlineAndIndentAttr::parse(::mlir::AsmParser &parser, + ::mlir::Type type) { + Type indentType; + if (parser.parseLess()) { + return {}; + } + if (parser.parseType(indentType)) { + return {}; + } + if (parser.parseGreater()) { + return {}; + } + return get(parser.getContext(), indentType); +} + +void TestAttrNewlineAndIndentAttr::print(::mlir::AsmPrinter &printer) const { + printer << "<"; + printer.increaseIndent(); + printer.printNewline(); + printer << getIndentType(); + printer.decreaseIndent(); + printer.printNewline(); + printer << ">"; +} + //===----------------------------------------------------------------------===// // Tablegen Generated Definitions //===----------------------------------------------------------------------===// diff --git a/mlir/test/lib/Dialect/Test/TestDialect.cpp b/mlir/test/lib/Dialect/Test/TestDialect.cpp index 1bbf2cc7481d..945c32e7b023 100644 --- a/mlir/test/lib/Dialect/Test/TestDialect.cpp +++ b/mlir/test/lib/Dialect/Test/TestDialect.cpp @@ -8,6 +8,7 @@ #include "TestDialect.h" #include "TestOps.h" +#include "Passes.h" #include "TestTypes.h" #include "mlir/Bytecode/BytecodeImplementation.h" #include "mlir/Dialect/Arith/IR/Arith.h" @@ -20,6 +21,7 @@ #include "mlir/IR/ExtensibleDialect.h" #include "mlir/IR/MLIRContext.h" #include "mlir/IR/ODSSupport.h" +#include "mlir/IR/OpImplementation.h" #include "mlir/IR/OperationSupport.h" #include "mlir/IR/PatternMatch.h" #include "mlir/IR/TypeUtilities.h" @@ -28,6 +30,9 @@ #include "mlir/Interfaces/FunctionImplementation.h" #include "mlir/Interfaces/InferIntRangeInterface.h" #include "mlir/Support/LLVM.h" +#include "mlir/Pass/PassRegistry.h" +#include "mlir/Reducer/ReductionPatternInterface.h" +#include "mlir/Transforms/BufferizationUtils.h" #include "mlir/Transforms/FoldUtils.h" #include "mlir/Transforms/InliningUtils.h" #include "llvm/ADT/STLFunctionalExtras.h" @@ -232,6 +237,23 @@ void test::writeToMlirBytecode(DialectBytecodeWriter &writer, writer.writeVarInt(elt); } +namespace { + +struct TestDialectBufferizer : DialectBufferizerInterface { + using DialectBufferizerInterface::DialectBufferizerInterface; + + Type getTensorTypeFromMemRefType(Type type) const final { + if (auto testMemrefType = mlir::dyn_cast(type)) { + return test::TestTensorType::get(testMemrefType.getContext(), + testMemrefType.getShape(), + testMemrefType.getElementType()); + } + return NoneType::get(type.getContext()); + } +}; + +} // namespace + //===----------------------------------------------------------------------===// // Dynamic operations //===----------------------------------------------------------------------===// @@ -332,6 +354,10 @@ void TestDialect::initialize() { registerDynamicOp(getDynamicOneOperandTwoResultsOp(this)); registerDynamicOp(getDynamicCustomParserPrinterOp(this)); registerInterfaces(); + + // add bufferizer interface + addInterface(); + allowUnknownOperations(); // Instantiate our fallback op interface that we'll use on specific @@ -430,3 +456,47 @@ void TestDialect::getCanonicalizationPatterns( RewritePatternSet &results) const { results.add(&dialectCanonicalizationPattern); } + +//===----------------------------------------------------------------------===// +// Test DummyTensorOp - one-shot bufferization interface +//===----------------------------------------------------------------------===// + +bool test::TestDummyTensorOp::bufferizesToMemoryRead( + mlir::OpOperand &, const mlir::bufferization::AnalysisState &) { + return true; +} + +bool test::TestDummyTensorOp::bufferizesToMemoryWrite( + mlir::OpOperand &, const mlir::bufferization::AnalysisState &) { + return true; +} + +mlir::bufferization::AliasingValueList +test::TestDummyTensorOp::getAliasingOpResults( + mlir::OpOperand &, const mlir::bufferization::AnalysisState &) { + return {}; +} + +mlir::LogicalResult test::TestDummyTensorOp::bufferize( + mlir::RewriterBase &rewriter, + const mlir::bufferization::BufferizationOptions &options) { + const auto inputType = getInput().getType(); + const auto bufferizedInputType = test::TestMemrefType::get( + getContext(), inputType.getShape(), inputType.getElementType(), nullptr, 0); + const auto outputType = getOutput().getType(); + const auto bufferizedOutputType = + test::TestMemrefType::get(getContext(), outputType.getShape(), + outputType.getElementType(), nullptr, 0); + + // replace op with memref analogy, preserve correct types at the boundaries + auto toMemref = rewriter.create( + getLoc(), bufferizedInputType, getInput()); + auto dummyMemrefOp = rewriter.create( + getLoc(), bufferizedOutputType, toMemref.getResult()); + auto toTensor = rewriter.create( + getLoc(), dummyMemrefOp.getOutput()); + + rewriter.replaceOp(*this, toTensor); + + return mlir::success(); +} \ No newline at end of file diff --git a/mlir/test/lib/Dialect/Test/TestDialect.h b/mlir/test/lib/Dialect/Test/TestDialect.h index c05e15fc642a..44b62792e950 100644 --- a/mlir/test/lib/Dialect/Test/TestDialect.h +++ b/mlir/test/lib/Dialect/Test/TestDialect.h @@ -18,6 +18,8 @@ #include "TestInterfaces.h" #include "TestTypes.h" #include "mlir/Bytecode/BytecodeImplementation.h" +#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h" +#include "mlir/Dialect/Bufferization/IR/Bufferization.h" #include "mlir/Dialect/DLTI/DLTI.h" #include "mlir/Dialect/DLTI/Traits.h" #include "mlir/Dialect/Func/IR/FuncOps.h" diff --git a/mlir/test/lib/Dialect/Test/TestOps.cpp b/mlir/test/lib/Dialect/Test/TestOps.cpp index 47d5b1b19121..ad6c79baafef 100644 --- a/mlir/test/lib/Dialect/Test/TestOps.cpp +++ b/mlir/test/lib/Dialect/Test/TestOps.cpp @@ -10,6 +10,7 @@ #include "TestDialect.h" #include "TestFormatUtils.h" #include "mlir/Dialect/Arith/IR/Arith.h" +#include "mlir/Dialect/Bufferization/IR/Bufferization.h" using namespace mlir; using namespace test; diff --git a/mlir/test/lib/Dialect/Test/TestOps.h b/mlir/test/lib/Dialect/Test/TestOps.h index f070c3bedd92..b5eabc0c1fce 100644 --- a/mlir/test/lib/Dialect/Test/TestOps.h +++ b/mlir/test/lib/Dialect/Test/TestOps.h @@ -19,6 +19,7 @@ #include "mlir/Dialect/Linalg/IR/Linalg.h" #include "mlir/Dialect/Linalg/IR/LinalgInterfaces.h" #include "mlir/Dialect/Traits.h" +#include "mlir/Dialect/Bufferization/IR/Bufferization.h" #include "mlir/IR/AsmState.h" #include "mlir/IR/BuiltinOps.h" #include "mlir/IR/BuiltinTypes.h" diff --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td index 9450764fcb1d..8c63396f4c6a 100644 --- a/mlir/test/lib/Dialect/Test/TestOps.td +++ b/mlir/test/lib/Dialect/Test/TestOps.td @@ -30,6 +30,7 @@ include "mlir/Interfaces/InferTypeOpInterface.td" include "mlir/Interfaces/LoopLikeInterface.td" include "mlir/Interfaces/MemorySlotInterfaces.td" include "mlir/Interfaces/SideEffectInterfaces.td" +include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td" // Include the attribute definitions. @@ -3221,4 +3222,33 @@ def TestMultiSlotAlloca : TEST_Op<"multi_slot_alloca", let assemblyFormat = "attr-dict `:` functional-type(operands, results)"; } +def TestDummyTensorOp : TEST_Op<"dummy_tensor_op", [BufferizableOpInterface]> { + let arguments = (ins + Arg:$input + ); + let results = (outs + Arg:$output + ); + let extraClassDeclaration = [{ + // BufferizableOpInterface + bool bufferizesToMemoryRead(mlir::OpOperand&, const mlir::bufferization::AnalysisState&); + bool bufferizesToMemoryWrite(mlir::OpOperand&, const mlir::bufferization::AnalysisState&); + // TODO: Rename getAliasingOpResults to something in the style of bufferization? + mlir::bufferization::AliasingValueList getAliasingOpResults( + mlir::OpOperand&, + const mlir::bufferization::AnalysisState&); + mlir::LogicalResult bufferize(mlir::RewriterBase& rewriter, + const mlir::bufferization::BufferizationOptions& options); + }]; +} + +def TestDummyMemrefOp : TEST_Op<"dummy_memref_op", []> { + let arguments = (ins + Arg:$input + ); + let results = (outs + Arg:$output + ); +} + #endif // TEST_OPS diff --git a/mlir/test/lib/Dialect/Test/TestOpsSyntax.cpp b/mlir/test/lib/Dialect/Test/TestOpsSyntax.cpp index 664951f2a11b..917bc0fde0c8 100644 --- a/mlir/test/lib/Dialect/Test/TestOpsSyntax.cpp +++ b/mlir/test/lib/Dialect/Test/TestOpsSyntax.cpp @@ -152,6 +152,12 @@ static ParseResult parseCustomDirectiveOptionalOperandRef( bool expectedOptionalOperand = operandCount == 0; return success(expectedOptionalOperand != optOperand.has_value()); } +static ParseResult parseOptionalType(OpAsmParser &parser, Type &type) { + if (parser.parseOptionalColon()) + return success(); + + return parser.parseType(type); +} //===----------------------------------------------------------------------===// // Printing @@ -232,6 +238,21 @@ static void printCustomDirectiveOptionalOperandRef(OpAsmPrinter &printer, Value optOperand) { printer << (optOperand ? "1" : "0"); } +static bool isDefinedAbove(Value val, Operation *op) { + if (val.isa()) + return true; + + return val.getDefiningOp()->getBlock() == op->getBlock() && + val.getDefiningOp()->isBeforeInBlock(op); +} +static void printOptionalType(OpAsmPrinter &printer, + FormatOperandOptionalTypeOp op, Type type) { + if (isDefinedAbove(op.getOperand(), op)) + return; + + printer << ":"; + printer.printType(type); +} //===----------------------------------------------------------------------===// // Test parser. //===----------------------------------------------------------------------===// diff --git a/mlir/test/lib/Dialect/Test/TestOpsSyntax.td b/mlir/test/lib/Dialect/Test/TestOpsSyntax.td index 3129085058fd..2a8645806c76 100644 --- a/mlir/test/lib/Dialect/Test/TestOpsSyntax.td +++ b/mlir/test/lib/Dialect/Test/TestOpsSyntax.td @@ -292,6 +292,9 @@ def FormatOperandDOp : FormatOperandBase<"d", [{ def FormatOperandEOp : FormatOperandBase<"e", [{ $buildable `,` $operand `:` type($buildable) `,` type($operand) attr-dict }]>; +def FormatOperandOptionalTypeOp : FormatOperandBase<"optional_type", [{ + $buildable `,` $operand custom(type($operand)) attr-dict +}]>; def FormatSuccessorAOp : TEST_Op<"format_successor_a_op", [Terminator]> { let successors = (successor VariadicSuccessor:$targets); diff --git a/mlir/test/lib/Dialect/Test/TestTypeDefs.td b/mlir/test/lib/Dialect/Test/TestTypeDefs.td index d96152a0826f..5e1e87994cc8 100644 --- a/mlir/test/lib/Dialect/Test/TestTypeDefs.td +++ b/mlir/test/lib/Dialect/Test/TestTypeDefs.td @@ -392,4 +392,57 @@ def TestRecursiveAlias }]; } +def TestTypeNewlineAndIndent : Test_Type<"TestTypeNewlineAndIndent"> { + let mnemonic = "newline_and_indent"; + let hasCustomAssemblyFormat = 1; +} + +def TestTensorType : Test_Type<"TestTensor", [TensorTypeInterface]> { + let mnemonic = "test_tensor"; + let parameters = (ins + ArrayRefParameter<"int64_t">:$shape, + "mlir::Type":$elementType + ); + let assemblyFormat = "`<` `[` $shape `]` `,` $elementType `>`"; + + let extraClassDeclaration = [{ + // ShapedTypeInterface: + bool hasRank() const { + return true; + } + mlir::ShapedType cloneWith(std::optional> shape, mlir::Type elementType) const { + return test::TestTensorType::get(getContext(), shape.value_or(getShape()), elementType); + } + }]; +} + +def TestMemrefType : Test_Type<"TestMemref", [BaseMemRefTypeInterface]> { + let mnemonic = "test_memref"; + let parameters = (ins + ArrayRefParameter<"int64_t">:$shape, + "mlir::Type":$elementType, + DefaultValuedParameter<"mlir::Attribute", "nullptr">:$memSpace, + DefaultValuedParameter<"unsigned", "0">:$memSpaceAsInt + ); + let assemblyFormat = "`<` `[` $shape `]` `,` $elementType (`,` $memSpace^)? (`,` $memSpaceAsInt^)? `>`"; + + let extraClassDeclaration = [{ + // ShapedTypeInterface: + bool hasRank() const { + return true; + } + mlir::ShapedType cloneWith(std::optional> shape, mlir::Type elementType) const { + return test::TestMemrefType::get(getContext(), shape.value_or(getShape()), elementType, getMemSpace(), getMemSpaceAsInt()); + } + + // BaseMemRefTypeInterface: + mlir::Attribute getMemorySpace() const { + return getMemSpace(); + } + unsigned getMemorySpaceAsInt() const { + return getMemSpaceAsInt(); + } + }]; +} + #endif // TEST_TYPEDEFS diff --git a/mlir/test/lib/Dialect/Test/TestTypes.cpp b/mlir/test/lib/Dialect/Test/TestTypes.cpp index 1593b6d7d753..2ef2ad2820dd 100644 --- a/mlir/test/lib/Dialect/Test/TestTypes.cpp +++ b/mlir/test/lib/Dialect/Test/TestTypes.cpp @@ -531,3 +531,30 @@ void TestRecursiveAliasType::print(AsmPrinter &printer) const { } printer << ">"; } + +//===----------------------------------------------------------------------===// +// TestTypeNewlineAndIndent +//===----------------------------------------------------------------------===// + +Type TestTypeNewlineAndIndentType::parse(::mlir::AsmParser &parser) { + if (parser.parseLess()) { + return {}; + } + if (parser.parseKeyword("indented_content")) { + return {}; + } + if (parser.parseGreater()) { + return {}; + } + return get(parser.getContext()); +} + +void TestTypeNewlineAndIndentType::print(::mlir::AsmPrinter &printer) const { + printer << "<"; + printer.increaseIndent(); + printer.printNewline(); + printer << "indented_content"; + printer.decreaseIndent(); + printer.printNewline(); + printer << ">"; +} diff --git a/mlir/test/mlir-tblgen/testdialect-attrdefs.mlir b/mlir/test/mlir-tblgen/testdialect-attrdefs.mlir index ee92ea06a208..fa188df6e15a 100644 --- a/mlir/test/mlir-tblgen/testdialect-attrdefs.mlir +++ b/mlir/test/mlir-tblgen/testdialect-attrdefs.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s | mlir-opt -verify-diagnostics | FileCheck %s +// RUN: mlir-opt %s | mlir-opt -verify-diagnostics | FileCheck %s --strict-whitespace // CHECK-LABEL: func private @compoundA() // CHECK-SAME: #test.cmpnd_a<1, !test.smpla, [5, 6]> @@ -19,3 +19,17 @@ func.func private @qualifiedAttr() attributes {foo = #test.cmpnd_nested_outer_qu func.func private @overriddenAttr() attributes { foo = #test.override_builder<5> } + +// CHECK-LABEL: @newlineAndIndent +// CHECK-SAME: indent = #test.newline_and_indent< +// CHECK-NEXT: !test.newline_and_indent< +// CHECK-NEXT: indented_content +// CHECK-NEXT: > +// CHECK-NEXT: > +func.func private @newlineAndIndent() attributes { + indent = #test.newline_and_indent< + !test.newline_and_indent< + indented_content + > + > +} diff --git a/mlir/test/mlir-tblgen/testdialect-typedefs.mlir b/mlir/test/mlir-tblgen/testdialect-typedefs.mlir index 18175edc81cf..25bb0bb7ca07 100644 --- a/mlir/test/mlir-tblgen/testdialect-typedefs.mlir +++ b/mlir/test/mlir-tblgen/testdialect-typedefs.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s | mlir-opt -verify-diagnostics | FileCheck %s +// RUN: mlir-opt %s | mlir-opt -verify-diagnostics | FileCheck %s --strict-whitespace ////////////// // Tests the types in the 'Test' dialect, not the ones in 'typedefs.mlir' @@ -42,3 +42,12 @@ func.func @testInt(%A : !test.int, %B : !test.int, %C : !test func.func @structTest (%A : !test.struct< {field1, !test.smpla}, {field2, !test.int} > ) { return } + +// CHECK: @newlineAndIndent(%arg0: !test.newline_and_indent< +// CHECK-NEXT: indented_content +// CHECK-NEXT: >) +func.func @newlineAndIndent(%A : !test.newline_and_indent< + indented_content +>)-> () { + return +} diff --git a/mlir/test/python/ir/value.py b/mlir/test/python/ir/value.py index 50b0e8403a7f..ba4c2c7cdbae 100644 --- a/mlir/test/python/ir/value.py +++ b/mlir/test/python/ir/value.py @@ -166,15 +166,28 @@ def testValuePrintAsOperand(): print(value2) topFn = func.FuncOp("test", ([i32, i32], [])) - entry_block = Block.create_at_start(topFn.operation.regions[0], [i32, i32]) + entry_block1 = Block.create_at_start(topFn.operation.regions[0], [i32, i32]) - with InsertionPoint(entry_block): + with InsertionPoint(entry_block1): value3 = Operation.create("custom.op3", results=[i32]).results[0] # CHECK: Value(%[[VAL3:.*]] = "custom.op3"() : () -> i32) print(value3) value4 = Operation.create("custom.op4", results=[i32]).results[0] # CHECK: Value(%[[VAL4:.*]] = "custom.op4"() : () -> i32) print(value4) + + f = func.FuncOp("test", ([i32, i32], [])) + entry_block2 = Block.create_at_start(f.operation.regions[0], [i32, i32]) + with InsertionPoint(entry_block2): + value5 = Operation.create("custom.op5", results=[i32]).results[0] + # CHECK: Value(%[[VAL5:.*]] = "custom.op5"() : () -> i32) + print(value5) + value6 = Operation.create("custom.op6", results=[i32]).results[0] + # CHECK: Value(%[[VAL6:.*]] = "custom.op6"() : () -> i32) + print(value6) + + func.ReturnOp([]) + func.ReturnOp([]) # CHECK: %[[VAL1]] @@ -201,10 +214,20 @@ def testValuePrintAsOperand(): # CHECK: %1 print(value4.get_name(use_local_scope=True)) + # CHECK: %[[VAL5]] + print(value5.get_name()) + # CHECK: %[[VAL6]] + print(value6.get_name()) + # CHECK: %[[ARG0:.*]] - print(entry_block.arguments[0].get_name()) + print(entry_block1.arguments[0].get_name()) # CHECK: %[[ARG1:.*]] - print(entry_block.arguments[1].get_name()) + print(entry_block1.arguments[1].get_name()) + + # CHECK: %[[ARG2:.*]] + print(entry_block2.arguments[0].get_name()) + # CHECK: %[[ARG3:.*]] + print(entry_block2.arguments[1].get_name()) # CHECK: module { # CHECK: %[[VAL1]] = "custom.op1"() : () -> i32 @@ -212,6 +235,11 @@ def testValuePrintAsOperand(): # CHECK: func.func @test(%[[ARG0]]: i32, %[[ARG1]]: i32) { # CHECK: %[[VAL3]] = "custom.op3"() : () -> i32 # CHECK: %[[VAL4]] = "custom.op4"() : () -> i32 + # CHECK: func @test(%[[ARG2]]: i32, %[[ARG3]]: i32) { + # CHECK: %[[VAL5]] = "custom.op5"() : () -> i32 + # CHECK: %[[VAL6]] = "custom.op6"() : () -> i32 + # CHECK: return + # CHECK: } # CHECK: return # CHECK: } # CHECK: } diff --git a/mlir/tools/mlir-opt/mlir-opt.cpp b/mlir/tools/mlir-opt/mlir-opt.cpp index 149f9d59961b..9cf5bef7985c 100644 --- a/mlir/tools/mlir-opt/mlir-opt.cpp +++ b/mlir/tools/mlir-opt/mlir-opt.cpp @@ -162,6 +162,7 @@ void registerTestDialect(DialectRegistry &); void registerTestDynDialect(DialectRegistry &); void registerTestTilingInterfaceTransformDialectExtension(DialectRegistry &); void registerTestTransformDialectExtension(DialectRegistry &); +void registerAllTestDialectPasses(); } // namespace test #ifdef MLIR_INCLUDE_TESTS @@ -287,6 +288,8 @@ void registerTestPasses() { mlir::test::registerTestPDLByteCodePass(); mlir::test::registerTestPDLLPasses(); #endif + + ::test::registerAllTestDialectPasses(); } #endif diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp index dacc20b6ba20..51051b662ede 100644 --- a/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp +++ b/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp @@ -924,9 +924,7 @@ void DefFormat::genOptionalGroupPrinter(OptionalElement *el, FmtContext &ctx, void DefFormat::genWhitespacePrinter(WhitespaceElement *el, FmtContext &ctx, MethodBody &os) { if (el->getValue() == "\\n") { - // FIXME: The newline should be `printer.printNewLine()`, i.e., handled by - // the printer. - os << tgfmt("$_printer << '\\n';\n", &ctx); + os << tgfmt("$_printer.printNewline();\n", &ctx); } else if (!el->getValue().empty()) { os << tgfmt("$_printer << \"$0\";\n", &ctx, el->getValue()); } else { diff --git a/mlir/unittests/Pass/CMakeLists.txt b/mlir/unittests/Pass/CMakeLists.txt index 802b3bbc6c63..38e3c20d036f 100644 --- a/mlir/unittests/Pass/CMakeLists.txt +++ b/mlir/unittests/Pass/CMakeLists.txt @@ -2,6 +2,7 @@ add_mlir_unittest(MLIRPassTests AnalysisManagerTest.cpp PassManagerTest.cpp PassPipelineParserTest.cpp + PassPipelineOptionsTest.cpp ) target_link_libraries(MLIRPassTests PRIVATE diff --git a/mlir/unittests/Pass/PassPipelineOptionsTest.cpp b/mlir/unittests/Pass/PassPipelineOptionsTest.cpp new file mode 100644 index 000000000000..bec590b8bf01 --- /dev/null +++ b/mlir/unittests/Pass/PassPipelineOptionsTest.cpp @@ -0,0 +1,121 @@ +//===- PassPipelineParserTest.cpp - Pass Parser unit tests ----------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "mlir/IR/Builders.h" +#include "mlir/IR/BuiltinOps.h" +#include "mlir/Pass/Pass.h" +#include "mlir/Pass/PassManager.h" +#include "gtest/gtest.h" + +#include + +using namespace mlir; +using namespace mlir::detail; + +namespace { + +// these types are used for automatically generated code of pass +using StrPassOpt = ::mlir::Pass::Option; +using IntPassOpt = ::mlir::Pass::Option; +using BoolPassOpt = ::mlir::Pass::Option; + +// these types are used for pipeline options that we manually pass to the constructor +using StrOption = mlir::detail::PassOptions::Option; +using IntOption = mlir::detail::PassOptions::Option; +using BoolOption = mlir::detail::PassOptions::Option; + +const int intOptDefaultVal = 5; +const bool boolOptDefaultVal = true; + +struct SimplePassWithOptions + : public PassWrapper> { + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SimplePassWithOptions) + + SimplePassWithOptions() = default; + SimplePassWithOptions(const SimplePassWithOptions &other) : PassWrapper(other) {} + + SimplePassWithOptions(const detail::PassOptions& options) { + copyOptionValuesFrom(options); + } + + LogicalResult initialize(MLIRContext *ctx) final { + return success(); + } + + void runOnOperation() override { } + +public: + StrPassOpt strOpt{*this, "str-opt", ::llvm::cl::desc("string test option"), llvm::cl::init("")}; + IntPassOpt intOpt{*this, "int-opt", ::llvm::cl::desc("int test option"), llvm::cl::init(intOptDefaultVal)}; + BoolPassOpt boolOpt{*this, "bool-opt", ::llvm::cl::desc("bool test option"), llvm::cl::init(boolOptDefaultVal)}; +}; + +TEST(PassPipelineOptionsTest, CopyAllOptions) { + struct DuplicatedOtions : ::mlir::PassPipelineOptions { + StrOption strOpt{*this, "str-opt", ::llvm::cl::desc("string test option")}; + IntOption intOpt{*this, "int-opt", ::llvm::cl::desc("int test option"), llvm::cl::init(intOptDefaultVal)}; + BoolOption boolOpt{*this, "bool-opt", ::llvm::cl::desc("bool test option"), llvm::cl::init(boolOptDefaultVal)}; + }; + + const auto expectedStrVal = "test1"; + const auto expectedIntVal = -intOptDefaultVal; + const auto expectedBoolVal = !boolOptDefaultVal; + + DuplicatedOtions options; + options.strOpt.setValue(expectedStrVal); + options.intOpt.setValue(expectedIntVal); + options.boolOpt.setValue(expectedBoolVal); + + const auto& pass = std::make_unique(options); + + EXPECT_EQ(pass->strOpt.getValue(), expectedStrVal); + EXPECT_EQ(pass->intOpt.getValue(), expectedIntVal); + EXPECT_EQ(pass->boolOpt.getValue(), expectedBoolVal); +} + +TEST(PassPipelineOptionsTest, CopyMatchedOptions) { + struct SomePipelineOptions : ::mlir::PassPipelineOptions { + StrOption strOpt{*this, "str-opt", ::llvm::cl::desc("string test option")}; + IntOption intOpt{*this, "int-opt", ::llvm::cl::desc("int test option")}; + StrOption anotherStrOpt{*this, "another-str-pipeline-opt", + ::llvm::cl::desc("there is no such option in SimplePassWithOptions"), llvm::cl::init("anotherOptVal")}; + IntOption anotherIntOpt{*this, "another-int-pipeline-opt", + ::llvm::cl::desc("there is no such option in SimplePassWithOptions"), llvm::cl::init(10)}; + }; + + const auto expectedStrVal = "test2"; + const auto expectedIntVal = -intOptDefaultVal; + + SomePipelineOptions options; + options.strOpt.setValue(expectedStrVal); + options.intOpt.setValue(expectedIntVal); + + const auto pass = std::make_unique(options); + + EXPECT_EQ(pass->strOpt.getValue(), expectedStrVal); + EXPECT_EQ(pass->intOpt.getValue(), expectedIntVal); + EXPECT_EQ(pass->boolOpt.getValue(), boolOptDefaultVal); +} + +TEST(PassPipelineOptionsTest, NoMatchedOptions) { + struct SomePipelineOptions : ::mlir::PassPipelineOptions { + StrOption anotherStrOpt{*this, "another-str-pipeline-opt", + ::llvm::cl::desc("there is no such option in SimplePassWithOptions"), llvm::cl::init("anotherOptVal")}; + IntOption anotherIntOpt{*this, "another-int-pipeline-opt", + ::llvm::cl::desc("there is no such option in SimplePassWithOptions"), llvm::cl::init(10)}; + }; + + SomePipelineOptions options; + const auto pass = std::make_unique(options); + + EXPECT_EQ(pass->strOpt.getValue(), ""); + EXPECT_EQ(pass->intOpt.getValue(), intOptDefaultVal); + EXPECT_EQ(pass->boolOpt.getValue(), boolOptDefaultVal); +} + +} // namespace diff --git a/mlir/unittests/Transforms/BufferizationUtils.cpp b/mlir/unittests/Transforms/BufferizationUtils.cpp new file mode 100644 index 000000000000..dcbda46bcf75 --- /dev/null +++ b/mlir/unittests/Transforms/BufferizationUtils.cpp @@ -0,0 +1,154 @@ +//===- BufferizationUtils.cpp - Unit Tests for Bufferization Utils ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "mlir/Transforms/BufferizationUtils.h" +#include "mlir/Dialect/Bufferization/Extensions/AllExtensions.h" +#include "mlir/Dialect/Bufferization/IR/Bufferization.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/IR/BuiltinDialect.h" +#include "mlir/IR/Diagnostics.h" +#include "mlir/IR/TensorEncoding.h" +#include "mlir/Parser/Parser.h" +#include "mlir/Support/LogicalResult.h" +#include "mlir/Transforms/Passes.h" +#include "gtest/gtest.h" + +using namespace mlir; + +namespace { +struct TestTensorAttr : public StringAttr { + using mlir::StringAttr::StringAttr; + + static bool classof(mlir::Attribute attr) { + return mlir::isa(attr); + } + + static TestTensorAttr fromStringAttr(StringAttr attr) { + return mlir::dyn_cast(attr); + } +}; + +class TestTensorEncodingVerifier final + : public mlir::VerifiableTensorEncoding::ExternalModel< + TestTensorEncodingVerifier, TestTensorAttr> { +public: + using ConcreteEntity = mlir::StringAttr; + + mlir::LogicalResult verifyEncoding( + mlir::Attribute attr, mlir::ArrayRef shape, mlir::Type, + mlir::function_ref emitError) const { + std::ignore = shape; + + if (mlir::isa(attr)) { + return mlir::success(); + } + return emitError() << "Unknown Tensor enconding: " << attr; + } +}; + +struct TestMemRefAttr : public mlir::StringAttr { + using mlir::StringAttr::StringAttr; + + static bool classof(mlir::Attribute attr) { + return mlir::isa(attr); + } +}; + +class TestMemRefAttrLayout final + : public mlir::MemRefLayoutAttrInterface::ExternalModel< + TestMemRefAttrLayout, TestMemRefAttr> { +public: + using ConcreteEntity = mlir::StringAttr; + + bool isIdentity(mlir::Attribute) const { return true; } + mlir::AffineMap getAffineMap(mlir::Attribute attr) const { + return mlir::AffineMap::getMultiDimIdentityMap(1, attr.getContext()); + } + mlir::LogicalResult + verifyLayout(mlir::Attribute attr, mlir::ArrayRef shape, + mlir::function_ref emitError) const { + std::ignore = shape; + + if (mlir::isa(attr)) { + return mlir::success(); + } + return emitError() << "Unknown MemRef layout: " << attr; + } +}; + +struct CustomBuiltinBufferizerInterface : DialectBufferizerInterface { + using DialectBufferizerInterface::DialectBufferizerInterface; + + Type getTensorTypeFromMemRefType(Type type) const override { + // propagate memref's layout back to tensor's encoding + if (auto memref = llvm::dyn_cast(type)) { + TestTensorAttr encoding = nullptr; + if (auto layout = llvm::dyn_cast(memref.getLayout())) { + encoding = TestTensorAttr::fromStringAttr(layout); + } + return RankedTensorType::get(memref.getShape(), memref.getElementType(), + encoding); + } + + if (auto memref = llvm::dyn_cast(type)) { + return UnrankedTensorType::get(memref.getElementType()); + } + return NoneType::get(type.getContext()); + } +}; +} // namespace + +class BufferizerInterfaceTest : public ::testing::Test { +protected: + MLIRContext ctx; + + BufferizerInterfaceTest() { + ctx.loadDialect(); + ctx.loadDialect(); + ctx.loadDialect(); + + DialectRegistry registry; + registry.addExtension(+[](mlir::MLIRContext *ctx, BuiltinDialect *) { + TestTensorAttr::attachInterface(*ctx); + TestMemRefAttr::attachInterface(*ctx); + }); + ctx.appendDialectRegistry(registry); + } +}; + +const char *const extendedBuiltinsCode = R"mlir( +func.func @foo(%t : tensor<1x2x3xf64, "hello">) -> memref<1x2x3xf64, "hello"> { + %m = bufferization.to_memref %t : memref<1x2x3xf64, "hello"> + return %m : memref<1x2x3xf64, "hello"> +} +)mlir"; + +TEST_F(BufferizerInterfaceTest, TestDefaultBuiltinBufferizer) { + DialectRegistry registry; + bufferization::registerAllExtensions(registry); + ctx.appendDialectRegistry(registry); + + OwningOpRef res = + parseSourceString(extendedBuiltinsCode, &ctx); + ASSERT_FALSE(res); +} + +TEST_F(BufferizerInterfaceTest, TestCustomBuiltinBufferizer) { + DialectRegistry registry; + registry.addExtension(+[](MLIRContext *ctx, BuiltinDialect *dialect) { + dialect->addInterfaces(); + }); + ctx.appendDialectRegistry(registry); + + // MLIR parsing must succeed for tensor with custom encoding and memref with + // custom layout because a custom DialectBufferizerInterface is used (it would + // copy the layout back to the encoding during type checking). + OwningOpRef res = + parseSourceString(extendedBuiltinsCode, &ctx); + ASSERT_TRUE(res); +} diff --git a/mlir/unittests/Transforms/CMakeLists.txt b/mlir/unittests/Transforms/CMakeLists.txt index 3b08c8ecffbe..054cf4b5755b 100644 --- a/mlir/unittests/Transforms/CMakeLists.txt +++ b/mlir/unittests/Transforms/CMakeLists.txt @@ -1,8 +1,11 @@ add_mlir_unittest(MLIRTransformsTests Canonicalizer.cpp DialectConversion.cpp + BufferizationUtils.cpp ) target_link_libraries(MLIRTransformsTests PRIVATE MLIRParser - MLIRTransforms) + MLIRTransforms + MLIRBufferizationDialect + ) diff --git a/mlir/utils/vscode/package-lock.json b/mlir/utils/vscode/package-lock.json index 1efd5779f5cb..08b773fa004a 100644 --- a/mlir/utils/vscode/package-lock.json +++ b/mlir/utils/vscode/package-lock.json @@ -348,13 +348,19 @@ } }, "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", "dev": true, "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -595,6 +601,23 @@ "node": ">=4.0.0" } }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -695,6 +718,27 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -788,10 +832,13 @@ } }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/gauge": { "version": "2.7.4", @@ -811,14 +858,19 @@ } }, "node_modules/get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", "dev": true, "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -862,6 +914,18 @@ "node": ">= 6" } }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/graceful-fs": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", @@ -889,10 +953,34 @@ "node": ">=4" } }, - "node_modules/has-symbols": { + "node_modules/has-property-descriptors": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true, "engines": { "node": ">= 0.4" @@ -908,6 +996,18 @@ "dev": true, "optional": true }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/hosted-git-info": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", @@ -1195,9 +1295,9 @@ } }, "node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -1339,9 +1439,9 @@ } }, "node_modules/object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1458,12 +1558,12 @@ } }, "node_modules/qs": { - "version": "6.10.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz", - "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==", + "version": "6.12.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.12.1.tgz", + "integrity": "sha512-zWmv4RSuB9r2mYQw3zxQuHWeU+42aKi1wWig/j4ele4ygELZ7PEO6MM7rim9oAQH2A5MWfsAVf/jPvTPgCbvUQ==", "dev": true, "dependencies": { - "side-channel": "^1.0.4" + "side-channel": "^1.0.6" }, "engines": { "node": ">=0.6" @@ -1582,6 +1682,23 @@ "dev": true, "optional": true }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", @@ -1589,14 +1706,18 @@ "dev": true }, "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dev": true, "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2245,13 +2366,16 @@ "dev": true }, "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", "dev": true, "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" } }, "chainsaw": { @@ -2434,6 +2558,17 @@ "dev": true, "optional": true }, + "define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "requires": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + } + }, "delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -2510,6 +2645,21 @@ "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", "dev": true }, + "es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dev": true, + "requires": { + "get-intrinsic": "^1.2.4" + } + }, + "es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -2583,9 +2733,9 @@ } }, "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true }, "gauge": { @@ -2606,14 +2756,16 @@ } }, "get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", "dev": true, "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" } }, "github-from-package": { @@ -2645,6 +2797,15 @@ "is-glob": "^4.0.1" } }, + "gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.3" + } + }, "graceful-fs": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", @@ -2666,10 +2827,25 @@ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, - "has-symbols": { + "has-property-descriptors": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "requires": { + "es-define-property": "^1.0.0" + } + }, + "has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "dev": true + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true }, "has-unicode": { @@ -2679,6 +2855,15 @@ "dev": true, "optional": true }, + "hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "requires": { + "function-bind": "^1.1.2" + } + }, "hosted-git-info": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", @@ -2895,9 +3080,9 @@ "optional": true }, "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "requires": { "brace-expansion": "^1.1.7" } @@ -3014,9 +3199,9 @@ "optional": true }, "object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", "dev": true }, "once": { @@ -3115,12 +3300,12 @@ } }, "qs": { - "version": "6.10.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz", - "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==", + "version": "6.12.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.12.1.tgz", + "integrity": "sha512-zWmv4RSuB9r2mYQw3zxQuHWeU+42aKi1wWig/j4ele4ygELZ7PEO6MM7rim9oAQH2A5MWfsAVf/jPvTPgCbvUQ==", "dev": true, "requires": { - "side-channel": "^1.0.4" + "side-channel": "^1.0.6" } }, "rc": { @@ -3212,6 +3397,20 @@ "dev": true, "optional": true }, + "set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "requires": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + } + }, "setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", @@ -3219,14 +3418,15 @@ "dev": true }, "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dev": true, "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" } }, "signal-exit": { From 3780320fb7120b7c02868d1c39ebc1dcf1f60f8d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 04:42:00 +0000 Subject: [PATCH 3/3] Bump the github-actions group across 1 directory with 6 updates Bumps the github-actions group with 6 updates in the / directory: | Package | From | To | | --- | --- | --- | | [step-security/harden-runner](https://github.com/step-security/harden-runner) | `2.10.4` | `2.11.0` | | [tj-actions/changed-files](https://github.com/tj-actions/changed-files) | `d6e91a2266cdb9d62096cebf1e8546899c6aa18f` | `b74df86ccb65173a8e33ba5492ac1a2ca6b216fd` | | [aminya/setup-cpp](https://github.com/aminya/setup-cpp) | `0.46.0` | `1.4.0` | | [actions/setup-python](https://github.com/actions/setup-python) | `5.4.0` | `5.5.0` | | [ossf/scorecard-action](https://github.com/ossf/scorecard-action) | `2.4.0` | `2.4.1` | | [actions/upload-artifact](https://github.com/actions/upload-artifact) | `3.2.1.pre.node20` | `4.6.2` | Updates `step-security/harden-runner` from 2.10.4 to 2.11.0 - [Release notes](https://github.com/step-security/harden-runner/releases) - [Commits](https://github.com/step-security/harden-runner/compare/cb605e52c26070c328afc4562f0b4ada7618a84e...4d991eb9b905ef189e4c376166672c3f2f230481) Updates `tj-actions/changed-files` from d6e91a2266cdb9d62096cebf1e8546899c6aa18f to b74df86ccb65173a8e33ba5492ac1a2ca6b216fd - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](https://github.com/tj-actions/changed-files/compare/d6e91a2266cdb9d62096cebf1e8546899c6aa18f...b74df86ccb65173a8e33ba5492ac1a2ca6b216fd) Updates `aminya/setup-cpp` from 0.46.0 to 1.4.0 - [Release notes](https://github.com/aminya/setup-cpp/releases) - [Commits](https://github.com/aminya/setup-cpp/compare/12e62a1b8da8f1e66acc75305a2621234ef49dd0...fc7a5158bd0209259b36b6cb8e06bac791057220) Updates `actions/setup-python` from 5.4.0 to 5.5.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/42375524e23c412d93fb67b49958b491fce71c38...8d9ed9ac5c53483de85588cdf95a591a75ab9f55) Updates `ossf/scorecard-action` from 2.4.0 to 2.4.1 - [Release notes](https://github.com/ossf/scorecard-action/releases) - [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md) - [Commits](https://github.com/ossf/scorecard-action/compare/62b2cac7ed8198b15735ed49ab1e5cf35480ba46...f49aabe0b5af0936a0987cfb85d86b75731b0186) Updates `actions/upload-artifact` from 3.2.1.pre.node20 to 4.6.2 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/c24449f33cd45d4826c6702db7e49f7cdb9b551d...ea165f8d65b6e75b540449e92b4886f43607fa02) --- updated-dependencies: - dependency-name: step-security/harden-runner dependency-version: 2.11.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: tj-actions/changed-files dependency-version: b74df86ccb65173a8e33ba5492ac1a2ca6b216fd dependency-type: direct:production dependency-group: github-actions - dependency-name: aminya/setup-cpp dependency-version: 1.4.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: actions/setup-python dependency-version: 5.5.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: ossf/scorecard-action dependency-version: 2.4.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: actions/upload-artifact dependency-version: 4.6.2 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions ... Signed-off-by: dependabot[bot] --- .github/workflows/codeql.yml | 2 +- .github/workflows/dependency-review.yml | 2 +- .github/workflows/pr-code-format.yml | 8 ++++---- .github/workflows/scorecard.yml | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 8bb0fd95f1f2..7614addcbb7f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -41,7 +41,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 1b495dbce772..4a15a1dfadb6 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index e34872160c6f..2c679dcf641c 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -14,7 +14,7 @@ jobs: if: (github.repository == 'llvm/llvm-project' || github.repository == 'intel/npu-plugin-llvm') && !contains(github.event.pull_request.labels.*.name, 'disable-lint') steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit @@ -32,7 +32,7 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6 + uses: tj-actions/changed-files@b74df86ccb65173a8e33ba5492ac1a2ca6b216fd # v45.0.6 with: separator: "," skip_initial_fetch: true @@ -57,12 +57,12 @@ jobs: echo "$CHANGED_FILES" - name: Install clang-format - uses: aminya/setup-cpp@12e62a1b8da8f1e66acc75305a2621234ef49dd0 # v1 + uses: aminya/setup-cpp@fc7a5158bd0209259b36b6cb8e06bac791057220 # v1 with: clangformat: 17.0.1 - name: Setup Python env - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 + uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0 with: python-version: '3.11' cache: 'pip' diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 2d96a0a67825..3b83aafe6c8c 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -39,7 +39,7 @@ jobs: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0 + uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1 with: results_file: results.sarif results_format: sarif @@ -61,7 +61,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@c24449f33cd45d4826c6702db7e49f7cdb9b551d # v3.pre.node20 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v3.pre.node20 with: name: SARIF file path: results.sarif