microsoft / microsoft/qdk

`@SimulatableIntrinsic` not treated as intrinsic for circuit diagram

Open
#1,904 0 comments 0 reactions 0 assignees View on GitHub
bug design needed low-priority
Dominant language
Rust
Stars
1k
Forks
212
Avg merge
3d 8h
Merged PRs (30d)
65

Description

A normal intrinsic like this:

image

will fail to run but show a circuit diagram as I expected. Meanwhile, a simulatable intrinsic like this:

image

will successfully simulate but shows the simulated gates in the diagram rather than the intrinsic.

I'm not sure if there is a reasonable way to fix this, as the point of simulatable intrinsics is to execute the body in simulation, and the backend chaining used for circuit diagrams is itself just simulation. On some level, this asks the question: is the circuit diagram meant to show what is run in simulation or to visualize what would be produced in QIR codegen? If the former, then this behavior is expected and not really a bug. If the latter, then we'd need to find a way to have the chaining backend differentiate between normal simulation and simulatable intrinsic, which the infrastructure doesn't really accommodate.

Contributor guide

Open the contributing guide

Research direction

The issue names normal and simulatable intrinsics, the chaining backend, circuit diagrams, and QIR codegen, but no files or tests. Start by tracing how the chaining backend handles @SimulatableIntrinsic during diagram generation, then establish whether diagrams should represent simulation or QIR output before defining the change.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.