[mlir][IR] Add transient scope support for resettable MLIRContext. (#217320) We have cases where we have many context being used to compile independent modules. Creating a context per ends up being rather expensive and the only reason to not reuse contexts more is bloat over time. This changes adds a "transient" scope which can be used for such cases. Initially I had tried a "cheap fork" approach for contexts, this is complimentary to that (that one allows for independent contexts cheaply), while this one is less invasive. Introduce an overlay/layered state architecture in StorageUniquer and MLIRContext to enable efficient scoping and rollback of transient types, attributes, affine expressions, and distinct attributes added since entering a transient scope. When executing repeated compilation passes or running in long-lived compiler services (e.g. JITs, servers, REPLs), allocating and destroying an MLIRContext incurs significant overhead (~3.7 ms per context) to re-register and load dialects. This change allows freezing an initialized context as a base state and rolling back transient types/attributes in O(1) time without re-instantiating dialects or builtins. Assisted-By: Gemini
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.