-
Notifications
You must be signed in to change notification settings - Fork 47
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
fix wasm issues #1691
fix wasm issues #1691
Conversation
8879c3e
to
db9cdd6
Compare
tket/test/src/test_wasm.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the appending tests here involve appending to an empty circuit. Could we add some tests appending to a circuit that already contains WASM wires?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added one, see d9e6dac
There is also one in the python tests already.
@@ -413,6 +413,9 @@ void def_circuit(py::class_<Circuit, std::shared_ptr<Circuit>> &pyCircuit) { | |||
.def_property_readonly( | |||
"n_gates", &Circuit::n_gates, | |||
":return: the number of gates in the Circuit") | |||
.def_property_readonly( | |||
"wasm_uid", &Circuit::get_wasm_file_uid, | |||
":return: the wasm uid of the first wasmop found in the circuit") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can a circuit contain more than one WASM UID? If so it would be preferable to return the full set here. If not, we can be explicit about this in the doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should only be one
c035e24
to
ac1eb5a
Compare
ac1eb5a
to
14b5146
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one suggestion, making the wasm ID an optional string (None
if no WASM ID).
pytket/tests/classical_test.py
Outdated
|
||
assert c.depth() == 0 | ||
with pytest.raises(ValueError): | ||
c.wasm_uid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be a bit nicer if this returned None
when there is no WASM wire, rather than throw an exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in de111a1
@cqc-alec Is it expected that some changes to the stubs do not make the check fail? As you can see in the last commit, there have been some changes, that did not show up on the CI? |
std::optional<std::string> result; | ||
try { | ||
result = circ.get_wasm_file_uid(); | ||
} catch (const std::exception &) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we propagate the change to the C++, i.e. male get_wasm_file_uid()
return a std::optional<std::string>
? I think that's better than a catch-all exception handler, and could actually make the C++ code nicer too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in 00c3b30
pytket/tests/zx_diagram_test.py
Outdated
@@ -12,7 +12,7 @@ | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
|
|||
from math import isclose, pow | |||
from math import isclose, pow # noqa: A004 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest just removing the pow
import and using the built-in one; as used in this file there is no difference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in the merge commit
Not sure what you mean here. In the last commit both the binder code and the stubs changed, so I would not expect the check fail? |
""" | ||
:return: the wasm uid of the first wasmop found in the circuit | ||
:return: the unique wasm uid of the circuit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cqc-alec this line was already changed in the other commit, but the stubs check has not shown this difference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly it should fail if they don't match, but I'm struggling to see where there is/was a mismatch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment was changed in 14b5146, but the CI check has not show this difference.
pytket/docs/changelog.rst
Outdated
@@ -1,13 +1,22 @@ | |||
Changelog | |||
========= | |||
|
|||
Unreleased | |||
---------- | |||
1.36.0 (unreleased) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer to keep this as "Unreleased" only. We don't know if it will be 1.36.0 or 1.35.1 ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in 37f0f1b
Co-authored-by: Alec Edgington <[email protected]>
Co-authored-by: Alec Edgington <[email protected]>
Co-authored-by: Alec Edgington <[email protected]>
4c2a42f
to
218ccd5
Compare
Description
Fixes:
#1641
#1504
#1546
Checklist