Skip to content

Conversation

@khalatepradnya
Copy link
Collaborator

No description provided.

github-actions bot pushed a commit that referenced this pull request Jan 22, 2026
@github-actions
Copy link

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
UnitAttr:$compiler_generated
OptionalAttr<UnitAttr>:$compiler_generated

Copy link
Collaborator

@schweitzpgi schweitzpgi Jan 22, 2026

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?

Copy link
Collaborator Author

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.

Comment on lines +103 to +105
auto alloc = builder.create<quake::AllocaOp>(loc);
alloc.setCompilerGeneratedAttr(builder.getUnitAttr());
allocatedAncillas.push_back(alloc);
Copy link
Collaborator

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.

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.

2 participants