-
Notifications
You must be signed in to change notification settings - Fork 57
Apply instrumentation to each pass within NamedSequenceOp #1978
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
rniczh
wants to merge
15
commits into
main
Choose a base branch
from
rniczh/apply-instrumentation-to-each-pass-within-NamedSequenceOp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f56fa68
Apply instrumentation to each pass within NamedSequenceOp
rniczh 70916bb
Fix missing ;
rniczh e1741e7
Update mlir/lib/Catalyst/Transforms/ApplyTransformSequencePass.cpp
rniczh f4ee67e
Update mlir/lib/Catalyst/Transforms/ApplyTransformSequencePass.cpp
rniczh 53a23e4
Remove unncessary include
rniczh a6f5aa5
Formatting
rniczh 8141c9b
Update changelog
rniczh d54d67b
Add ref link to NamedSequenceOp::apply
rniczh 41a78d6
Add test
rniczh fdc37e1
Add assertion
rniczh 5a2958c
Update mlir/lib/Catalyst/Transforms/ApplyTransformSequencePass.cpp
rniczh 0f0e712
Add comment
rniczh 5f13e4b
Update reference link of the upstream code
rniczh 2d734ca
Update to permalink
rniczh 1036566
Remove mlir:: prefix
rniczh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
mlir/test/Catalyst/ApplyTransformSequenceInstrumentationTest.mlir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2025 Xanadu Quantum Technologies Inc. | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
|
||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// RUN: quantum-opt %s --apply-transform-sequence --mlir-print-ir-after-all --split-input-file --verify-diagnostics 2>&1 | FileCheck %s --check-prefix=CHECK-INSTRUMENTATION | ||
|
||
// Instrumentation should show individual transform operations as subpasses | ||
// CHECK-INSTRUMENTATION: transform_cse | ||
// CHECK-INSTRUMENTATION: transform_remove-chained-self-inverse | ||
// CHECK-INSTRUMENTATION: ApplyTransformSequencePass | ||
|
||
module @workflow { | ||
|
||
module attributes {transform.with_named_sequence} { | ||
transform.named_sequence @__transform_main(%arg0: !transform.op<"builtin.module">) { | ||
%0 = transform.apply_registered_pass "cse" to %arg0 : (!transform.op<"builtin.module">) -> !transform.op<"builtin.module"> | ||
%1 = transform.apply_registered_pass "remove-chained-self-inverse" to %0 : (!transform.op<"builtin.module">) -> !transform.op<"builtin.module"> | ||
transform.yield | ||
} | ||
} | ||
|
||
func.func private @f(%arg0: tensor<f64>) -> !quantum.bit { | ||
%c_0 = stablehlo.constant dense<0> : tensor<i64> | ||
%extracted = tensor.extract %c_0[] : tensor<i64> | ||
%0 = quantum.alloc( 1) : !quantum.reg | ||
%1 = quantum.extract %0[%extracted] : !quantum.reg -> !quantum.bit | ||
%out_qubits = quantum.custom "Hadamard"() %1 : !quantum.bit | ||
%out_qubits_1 = quantum.custom "Hadamard"() %out_qubits : !quantum.bit | ||
return %out_qubits_1 : !quantum.bit | ||
} | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.