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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions mlir/include/Quantum/IR/QuantumOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -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

}];

}
Expand Down Expand Up @@ -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? 😅

);

let assemblyFormat = [{
attr-dict ($results^ `:` type($results))?
attr-dict ($retvals ^ `:` type($retvals))?
}];

let builders = [
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Mitigation/Transforms/MitigationMethods/Zne.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

StringAttr kwargs = deviceInitOp.getKwargsAttr();

TypeRange originalTypes = op.getArgumentTypes();
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Quantum/Transforms/ConversionPatterns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

auto rtd_kwargs = op.getKwargs().str();

auto rtd_lib_gs = getGlobalString(loc, rewriter, rtd_lib,
Expand Down