Repository navigation
Conversation
|
Hi @ddri and thank you for opening this pull request! And for signing the CLA :). Due to the sheer amount of issues / pull requests you opened over the weekend (18 across qref and bartiq, and another 15 issues in psiqdk), it will take us some time to dedicate manpower to reviewing and approving these. You will be glad to know it has sparked an internal discussion on how to handle AI-assisted contributions. While I'm sure it was not your intention, we are wary of being "AI DDoS'd" (see e.g. https://arxiv.org/html/2607.04003v1). Overall your PRs cover a small number of lines which we greatly appreciate, as it makes it easier to review. For bartiq and qref specifically, I would really appreciate if you could update the PR descriptions to include a "minimal working example" of the bug / edge case in question; this will vastly speed up reviewing. We're in the works of updating the PR template now to specifically request a MWE. |
Brendan-Reid1991
left a comment
There was a problem hiding this comment.
Only some minor changes requested, and some clarification on inline imports and a test
| replaced_symbols = {old for old, _ in restricted_replacements} | ||
| simultaneous = len(restricted_replacements) > 1 and any( | ||
| replaced_symbols.intersection(sympy.sympify(new).free_symbols) for _, new in restricted_replacements | ||
| ) | ||
| expr = expr.subs(restricted_replacements, simultaneous=simultaneous) |
There was a problem hiding this comment.
From my own local testing, I can see that having simultaneous=True always is painfully slow, so this guard is justified. My only remaining concern is on the simpyification of new being done twice: once in simultaneous and again in subs. I think this is only a minor optimisation, but if we can avoid repeating work we should.
|
|
||
|
|
||
| def test_substitution_preserves_bound_sequence_iterators(): | ||
| from sympy import Sum |
There was a problem hiding this comment.
Is there a good reason to do these imports inline rather than at the top of the file?
| assert sympy_backend.substitute(expression, {"i": 7}) == 7 * Sum(i, (i, 1, n)) | ||
|
|
||
|
|
||
| def test_simultaneous_substitution_accepts_string_values(): |
There was a problem hiding this comment.
Not sure this test is justified, surely another test is capturing that string input is properly sympyified?
This is the catch-22 we're struggling with too. We experienced this first-hand as part of Unitary Foundation's recent hackathon, where we got slammed with PRs and drive-by AI issues. It actually forced us to tighten our release cycles and length the "open source to partners first" so we catch as much as possible. No rush or pressure to review or process any of these. We're happy to maintain local forks for our users for anything that they are exploring, but the benefit if you do, is that their explorations are because they are doing research towards papers or eventual commercial utility. There's a few FTQC projects that they are evaluating, and we serve whatever they need. The challenge for Marqov, is that we are becoming the open source standard for quantum-classical orchestration, and every user of our partner release cycle (supercomputing centres and larger enterprises mostly) has pulled in other projects in the open stack. This puts pressure on us to review them, to make sure they are secure and compatible, and build the executors and integrations needed. This is the same challenge a bunch of us had working at Red Hat, but there we had entire teams, while this is handfuls of humans. In a few cases we've ended up as a development partner, where it's made sense to make this a commercial relationship given the expertise of the team, but we can't scale that too far. We're a small team and there's so few people on the planet right now with quantum computing and enterprise experience. I've recently joined Unitary Foundation as a Fellow, and am trying to solve this on both sides of commercial/community before we all get flooded. So the extremes of the dilemma are, do we fix all the issues in open sources projects and maintain our own forks, or do we drop a heavy round of PRs/Issues. Or is there a middle-ground we can do as vendors prior to releases? Lots of questions, happy to chat off-list (this will be a dinner conversation at SC26 as we're all struggling with it). |
Hi team, this issue is part of a batch from our review of bartiq at Marqov. We routinely review quantum computing tools that our community requests or that we’re exploring for integration with the Marqov SDK and Platform. We’re sharing these findings, reproductions, and proposed fixes in the hope they’re useful. There’s no expectation of an immediate response, and we can maintain any patches we need in our own fork while using the software.
Description
Parameter links can silently overwrite symbols inserted from a parent scope. With child cost
x + 2*yand parent linksy -> child.x,x -> child.y, compilation returns3*yinstead of2*x + y.Substitute linked symbols simultaneously when their replacement values overlap the symbols being replaced, so one linked parameter cannot rewrite another parameter's inserted value. Regression tests cover crossed links in both compilation modes, mapping-order independence, and preservation of bound sequence iterators even when the same symbol is also free outside the sum. Independent replacements retain the existing faster path. This addresses replacements rewriting values inserted by another linked parameter; substitution into a sum can still capture a replacement symbol that shares the name of its bound iterator, a pre-existing limitation that needs a separate fix.
Validation:
MYPYPATH=src poetry run mypy src --install-types --non-interactive: passes with the lockfile's mypy 1.16.1.poetry run pre-commit run -a: passes.e1aa912; independently reran the full suite and core-only symbolic/compiler tests.Please verify that you have completed the following steps