Skip to content

Rename of operands/attributes to avoid xDSL reserved keywords #1700

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

erick-xanadu
Copy link
Contributor

Context:

Description of the Change:

Benefits:

Possible Drawbacks:

Related GitHub Issues:

@@ -619,11 +619,11 @@ def YieldOp : Quantum_Op<"yield", [Pure, ReturnLike, Terminator, ParentOneOf<["A
let summary = "Return results from quantum program regions";

let arguments = (ins
Variadic<QuregType>:$results
Variadic<QuregType>:$retvals
Copy link
Member

Choose a reason for hiding this comment

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

Wait, no one is using this? 😅

Copy link
Contributor

github-actions bot commented May 1, 2025

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md on your branch with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

Copy link
Contributor

@sengthai sengthai left a comment

Choose a reason for hiding this comment

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

Thanks Erick for PR. 🥳 I left some comments here

I feel that dev_name may seem a little unclear, but using the full term, such as device_name might make it more straightforward. I'm not sure whether that name includes any reserved keywords.
But no worries! If you like dev_name, it's absolutely fine to stick with that! 😅

@@ -85,12 +85,12 @@ def DeviceInitOp : Quantum_Op<"device"> {
let arguments = (ins
Optional<I64>:$shots,
StrAttr:$lib,
StrAttr:$name,
StrAttr:$dev_name,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
StrAttr:$dev_name,
StrAttr:$device_name,

StrAttr:$kwargs
);

let assemblyFormat = [{
(`shots` `(` $shots^ `)`)? `[` $lib `,` $name `,` $kwargs `]` attr-dict
(`shots` `(` $shots^ `)`)? `[` $lib `,` $dev_name `,` $kwargs `]` attr-dict
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
(`shots` `(` $shots^ `)`)? `[` $lib `,` $dev_name `,` $kwargs `]` attr-dict
(`shots` `(` $shots^ `)`)? `[` $lib `,` $device_name `,` $kwargs `]` attr-dict

@@ -391,7 +391,7 @@ FlatSymbolRefAttr ZneLowering::getOrInsertFoldedCircuit(Location loc, PatternRew

Operation *shots = deviceInitOp.getShots().getDefiningOp();
StringAttr lib = deviceInitOp.getLibAttr();
StringAttr name = deviceInitOp.getNameAttr();
StringAttr name = deviceInitOp.getDevNameAttr();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
StringAttr name = deviceInitOp.getDevNameAttr();
StringAttr name = deviceInitOp.getDeviceNameAttr();

@@ -196,7 +196,7 @@ struct DeviceInitOpPattern : public OpConversionPattern<DeviceInitOp> {
catalyst::ensureFunctionDeclaration(rewriter, op, qirName, qirSignature);

auto rtd_lib = op.getLib().str();
auto rtd_name = op.getName().str();
auto rtd_name = op.getDevName().str();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
auto rtd_name = op.getDevName().str();
auto rtd_name = op.getDeviceName().str();

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.

3 participants