Skip to content

Conversation

schweitzpgi
Copy link
Collaborator

@schweitzpgi schweitzpgi commented Sep 8, 2025

There are a variety of compiler pass pipelines that exist in the project. It has long been acknowledged that they don't meet our needs very well.

For the C++ AOT compiler, there are two sets of pipelines primarily. There is the pipeline that is built in the compiler driver and then a pipeline that is used to generate code for default simulation.

For the C++ JIT compiler, every target can (and did) specify its own special pipeline, leading to inconsistencies and maintenance problems. Furthermore, this pipeline may have been incorrect and patched on-the-fly by the JIT compilation process. Finally, it was augmented by running the same pipeline as the AOT compiler for code generation with various minor changes. This situation was both far too flexible (anyone could run any pass in any order in the JIT pipeline) and far too inflexible (high-level and low-level passes were thrown together in ad hoc ways, preventing downstream passes from running correctly).

For Python, the pipelines are done in a completely different way for the most part, but some of the pipelines are the same. For example, the code generation pipeline remains largely the same, but has its own minor tweaks. Python doesn't really distinguish between AOT and JIT compilation.

The changes:

  • Instead of a single "lowering pipeline" that was used by the JIT compiler, the JIT pipeline has been decomposed into target agnostic and target dependent passes. Furthermore, the JIT pipeline has been broken into 3 levels: high level, mid level, and low level. Each of these levels runs the target dependent passes (from the .yml target config) followed by the target independent passes for that level.

  • The code generation pipeline now has distinct AOT vs. JIT separation. This eliminates the running of passes at JIT time that are not required.

There are a variety of compiler pass pipelines that exist in the project.
It has long been acknowledged that they don't meet our needs very well.

For the C++ AOT compiler, there are two sets of pipelines primarily. There is
the pipeline that is built in the compiler driver and then a pipeline that
is used to generate code for default simulation.

For the C++ JIT compiler, every target can (and did) specify its own special
pipeline, leading to inconsistencies and maintenance problems. Furthermore,
this pipeline may have been incorrect and patched on-the-fly by the JIT
compilation process. Finally, it was augmented by running the same pipeline
as the AOT compiler for code generation with various minor changes. This
situation was both far too flexible (anyone could run any pass in any order
in the JIT pipeline) and far too inflexible (high-level and low-level passes
were thrown together in ad hoc ways, preventing downstream passes from
running correctly).

For Python, the pipelines are done in a completely different way for the
most part, but some of the pipelines are the same. For example, the
code generation pipeline remains largely the same, but has its own minor
tweaks. Python doesn't really distinguish between AOT and JIT compilation.

The changes:

  - Instead of a single "lowering pipeline" that was used by the JIT
    compiler, the JIT pipeline has been decomposed into target agnostic
    and target dependent passes. Furthermore, the JIT pipeline has been
    broken into 3 levels: high level, mid level, and low level. Each
    of these levels runs the target dependent passes (from the .yml
    target config) followed by the target independent passes for that
    level.

  - The code generation pipeline now has distinct AOT vs. JIT separation.
    This eliminates the running of passes at JIT time that are not
    required.

  - Python's compilation model is changed to better reflect that of
    C++. Compilation is done in 2 phases: AOT and JIT. These phases
    are not completely custom, but better mirror those of the C++
    compilation and execution. (Todo)

Signed-off-by: Eric Schweitz <[email protected]>
@schweitzpgi schweitzpgi requested a review from 1tnguyen September 8, 2025 16:24
Signed-off-by: Eric Schweitz <[email protected]>
github-actions bot pushed a commit that referenced this pull request Sep 9, 2025
Copy link

github-actions bot commented Sep 9, 2025

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

Copy link
Collaborator

@1tnguyen 1tnguyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@schweitzpgi schweitzpgi enabled auto-merge (squash) September 9, 2025 20:03
github-actions bot pushed a commit that referenced this pull request Sep 9, 2025
Copy link

github-actions bot commented Sep 9, 2025

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Sep 10, 2025
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

@schweitzpgi schweitzpgi marked this pull request as draft September 10, 2025 14:40
auto-merge was automatically disabled September 10, 2025 14:40

Pull request was converted to draft

@schweitzpgi schweitzpgi force-pushed the ch-pipelines branch 2 times, most recently from 8ed7b4e to 965559b Compare September 10, 2025 14:47
Signed-off-by: Eric Schweitz <[email protected]>
github-actions bot pushed a commit that referenced this pull request Sep 10, 2025
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Sep 10, 2025
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants