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

Daily rc sync to main #1447

Merged
merged 21 commits into from
Jan 13, 2025
Merged

Daily rc sync to main #1447

merged 21 commits into from
Jan 13, 2025

Conversation

github-actions[bot]
Copy link
Contributor

Automatic sync from the release candidate to main during a feature freeze.

erick-xanadu and others added 15 commits January 6, 2025 14:46
**Context:**

![Before](https://github.com/user-attachments/assets/3ec337c1-a898-4abd-a9c6-990d8767679c)

**Description of the Change:**


![After](https://github.com/user-attachments/assets/a07c6a1c-f98d-4b00-b9aa-9afd0a893673)

**Benefits:** No floating `}` and well formatted contents.

**Possible Drawbacks:** Do we also want to show the libraries we use?

**Related GitHub Issues:**
**Context:** Fix some typos and phrasing in the docs
…e file naming (#1405)

**Context:**
This PR fixes some small bugs or lack of documentation for catalyst-cli
gathered from @dime10's feedbacks.

- The `--help` flag seems to dump a lot of unrelated options which makes
it difficult to navigate through catalyst options.

- The possible stages for the --checkpoint-stage option are not
mentioned in the documentation

- When using `--checkpoint-stage`, `--save-ir-after-each=pipeline` no
longer works.

- The output from --save-ir-after-each=pass produces one output for each
function when dealing with a function pass which results in a large
number of outputs and one has to find the function of interest randomly.

**Description of the Change:**

- `--help` option now prints all the catalyst-cli specific options first
before jumping into mlir-opt options

- Added more details to documentation

- Fixed the bug for `save-ir-after-each` and `save-ir-after-each`
coexisting together.

- Output from `save-ir-after-each` now appends the name of the function
to the file name making it easier to identify the desired output.

**Benefits:**
easier experience for catalyst-cli user

**Possible Drawbacks:**

**Related GitHub Issues:**

---------

Co-authored-by: Joey Carter <[email protected]>
Co-authored-by: erick-xanadu <[email protected]>
Co-authored-by: David Ittah <[email protected]>
…ment (#1404)

**Context:** The documentation for MLIR plugins did not state anything
about `entry_points` nor relevant functions when loading MLIR plugins
from python. Also changed the type of the `pass_pipeline` kwarg. Instead
of it being a tuple of Passes, it is now a list of Passes. This is nicer
for developers.

**Description of the Change:** The `pass_pipeline` keyword argument is
now a list instead of a tuple. This list is converted into a tuple at
the moment the qnode primitive is bound.

Added documentation for MLIR plugins.

---------

Co-authored-by: Isaac De Vlugt <[email protected]>
**Context:** 
PR #1387, adds support for static parameters in customOp. However
support for GlobalPhase and MultiRZ gates are missing.

**Description of the Change:**
This PR adds support for the missing two gates. We unified the way
`GlobalPhase` and `MultiRZ` are treated in the frontend. right now,
GlobalPase has its own primitive (`qphase_p`) however `MultiRZ` is
binded through the `qinst_p` primitive. `qphase_p` is now removed from
frontend and binded through `qints_p` similar to MultiRZ.
If a `MultiRZ` or `GlobalPhase` gate has static parameters parameters, a
`staticCustomOp` is created which will be lowered to the respective gate
in static_custom_lowering pass.

**Benefits:**
removed inconsistency in the definition of odd custom gates (MultiRZ and
GlobalPhase)
static circuit IR now supports more parameterized gates.

**Possible Drawbacks:**

**Related GitHub Issues:**

---------

Co-authored-by: ringo-but-quantum <[email protected]>
Co-authored-by: paul0403 <[email protected]>
Co-authored-by: Ritu Thombre <[email protected]>
Co-authored-by: Ritu Thombre <[email protected]>
Co-authored-by: lillian542 <[email protected]>
Co-authored-by: Joey Carter <[email protected]>
Co-authored-by: Raul Torres <[email protected]>
Co-authored-by: Isaac De Vlugt <[email protected]>
Co-authored-by: erick-xanadu <[email protected]>
**Context:** The `apply_pass` function from the frontend is capable of
scheduling any MLIR pass from the frontend for a specific qnode.
However, in order for the pass to succeed in its compilation, it must
allow itself to be scheduled to transform a module.

**Description of the Change:** There is another branch that I worked on
where I moved the bulk of the transformation to Patterns; however, the
pattern applicators that are upstream in MLIR do not support running a
single iteration of the worklist. I would like at some point to add a
custom pattern applicator that doesn't fold and only does a single pass
through the worklist (or take a variable). The passes as written
represent a single iteration through the worklist. Running a single
iteration through the worklist may not yield all full optimizations, but
that's how it is currently coded. I think this is acceptable as we don't
yet do a cost benefit analysis for any transformation.

**Benefits:** Can write the following:

```python
import jax
import pennylane as qml

import catalyst


@qml.qjit(keep_intermediate=True)
@catalyst.passes.apply_pass("disentangle-CNOT")
@qml.qnode(qml.device("lightning.qubit", wires=2))
def foo():
    qml.Hadamard(0)
    qml.Hadamard(0)
    qml.Hadamard(1)
    qml.Hadamard(1)
    qml.CNOT(wires=[0, 1])
    return qml.state()


foo()
print(foo.mlir)
```
**Context:** Some invalid Python code formatting slipped into the
codebase (on the `v0.10.0-rc` branch). The offending file is
`frontend/test/pytest/test_mlir_plugin_interface.py`.

**Description of the Change:** Run `make format` to fix formatting
warnings.
**Context:** The `oqd_database_managers` Python module is no longer used
since being superseded by the C++ implementation introduced in #1372.

**Description of the Change:** Removes the `oqd_database_managers`
module.
**Context:** Needed to rebase refactoring branch to test.

**Description of the Change:**
* Adds documentation to Pass, PassPlugin
* Uses values from Pass's options as options in the
ApplyRegisteredPassOps

**Benefits:** Documentation, passes can have options.

---------

Co-authored-by: David Ittah <[email protected]>
Renames the Catalyst CLI command name from `catalyst-cli` to `catalyst`,
and also installs the tool in the active Python environment when
installing from wheel or from non-editable source.
**Context:**
Correct a minor error in the qjit docstring. The parameter `verbosity`
was mistakenly used instead of `verbose`.

---------

Co-authored-by: Joey Carter <[email protected]>
During the current release cycle we discovered that having exactly 2700
test items distributed on
exactly 3 cores (e.g. GH M1 runner) produces a lot of test failures.
Randomizing the test order
(pytest-randomly) fixes the issue for now.
@github-actions github-actions bot requested review from dime10 and joeycarter January 13, 2025 03:02
Copy link
Contributor Author

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md on your branch with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

This should (hopefully) allow the full frontend test suite to pass.
This test should be uncommented once the underlying issue is fixed.
@joeycarter joeycarter added the urgent Mark a pull request as high priority label Jan 13, 2025
Uncomment out test_globalphase, comment out test_counts
Copy link

codecov bot commented Jan 13, 2025

Codecov Report

Attention: Patch coverage is 78.40000% with 27 lines in your changes missing coverage. Please review.

Project coverage is 96.73%. Comparing base (05e044f) to head (e1d2e9f).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
frontend/catalyst/passes/pass_api.py 69.66% 23 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1447      +/-   ##
==========================================
+ Coverage   96.67%   96.73%   +0.06%     
==========================================
  Files          75       76       +1     
  Lines        8229     8171      -58     
  Branches      859      846      -13     
==========================================
- Hits         7955     7904      -51     
+ Misses        221      213       -8     
- Partials       53       54       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joeycarter joeycarter merged commit 0ef8e42 into main Jan 13, 2025
40 of 42 checks passed
@joeycarter joeycarter deleted the rc_2025-01-13-03-02-42 branch January 13, 2025 19:24
@joeycarter joeycarter removed the urgent Mark a pull request as high priority label Jan 13, 2025
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.

6 participants