KEMBAR78
Replacing existing spin_ops with the general operators by bettinaheim · Pull Request #2710 · NVIDIA/cuda-quantum · GitHub
Skip to content

Conversation

@bettinaheim
Copy link
Collaborator

@bettinaheim bettinaheim commented Mar 7, 2025

This PR contains the full replacement of the existing spin_ops with the new general operators.
It essentially keeps the python bindings as is with the trampolining between the C++ spin_ops and the python operators. That really needs to be replaced, but is a somewhat extensive change that I suggest to make in a separate PR. I did test that just replacing spin/spin ops in Python directly with the bound data structures works throughout all tests except for dynamics (which require that all other operators also are bound).

Some perf numbers can be found here: #2631
These largely remain the same - there is a tiny bit of overhead added due to the switch from int to size_t and the introduced default value, but that is < 10% (last benchmark is unchanged).

Full list of breaking vs non-breaking changes:

Breaking changes:

  • the new operator framework introduces a proper type distinction between product operators and operators that are a sums of products; this is now reflected throughout the API
    • x, y, z, and i in cudaq::spin create a spin_op_term (a product operator)
    • the meaning of spin_op::empty changed - it now returns an empty sum
    • behavior change in spin_op() constructor - it creates an uninitialized sum rather than the product identity
    • behavior change in spin_op(std::size_t) - it creates an empty sum reserving space for the given number of terms
  • changes related to spin_op_term:
    • it is no longer a value of type std::vector<bool> but instead it's own class type (product_op<spin_handler>)
    • the new spin_op_term includes all information about the product, including its coefficient
    • a range of utility functions exist on spin_op_term
    • spin_op::key_type and spin_op::mapped_type no longer exist
    • the value type of the spin_op iterator is a spin_op_term
  • iterators:
    • neither the spin_op iterator nor the spin_op_term iterator allow to modify the operator itself
  • equality comparison:
    • two operators are only equal if they act on the same degrees (qubits)
    • two operators are only equal if all terms and coefficients match
    • [same as before] equality comparison accounts for commutation relations
  • properties:
    • num_qubits reflects only the degrees the operator explicitly acts upon; e.g. spin_op::i(2) act on a single degree
    • to_matrix reflects only the degrees the operator explicitly acts upon; e.g. spin_op::x(1) returns a 2x2 matrix (previously a 4x4 matrix)
    • get_coefficient returns a scalar callback function that in general may require a parameter_map for evaluation;
      evaluate_coefficient replaces the previous get_coefficient implementation and takes an optional parameter_map argument
    • to_string() produces a different string than before - see also deprecation of to_string(bool)
  • changes in usage:
    • [internal only change] the results for terms are stored under the value returned by get_term_id() and values for the entire sum are stored under the key obtained by calling to_string()
    • the Pauli word representation for a spin_op_term can be obtained by calling get_pauli_word(size_t = 0);
      by default that representation does not include identities on qubits the operator does not explicitly act on,
      but if the optional integral argument is provided, the string includes identities for the degrees in [0, arg) that the operator does not act on
    • exp_pauli expects the number of qubits to match the length of the Pauli word
    • expectation and count will fail instead of return 0.0 if the requested value has not been computed/found
    • the order of iteration over term for spin_op may be different than with the previous implementation;
      this should largely be irrelevant but may lead to slightly different results in some cases due to slightly different finite precision effects
  • build system changes:
    • the library cudaq-spin is replaced by cudaq-operator
    • CUDAQSpinConfig.cmake and CUDAQSpinTargets.cmake no longer exist - the replacements are the corresponding CUDAQOperator*.cmake files
    • [mostly internal only change] various minor changes in the files included by headers and in signatures (additional const's) within the CUDA-Q runtime infrastructure (all of that should be mostly internal changes and not have any impact on existing application code)

Deprecated:

  • deprecated constructors:
    • spin_op(const std::vector<bool> &term, const std::complex<double> &coeff) (FIXME...)
    • spin_op(std::pair<const std::vector<bool>, std::complex<double>> &termData) (FIXME...)
    • spin_op(pauli, const std::size_t id, std::complex<double> coeff = 1.0) (FIXME...)
    • spin_op(const std::unordered_map<std::vector<bool>, std::complex<double>> &_terms) (FIXME...)
    • spin_op(const std::vector<std::vector<bool>> &bsf, const std::vector<std::complex<double>> &coeffs) (suggest no substitution)
    • sum_op(const std::vector<double> &input_vec, std::size_t nQubits) (replaced with the matching constructor for new serialization format)
  • deprecated properties:
    • get_raw_data (no substitution)
    • is_identity (to be removed on spin_op class, but will continue to be supported on spin_op_term)
    • to_string(bool) (replaced by either to_string(), get_term_id, or get_pauli_word)
    • getDataRepresentation (replaced by get_data_representation to generate the new serialization format)
    • getDataTuple (no longer used, no substitution, matching constructor listed above)
    • for_each_term (replaced by iterator)
    • for_each_pauli (replaced by iterator)
  • deprecations related to the product vs sum operator distinction:
    • expectation and count will require a spin_op_term going forward; passing a spin_op (with a single term, as previously) is still supported but deprecated
  • headers:
    • dynamics_integrators.h is deprecated and move to cudaq/algorithms/integrator.h instead

Other changes:

  • csr_spmatrix is defined in the cudaq namespace rather than a type definition on spin_op
  • [internal only] the context no longer stores a pointer to a spin_op but rather stores the value
  • the serialization format for spin_op changed; deprecated functions producing and loading the old format are still available, but the entire internal infrastructure switched to the new format obtained by get_data_representation
  • the binary_spin_op_reader::read(const std::string &) is set up to read the new data format -
    an overload binary_spin_op_reader::read(const std::string &, bool) is provided that will read the old serialization format if the optional bool argument is set to true
  • changing the type of cudaq::dimension_map to std::unordered_map<std::size_t, int64_t>; this should have no impact on application code in most cases, the only exception being a type change of the dimensions vector in the definition of a custom operator
  • degrees no longer takes a boolean parameter - any optional argument that was passed can be dropped without a change in behavior
  • to_matrix takes an additional optional boolean parameter invert_order that allows to retrieve the matrix with an inverted ordering convention compared to the default order
  • removes the long deprecated exp_val_z and expectation_n

bettinaheim and others added 27 commits March 5, 2025 16:55
…I haven't committed yet

Signed-off-by: Bettina Heim <heimb@outlook.com>
…n changes I haven't committed yet

Signed-off-by: Bettina Heim <heimb@outlook.com>
…itted yet

Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
…r cleaner and more predictable

Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
…_operator.cpp

Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Ben Howe <bhowe@nvidia.com>
Early cmake changes necessary (?) for libraries
@copy-pr-bot
Copy link

copy-pr-bot bot commented Mar 8, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
@bettinaheim
Copy link
Collaborator Author

bettinaheim commented Mar 26, 2025

/ok to test

Command Bot: Processing...

@github-actions
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 Mar 26, 2025
Copy link
Collaborator

@bmhowe23 bmhowe23 left a comment

Choose a reason for hiding this comment

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

I'm only part way through, but posting what I've got so far.

Copy link
Collaborator

@bmhowe23 bmhowe23 left a comment

Choose a reason for hiding this comment

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

This is another partial review ... I'm hoping that submitting this one and then starting another one will make my browser load the remaining diffs correctly.

Copy link
Collaborator

@bmhowe23 bmhowe23 left a comment

Choose a reason for hiding this comment

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

OK, this is the last of my comments. Unfortunately breaking up my review didn't help my browser any ... it refuses to automatically load diffs for more than X files (where X is unknown to me), so I had to manually load them I think that many of the test file changes ended up being unnecessary (simply changing to use cudaq::spin_op::x instead of just x).

Copy link
Collaborator

@bmhowe23 bmhowe23 left a comment

Choose a reason for hiding this comment

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

Thanks, Bettina. I know there are some unresolved threads right now, but I'm approving now anyway and will let you judge which ones need to be addressed now vs later (or never).

Also, just to capture our offline discussion, we know this is likely to break compatibility with our currently deployed NVQC servers, but there is a separate plan in place for NVQC going forward.

Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
@bettinaheim
Copy link
Collaborator Author

bettinaheim commented Mar 26, 2025

/ok to test

Command Bot: Processing...

Signed-off-by: Bettina Heim <heimb@outlook.com>
@bettinaheim
Copy link
Collaborator Author

bettinaheim commented Mar 26, 2025

/ok to test

Command Bot: Processing...

@github-actions
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 Mar 26, 2025
@github-actions
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 Mar 26, 2025
@bettinaheim bettinaheim merged commit c53f774 into NVIDIA:main Mar 26, 2025
196 of 197 checks passed
github-actions bot pushed a commit that referenced this pull request Mar 26, 2025
@bmhowe23 bmhowe23 linked an issue Mar 26, 2025 that may be closed by this pull request
4 tasks
bmhowe23 added a commit to NVIDIA/cudaqx that referenced this pull request Mar 26, 2025
This PR includes the required CUDA-QX changes that must be applied once
NVIDIA/cuda-quantum#2710 (from CUDA-Q) lands.

For that PR, most of the breaking changes are in C++, but a few Python
tests needed to be updated as well. Python changes will likely be coming
in the near future.

Note that this change actually removes more code than it adds. This is
primarily due to updates in the test code.

Here is a summary of the changes in this PR.

1. Update CMakeLists.txt files to link against `cudaq-operator` instead
of `cudaq-spin` because `cuda-spin` was removed.
2. Make use of `cudaq::spin_op_term` (a product term) where appropriate.
I currently left all the public QEC API's to use `spin_op` (a sum term),
but we may choose to update them to simply `spin_op_term` in the near
future. That would be a CUDA-QX breaking change if we do.
3. Since the new operators no longer store degrees that had implicit
`I`'s in them, we must now clarify whether we want `I` in the terms. For
QEC, this means that we will sometimes use something like
`cudaq::spin_op_term identity(0, get_num_data_qubits())`, but for
Solvers, we have eliminated all implicit `I`'s.
4. Use `get_pauli_word()` instead of `to_string(false)`.
5. Use `evaluate_coefficient()` instead of `get_coefficient()`.
6. Use `.trim()` to remove 0-cofficient terms and `.canonicalize()` to
remove `I` operations from terms. (These new helper functions help
reduce boiler-plate code.)
7. For default-constructed `cudaq::spin_op` objects, clarify whether you
want them to be initialized to the neutral sum term (i.e. 0 =
`spin_op::empty()`) or the neutral product term (i.e. 1 =
`spin_op::identity()`).
8. Change `for_each_term()` to use iterators like `for (const auto &term
: hamiltonian)`.
9. As needed, update code to reflect that `get_qubit_count()` now only
returns the number of _actual_ degrees used in the operator rather than
the "highest degree + 1" that used to be returned. If needed, make use
of the new `min_degree()` and `max_degree()` methods instead.
10. For canned test data, update to use the new serialization format (as
retrieved by `get_data_representation()`).
11. For test data comparisons, be sure to call `canonicalize` on the
test data and/or truth data as necessary in order to ensure correct
comparisons.
12. Don't use `get_raw_data()` anymore.

---------

Signed-off-by: Ben Howe <bhowe@nvidia.com>
1tnguyen added a commit that referenced this pull request Apr 2, 2025
* State synthesis for quantum devices (#2291)

* DCO Remediation Commit for Ben Howe <bhowe@nvidia.com>

I, Ben Howe <bhowe@nvidia.com>, hereby add my Signed-off-by to this commit: 86681ef

Signed-off-by: Ben Howe <bhowe@nvidia.com>
Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* State pointer synthesis for quantum hardware

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Merge with main

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Merge with main

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix test failure on anyon platform

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Make StateInitialization a funcOp pass

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix issues and tests for the rest of quantum architectures

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix failing quantinuum state prep tests

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address CR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Format

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix failing test

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Format

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Format

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Replaced getState intrinsic by cc.get_state op

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Remove print

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Remove getCudaqState references

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Minor updates

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix failing quake test

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Add a few state-related cc ops

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix test_argument_conversion

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Add printing in failing tests

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Add printing in failing tests

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix failing tests

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Add description for new algorithm for state syntesis

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix tests

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Make intermediate IR legal by separating allocs

* DCO Remediation Commit for Anna Gringauze <agringauze@nvidia.com>

I, Anna Gringauze <agringauze@nvidia.com>, hereby add my Signed-off-by to this commit: 9563371

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address some PR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address more CR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Cleanup

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address CR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address more CR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address more CR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Store new functions in subst module and update synthesis

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Make argument synthesis transitive

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Update callers of synthesis

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Use PointerOf in quake defs

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Addressed more CR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Recursive with caching

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* StateAggregatorWithArgumentConverter

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Make ArgumentConverter handle the state call tree

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Make argument converter handle kernels created from states

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix null alloc size and add tests

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Keep storing ops when generating numSubits func

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Cleanup

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Cleanup

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Cleanup

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix failing test

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix failing doc build

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address CR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address more CR comments and add a test

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address more CR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix links

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix links

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

---------

Signed-off-by: Ben Howe <bhowe@nvidia.com>
Signed-off-by: Anna Gringauze <agringauze@nvidia.com>
Co-authored-by: Ben Howe <bhowe@nvidia.com>

* Some fixes for complex numbers and vectors (#2739)

* Some fixes for complex numbers and vectors

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Cleanup

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Cleanup

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Update lib/Optimizer/Dialect/CC/CCOps.cpp

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix links

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix links

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix links

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix links

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

---------

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>

* Add docs for `apply_noise` (#2745)

* Enabling afqmc notebook by freezing numba to 0.60.0 (#2759)

* Enabling afqmc by freezing numba to 0.60.0

Signed-off-by: Sachin Pisal <spisal@nvidia.com>

* removing afqmc form skipped_notebooks

Signed-off-by: Sachin Pisal <spisal@nvidia.com>

---------

Signed-off-by: Sachin Pisal <spisal@nvidia.com>

* Replacing existing spin_ops with the general operators (#2710)

This PR contains the full replacement of the existing spin_ops with the new general operators.
See the PR description on GitHub for a full list of all changes.

---------

Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Ben Howe <bhowe@nvidia.com>
Signed-off-by: Anna Gringauze <agringauze@nvidia.com>
Co-authored-by: Ben Howe <bhowe@nvidia.com>
Co-authored-by: cuda-quantum-bot <cuda-quantum-bot@users.noreply.github.com>
Co-authored-by: Anna Gringauze <agringauze@nvidia.com>

* Allow Return Value Optimization instead of forcing moves (#2765)

Signed-off-by: Ben Howe <bhowe@nvidia.com>

* Dev Container psi-header extension: retain original copyright year (#2766)

For those of us using VSCode dev containers, this makes the psi-header extension work with other projects that don't all have 2022 as a starting point. More specifically - with this change, the extension will attempt to retain the existing starting copyright year and update only the ending copyright year if it exists (rather than updating both the start copyright year and current copyright year).

Additionally, if the file is a new file, it will use "now" as the starting copyright year, which is more correct anyway.

Signed-off-by: Ben Howe <bhowe@nvidia.com>

---------

Signed-off-by: Ben Howe <bhowe@nvidia.com>
Signed-off-by: Anna Gringauze <agringauze@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Co-authored-by: Anna Gringauze <agringauze@nvidia.com>
Co-authored-by: Ben Howe <bhowe@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Ben Howe <141149032+bmhowe23@users.noreply.github.com>
Co-authored-by: Sachin Pisal <spisal@nvidia.com>
Co-authored-by: Bettina Heim <heimb@outlook.com>
Co-authored-by: cuda-quantum-bot <cuda-quantum-bot@users.noreply.github.com>
@bettinaheim bettinaheim added the breaking change Change breaks backwards compatibility label Apr 28, 2025
@bettinaheim bettinaheim added this to the release 0.11.0 milestone May 5, 2025
annagrin added a commit to annagrin/cuda-quantum that referenced this pull request Jun 17, 2025
* State synthesis for quantum devices (NVIDIA#2291)

* DCO Remediation Commit for Ben Howe <bhowe@nvidia.com>

I, Ben Howe <bhowe@nvidia.com>, hereby add my Signed-off-by to this commit: 86681ef

Signed-off-by: Ben Howe <bhowe@nvidia.com>
Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* State pointer synthesis for quantum hardware

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Merge with main

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Merge with main

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix test failure on anyon platform

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Make StateInitialization a funcOp pass

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix issues and tests for the rest of quantum architectures

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix failing quantinuum state prep tests

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address CR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Format

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix failing test

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Format

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Format

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Replaced getState intrinsic by cc.get_state op

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Remove print

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Remove getCudaqState references

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Minor updates

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix failing quake test

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Add a few state-related cc ops

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix test_argument_conversion

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Add printing in failing tests

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Add printing in failing tests

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix failing tests

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Add description for new algorithm for state syntesis

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix tests

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Make intermediate IR legal by separating allocs

* DCO Remediation Commit for Anna Gringauze <agringauze@nvidia.com>

I, Anna Gringauze <agringauze@nvidia.com>, hereby add my Signed-off-by to this commit: 9563371

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address some PR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address more CR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Cleanup

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address CR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address more CR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address more CR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Store new functions in subst module and update synthesis

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Make argument synthesis transitive

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Update callers of synthesis

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Use PointerOf in quake defs

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Addressed more CR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Recursive with caching

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* StateAggregatorWithArgumentConverter

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Make ArgumentConverter handle the state call tree

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Make argument converter handle kernels created from states

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix null alloc size and add tests

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Keep storing ops when generating numSubits func

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Cleanup

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Cleanup

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Cleanup

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix failing test

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix failing doc build

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address CR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address more CR comments and add a test

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Address more CR comments

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix links

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix links

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

---------

Signed-off-by: Ben Howe <bhowe@nvidia.com>
Signed-off-by: Anna Gringauze <agringauze@nvidia.com>
Co-authored-by: Ben Howe <bhowe@nvidia.com>

* Some fixes for complex numbers and vectors (NVIDIA#2739)

* Some fixes for complex numbers and vectors

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Cleanup

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Cleanup

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Update lib/Optimizer/Dialect/CC/CCOps.cpp

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix links

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix links

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix links

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

* Fix links

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>

---------

Signed-off-by: Anna Gringauze <agringauze@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>

* Add docs for `apply_noise` (NVIDIA#2745)

* Enabling afqmc notebook by freezing numba to 0.60.0 (NVIDIA#2759)

* Enabling afqmc by freezing numba to 0.60.0

Signed-off-by: Sachin Pisal <spisal@nvidia.com>

* removing afqmc form skipped_notebooks

Signed-off-by: Sachin Pisal <spisal@nvidia.com>

---------

Signed-off-by: Sachin Pisal <spisal@nvidia.com>

* Replacing existing spin_ops with the general operators (NVIDIA#2710)

This PR contains the full replacement of the existing spin_ops with the new general operators.
See the PR description on GitHub for a full list of all changes.

---------

Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Ben Howe <bhowe@nvidia.com>
Signed-off-by: Anna Gringauze <agringauze@nvidia.com>
Co-authored-by: Ben Howe <bhowe@nvidia.com>
Co-authored-by: cuda-quantum-bot <cuda-quantum-bot@users.noreply.github.com>
Co-authored-by: Anna Gringauze <agringauze@nvidia.com>

* Allow Return Value Optimization instead of forcing moves (NVIDIA#2765)

Signed-off-by: Ben Howe <bhowe@nvidia.com>

* Dev Container psi-header extension: retain original copyright year (NVIDIA#2766)

For those of us using VSCode dev containers, this makes the psi-header extension work with other projects that don't all have 2022 as a starting point. More specifically - with this change, the extension will attempt to retain the existing starting copyright year and update only the ending copyright year if it exists (rather than updating both the start copyright year and current copyright year).

Additionally, if the file is a new file, it will use "now" as the starting copyright year, which is more correct anyway.

Signed-off-by: Ben Howe <bhowe@nvidia.com>

---------

Signed-off-by: Ben Howe <bhowe@nvidia.com>
Signed-off-by: Anna Gringauze <agringauze@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Bettina Heim <heimb@outlook.com>
Co-authored-by: Anna Gringauze <agringauze@nvidia.com>
Co-authored-by: Ben Howe <bhowe@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Ben Howe <141149032+bmhowe23@users.noreply.github.com>
Co-authored-by: Sachin Pisal <spisal@nvidia.com>
Co-authored-by: Bettina Heim <heimb@outlook.com>
Co-authored-by: cuda-quantum-bot <cuda-quantum-bot@users.noreply.github.com>
Signed-off-by: Anna Gringauze <agringauze@nvidia.com>
annagrin added a commit to annagrin/cuda-quantum that referenced this pull request Jun 17, 2025
This PR contains the full replacement of the existing spin_ops with the new general operators.
See the PR description on GitHub for a full list of all changes.

---------

Signed-off-by: Bettina Heim <heimb@outlook.com>
Signed-off-by: Ben Howe <bhowe@nvidia.com>
Signed-off-by: Anna Gringauze <agringauze@nvidia.com>
Co-authored-by: Ben Howe <bhowe@nvidia.com>
Co-authored-by: cuda-quantum-bot <cuda-quantum-bot@users.noreply.github.com>
Co-authored-by: Anna Gringauze <agringauze@nvidia.com>
Signed-off-by: Anna Gringauze <agringauze@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Change breaks backwards compatibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Distributive property violation in complex scalar-Spin_op operations

7 participants