-
Notifications
You must be signed in to change notification settings - Fork 35
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
Daily rc sync to main #1095
Merged
Merged
Daily rc sync to main #1095
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
**Context:** `dev` label must be removed from the released code.
…time (#1047) **Context:** Recycling a device when a previous execution involves stateprep causes a crash. See #1044 **Description of the Change:** In `LightningSimulator`, `SetState` and `SetBasisState` now correctly query the DevQubits from the SimQubits in its qubit_manger's map. **Benefits:** We can now have multiple qnode functions involving stateprep in a workflow **Related GitHub Issues:** closes #1044 [sc-71894]
…acade (#1035) **Context:** This PR is to fix an issue that will be caused after merging the following PR: PennyLaneAI/pennylane#6046 The problem is that LegacyDeviceFacade will cause the Legacy Devices to use the Shots class instead of an integer which causes a crash in runtime. **Description of the Change:** This PR ensures that the any device that is an instance of the new device API uses the shots class to extract the total number of shots. **Related GitHub Issues:** [sc-70792] --------- Co-authored-by: Ahmed Darwish <exclass9.24@gmail.com>
…tives with dynamic one-shot (#1041) **Context:** When dealing with lowering of quantum operations, we need to extract the quantum function jaxpr by finding the function primitive in the circuit jaxpr which is assumed to be the first element in jaxpr.eqns. However, this assumption is wrong specifically when dynamic-one-shot is used. In this case the quantum function is wrapped in another funcion, therefore we get a crash trying to access the func primitive at jaxpr.eqns[0]. **Description of the Change:** implemented a function def _get_call_jaxpr(jaxpr) which iterates through equations in the jaxpr and finds the func primitive. **Benefits:** No specific assumption is made on the location of the quantum function in the jaxpr **Possible Drawbacks:** **Related GitHub Issues:** [sc-68756]
**Context:** PL recently changed error messages for bad stateprep/basisstate use cases (PennyLaneAI/pennylane#6021). We update our tests to agree with them. **Benefits:** Frontend tests `test_skip_initial_stateprep/TestPossibleErrors` can pass
…r.cpp/`SetState` (and `SetBasisState`) (#1061) **Context:** Eliminating an unnecessary in-between variable in runtime/LightningSimulator.cpp/setstate and setbasisstate, when getting dev_wires from sim_wires in the qubit manager's map. See PennyLaneAI/pennylane-lightning#869 (comment), and #1047 (comment) **Benefits:** One less object initialization
**Context:** When tracing `qml.BasisState`, the user can provide the state |abcd...> with the {abcd} values being either i32 or i64. The tracing should explicitly detect the type the user entered to avoid issues with `bitwise_and`. **Description of the Change:** `jax_tracer.py/trace_basis_state` now actively queries the integer type of the input state vector and adheres to the input type when doing `bitwise_and` with -1. **Benefits:** `qml.BasisState` works with arbitrary input interger types
**Context:** Specifying mcm_method="one-shot" when no MCMs are present raises an error when the return type is an iterable. **Description of the Change:** The crash happens in parse_native_mid_circuit_measurements which is a pennylane method and since in pennylane we exit the dynamic one-shot when no mcm is present, we are not expecting a no mcm situation which causes the crash. In this PR, we simply bypass the parse_native_mid_circuit_measurements function since there is no need to process mcm runs and only process the non mcm results **Benefits:** Dynamic-one-shot can work fine when no mcm is present and having multiple output. **Related GitHub Issues:** [sc-68752] --------- Co-authored-by: Raul Torres <138264735+rauletorresc@users.noreply.github.com> Co-authored-by: ringo-but-quantum <github-ringo-but-quantum@xanadu.ai> Co-authored-by: David Ittah <dime10@users.noreply.github.com>
Description of the Change: Split the changelog into separate file for each release, easier to read and help for the rc sync action.
**Context:** It is not entirely clear why, but some [functions return strings in their function annotations](https://github.com/python/cpython/blob/3.10/Lib/inspect.py#L2117-L2120). This is not enough to perform AOT compilation, so we should not do AOT compilation in these cases. **Description of the Change:** Limit AOT compilation to instances of type and jax.core.ShapedArray. **Benefits:** `expm` (and similar functions) can be called as `qjit(expm)` **Possible Drawbacks:** None **Related GitHub Issues:** #1077
Fixes #1072 which describes state prep gates not being differentiable with parameter-shift. The original definition of the `QuantumGate` interface only stipulated the existence and equal number of input and output qubits. With the addition of adjoint & control handling in the IR, the interface was extended to include adjoint & control operands. A new interface `QuantumOperation` is introduced to represent the original interface without requiring that the instructions can be inverted or controlled. The existing interface `QuantumGate` is kept around to represent unitary/invertible&controllable instructions. Tablegen base classes implementing the interface methods are also provided, the existing `Gate_Op` is renamed `UnitaryGate_Op` (implementing `QuantumGate`), and `Gate_Op` is now used to implement `QuantumOperation`. Also works around an additional issue of stemming from the use of `debug_assert` in the capture of the BasisState operation. [sc-72378]
PennyLaneAI/pennylane#6082 unearthed that in an attempt to be more lenient with user supplied types, Catalyst eagerly converts any type to the required float64 type for gate parameters, including when this results in a loss of data (like converting complex numbers to floats). This fixes the issue as well as providing some minor code cleanup, and fixing a long-standing issue of potentially undefined variables in the Python code. In order to help users with the proposed fix in [#pennylane/6082 ](PennyLaneAI/pennylane#6082) for the decomposition of `Exp`, the error message for complex gate parameters mentions potential non-unitary operators like the exponential with real exponent. [sc-71066]
**Context:** TestPyPI RC Wheels for Lightning have been published. This PR updates Catalyst dependencies according to those new Wheels.
Seems I have forgotten about this part 😅
…uggest using `catalyst.accelerate` (#1082) **Context:** `catalyst.qjit` occasionally gives wrong numerical results for functions in `jax.scipy.linalg` (`expm` and `lu`). This is a syndrome of the more serious underlying lapack symbol issue. See https://app.shortcut.com/xanaduai/story/70899/find-a-system-to-automatically-create-a-custom-call-library-from-the-one-in-jax #753 #1071 In the meantime, we raise a warning recommending users to use a callback with `catalyst.accelerate` to the underlying jax function directly. For example, instead of ``` @qjit def f(A): B = jax.scipy.linalg.expm(A) return B ``` , use ``` @qjit def f(A): B = catalyst.accelerate(jax.scipy.linalg.expm)(A) return B ``` **Description of the Change:** Detects `jax.scipy.linalg.expm, lu, lu_factor, lu_solve` calls in qjit and raise a warning suggesting the use of callback. **Benefits:** Avoid silently wrong numerical results when these `jax.scipy` functions are used inside `qjit`.
**Context:** Merge only after Lightning has been released! --------- Co-authored-by: Romain Moyard <rmoyard@gmail.com>
rmoyard
reviewed
Sep 4, 2024
rmoyard
reviewed
Sep 4, 2024
Hello. You may have forgotten to update the changelog!
|
rauletorresc
approved these changes
Sep 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Automatic sync from the release candidate to main during a feature freeze.