Merging simplified HAL bindings branch. (#18366)

This removes the concept of descriptor sets and pipeline layouts from
the HAL and switches programs to using a flat list of bindings per
dispatch as real programs rarely benefited and will do so less as
command buffer reuse is enabled. Command buffer recording is now
stateless as the information in push constants and push descriptor set
commands are carried per dispatch and there's no need to track pipeline
layouts. Pipeline layouts are still present in a reduced form in the
compiler IR in order to handle dispatch ABI in a normalized way but it's
up to the TargetBackends to encode them. Encoded metadata for pipeline
layouts is now embedded in the target-specific executables for targets
that require them (Metal/Vulkan/WebGPU/D3D12) and a reduced set of
information is embedded for others. This simplifies the HAL API quite a
bit, makes implementing the HAL easier as targets have more freedom in
how constants and bindings are mapped to lower-level implementations,
and in practice improves command buffer recording latency as there are
fewer VM calls per dispatch on average.

Since the flatbuffers needed to change to include the new metadata that
previously was handled via the HAL APIs this branch also modernizes and
normalizes the flatbuffers across targets to both better match the
implementation and support features like multiple shader modules/kernel
libraries/etc per HAL executable (even if the compiler isn't linking
them yet). This reorganization is required to effectively manage cached
resources - before the compiler would deduplicate pipeline layouts
across all executables but now that each executable is responsible for
that having 1000 executables means that there will be 1000 pipeline
layouts even if most are the same. Perhaps this will serve as good
motivation to finally finish linking in all backends :) Debug info is
also consistently added for all targets and processed for tracing and
factored such that new debug info can be added per-exported function
without needing to change per-target code.

There are many IR changes here and many test updates: most of the tests
that were updated are in codegen and should not be using HAL ops at all.
As codegen test cleanup continues to switch from HAL ops to basic
functions future changes to the HAL IR will be easier. Notable changes
include:
* Renamed `push_constants` to `constants` (as there is no longer a
`push_constants` API)
* Dropped `#hal.descriptor_set.layout`
* Removed ordinal from `#hal.descriptor_set.binding` (as ordinals are
now implicit)
* Renamed `#hal.descriptor_set.binding` to `#hal.pipeline.binding`
* Removed `set` from `hal.interface.binding.subspan`
* Removed `#hal.interface.binding` and the spooky action at a distance
`hal.interface.binding` attr now that ordinals are implicit

Metal/CUDA/Vulkan/HIP/CPU have all been updated to the new binding
model. WebGPU has had some changes applied but needs some significant
specialized work due to its existing push constant emulation requiring
compiler-side descriptor sets. That's left for future work when that
experimental backend is revived.

This bumps the HAL version to 5 (types removed and methods changed) and
the CPU executable library version to 5 (added reserved per-export
fields for future use).

Fixes #18154.
tree: 708ea563dc2dbcc0a463bece1048c4d70d7ef602
  1. .github/
  2. build_tools/
  3. compiler/
  4. docs/
  5. experimental/
  6. integrations/
  7. lib/
  8. llvm-external-projects/
  9. runtime/
  10. samples/
  11. tests/
  12. third_party/
  13. tools/
  14. .bazel_to_cmake.cfg.py
  15. .bazelignore
  16. .bazelrc
  17. .bazelversion
  18. .clang-format
  19. .dockerignore
  20. .git-blame-ignore-revs
  21. .gitattributes
  22. .gitignore
  23. .gitmodules
  24. .pre-commit-config.yaml
  25. .yamllint.yml
  26. AUTHORS
  27. BUILD.bazel
  28. CITATION.cff
  29. CMakeLists.txt
  30. configure_bazel.py
  31. CONTRIBUTING.md
  32. LICENSE
  33. MAINTAINERS.md
  34. README.md
  35. RELEASING.md
  36. WORKSPACE
README.md

IREE: Intermediate Representation Execution Environment

IREE (Intermediate Representation Execution Environment, pronounced as “eerie”) is an MLIR-based end-to-end compiler and runtime that lowers Machine Learning (ML) models to a unified IR that scales up to meet the needs of the datacenter and down to satisfy the constraints and special considerations of mobile and edge deployments.

See our website for project details, user guides, and instructions on building from source.

IREE Discord Status pre-commit OpenSSF Best Practices

Project Status

IREE is still in its early phase. We have settled down on the overarching infrastructure and are actively improving various software components as well as project logistics. It is still quite far from ready for everyday use and is made available without any support at the moment. With that said, we welcome any kind of feedback on any communication channels

Release status

PackageRelease status
GitHub release (stable)GitHub Release
GitHub release (nightly)GitHub Release
Python iree-compilerPyPI version
Python iree-runtimePyPI version

Build status

CI PkgCI

Host platformBuild status
LinuxCI - Linux x64 clang
CI - Linux arm64 clang
macOSCI - macOS x64 clang
WindowsCI - Windows x64 MSVC

For the full list of workflows see https://iree.dev/developers/general/github-actions/.

Communication Channels

Related Project Channels

  • MLIR topic within LLVM Discourse: IREE is enabled by and heavily relies on MLIR. IREE sometimes is referred to in certain MLIR discussions. Useful if you are also interested in MLIR evolution.

Architecture Overview

IREE Architecture IREE Architecture

See our website for more information.

Presentations and Talks

Community meeting recordings: IREE YouTube channel

  • 2021-06-09: IREE Runtime Design Tech Talk (recording and slides)
  • 2020-08-20: IREE CodeGen: MLIR Open Design Meeting Presentation (recording and slides)
  • 2020-03-18: Interactive HAL IR Walkthrough (recording)
  • 2020-01-31: End-to-end MLIR Workflow in IREE: MLIR Open Design Meeting Presentation (recording and slides)

License

IREE is licensed under the terms of the Apache 2.0 License with LLVM Exceptions. See LICENSE for more information.