Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++ bridge] Switch from using arith ops to cc.cast #1978

Merged
merged 3 commits into from
Jul 20, 2024

Conversation

schweitzpgi
Copy link
Collaborator

The arith dialect provides a big menu of casting/conversion operations that we can use but which have their own rules and semantics. For example, the generation of a quantum circuit can involve aggressive constant propagation. By using an operation in a dialect we control (CC), we can implement folding and combing these operations in ways that are suitable to our domain and do not rely on decisions in the MLIR code that may be too conservative or too aggressive for our needs.

[core] Add constant folding of cc.cast operations.

These constant folding operations will eliminate cc.cast operations when they are converting the type of a constant input op.

Update the tests.

Add pattern to eliminate integer casts into an integer comparison.

Add constant folding of complex.create. Apparently MLIR doesn't do this.

Add cast complex to complex and various constant foldings.

Add a new test.

Add codegen expansion pattern.

Description

The arith dialect provides a big menu of casting/conversion operations
that we can use but which have their own rules and semantics. For
example, the generation of a quantum circuit can involve aggressive
constant propagation. By using an operation in a dialect we control
(CC), we can implement folding and combing these operations in ways that
are suitable to our domain and do not rely on decisions in the MLIR code
that may be too conservative or too aggressive for our needs.

[core] Add constant folding of cc.cast operations.

These constant folding operations will eliminate cc.cast operations when
they are converting the type of a constant input op.

Update the tests.

Add pattern to eliminate integer casts into an integer comparison.

Add constant folding of complex.create. Apparently MLIR doesn't do this.

Add cast complex to complex and various constant foldings.

Add a new test.

Add codegen expansion pattern.
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 Jul 20, 2024
@schweitzpgi schweitzpgi enabled auto-merge (squash) July 20, 2024 16:47
github-actions bot pushed a commit that referenced this pull request Jul 20, 2024
Copy link

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

Copy link
Collaborator

@annagrin annagrin left a comment

Choose a reason for hiding this comment

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

LGTM, thanks Eric!

@schweitzpgi schweitzpgi merged commit 20e78b8 into NVIDIA:main Jul 20, 2024
125 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 20, 2024
@bettinaheim bettinaheim added the no release notes Don't list this PR in the release notes label Jul 29, 2024
@bettinaheim bettinaheim added this to the release 0.8.0 milestone Jul 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
no release notes Don't list this PR in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants