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

Add get_current_shot to qsystem module #798

Closed
ss2165 opened this issue Feb 6, 2025 · 0 comments · Fixed by #806
Closed

Add get_current_shot to qsystem module #798

ss2165 opened this issue Feb 6, 2025 · 0 comments · Fixed by #806
Assignees
Labels
ci CI / devops

Comments

@ss2165
Copy link
Member

ss2165 commented Feb 6, 2025

def get_current_shot() -> int: ...

Lowers to tket2 extension: CQCL/tket2#767

@ss2165 ss2165 added the ci CI / devops label Feb 6, 2025
@qartik qartik self-assigned this Feb 6, 2025
qartik added a commit that referenced this issue Feb 12, 2025
qartik added a commit that referenced this issue Feb 17, 2025
qartik added a commit that referenced this issue Feb 21, 2025
github-merge-queue bot pushed a commit that referenced this issue Feb 21, 2025
Closes: #798

It's not clear to me whether the type in tket2-hseries for
`get_current_shot()` should be `usize` or `int(6)`. I used usize
initially but got the following runtime error during json validation
(`[] -> [tket2.qsystem.utils][usize] but stored signature was [] ->
[tket2.qsystem.utils][int(6)]`):
```py
tests/integration/conftest.py:64: in validate_impl
    validate_json(js)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hugr = '{"modules":[{"version":"live","nodes":[{"parent":0,"op":"Module"},{"parent":0,"op":"FuncDefn","name":"test","signatur..."i":1,"b":"A"}],"output":[{"t":"R","i":2,"b":"A"}],"runtime_reqs":["guppylang"]}},"binary":false,"lower_funcs":[]}}}]}'

    def validate_json(hugr: str):
        # Executes `cargo run -p validator -- validate -`
        # passing the hugr JSON as stdin
        p = subprocess.run(  # noqa: S603
            [validator, "validate", "-"],
            text=True,
            input=hugr,
            capture_output=True,
        )

        if p.returncode != 0:
>           raise RuntimeError(f"{p.stderr}")
E           RuntimeError: Error parsing package: Error resolving opaque operation: Conflicting signature: resolved GetCurrentShot in extension tket2.qsystem.utils to a concrete implementation which computed [] -> [tket2.qsystem.utils][usize] but stored signature was [] -> [tket2.qsystem.utils][int(6)]
```

I [changed the
signature](CQCL/tket2@a173d44)
to use `int(6)`, which then made the types compatible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci CI / devops
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants