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

Check that devices from the new API have wires set #664

Merged
merged 49 commits into from
Apr 24, 2024
Merged

Conversation

rmoyard
Copy link
Contributor

@rmoyard rmoyard commented Apr 18, 2024

Context:
The new device API support devices without wires being set, we do not.

Description of the Change:
Add an additional checks that the wires are set on the provided device.

@rmoyard rmoyard changed the base branch from main to lightning_new_api April 18, 2024 19:39
@rmoyard
Copy link
Contributor Author

rmoyard commented Apr 18, 2024

[sc-60563]

Base automatically changed from lightning_new_api to main April 22, 2024 13:38
@rmoyard rmoyard marked this pull request as ready for review April 22, 2024 13:44
@rmoyard rmoyard requested a review from dime10 April 22, 2024 13:46
Copy link
Collaborator

@dime10 dime10 left a comment

Choose a reason for hiding this comment

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

Thanks 👍

doc/changelog.md Outdated Show resolved Hide resolved
frontend/test/pytest/test_device_api.py Outdated Show resolved Hide resolved
Comment on lines +127 to +130
@pytest.mark.skipif(
not pathlib.Path(get_lib_path("runtime", "RUNTIME_LIB_DIR") + "/libdummy_device.so").is_file(),
reason="lib_dummydevice.so was not found.",
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like this test could run even without the dummy device being present, since the check happens right on initialization (before config and backend_info are used).

Copy link
Collaborator

Choose a reason for hiding this comment

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

We could also think about always building the dummy device with the runtime, that way we always have at least one device available for tests like this. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes let me do that in another PR, good idea 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I remember why it is like that, it is because we don't build it with wheels. So I think it works well because it was added for wheels testing. Do you want us to build it in the wheels and remove the skips?

Copy link
Collaborator

Choose a reason for hiding this comment

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

So I think we could totally have the dummy device be always present (in dev builds and wheels), but also for this particular test case I don't think you need to skip because the error we are testing for is raised before Catalyst realizes the device is not there (e.g. if config and backend_info were just None).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have config = device_get_toml_config(device) backend_info = extract_backend_info(device, config) in the test and cannot pass without the shared library.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes but my point is those values are not used and could just set them to None.

rmoyard and others added 3 commits April 22, 2024 11:09
@rmoyard rmoyard merged commit 6800dbb into main Apr 24, 2024
36 checks passed
@rmoyard rmoyard deleted the device_wires branch April 24, 2024 13:45
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.

None yet

2 participants