-
Notifications
You must be signed in to change notification settings - Fork 323
Introduce a new attribute to track qubits generated by compiler passes #3777
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Pradnya Khalate <[email protected]>
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
| let arguments = (ins | ||
| Optional<AnySignlessInteger>:$size | ||
| Optional<AnySignlessInteger>:$size, | ||
| UnitAttr:$compiler_generated |
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.
| UnitAttr:$compiler_generated | |
| OptionalAttr<UnitAttr>:$compiler_generated |
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.
If you add this here, you will have to add it to the syntax, add it to the roundtrip test, etc.
Note: you can add attributes to Ops without adding them formally. Every Op has an generic attribute dictionary.
Also note: this is probably of really limited use. The compiler can and will fuse quake.alloca Ops, which will almost certainly make this annotation highly suspect at best if not lost altogether.
Can you explain the actual application here? Is this to paper over the issue of throwing away named measurement registers?
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.
Thank you for the feedback! I was seeking direction check on this... The intention was to track compiler generated qubits and eventually filer them out.
Currently if a kernel does not use named sub-registers, the final result may have compiler generated ancilla qubits, for example, see this.
| auto alloc = builder.create<quake::AllocaOp>(loc); | ||
| alloc.setCompilerGeneratedAttr(builder.getUnitAttr()); | ||
| allocatedAncillas.push_back(alloc); |
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.
Yeah, if you add it formally, we'll need the whole 9 yards. Including a builder, etc.
No description provided.