-
Notifications
You must be signed in to change notification settings - Fork 57
Issue #1714: Add variable names to the IR #2054
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
rturrado
wants to merge
39
commits into
PennyLaneAI:main
Choose a base branch
from
rturrado:issue_1714_add_variable_names_to_the_ir
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.
+239
−24
Open
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
9972987
Add catalyst/mlir/test/PrintUseNameLocAsPrefix.mlir file.
rturrado 55a84c2
Update PrintUseNameLocAsPrefix.mlir.
rturrado 0bce28e
generate_ir: pass arg_names to lower_jaxpr_to_mlir.
rturrado c0f02a5
[no ci] bump nightly version
5e58c62
[no ci] bump nightly version
f20430c
Merge branch 'main' into issue_1714_add_variable_names_to_the_ir
rturrado 9e0a996
[no ci] bump nightly version
03d0a2b
[no ci] bump nightly version
f7f7a7e
[no ci] bump nightly version
31ddb88
Add argument names as name locations in the frontend, and add use the…
rturrado 17b1cfd
Fix test_option_use_nameloc.py.
rturrado 726f094
Fix CodeFactor checks.
rturrado 0cbe469
Merge branch 'PennyLaneAI:main' into main
rturrado 6ee021e
Merge remote-tracking branch 'origin' into issue_1714_add_variable_na…
rturrado daf2c99
[no ci] bump nightly version
9df3bf6
[no ci] bump nightly version
a7ebdd0
[no ci] bump nightly version
e139daf
[no ci] bump nightly version
e6b3d4f
[no ci] bump nightly version
126e626
[no ci] bump nightly version
9c72207
[no ci] bump nightly version
8e3cc1a
[no ci] bump nightly version
a58843d
[no ci] bump nightly version
6da9eb1
[no ci] bump nightly version
58b79b0
Merge remote-tracking branch 'upstream/main'
rturrado e81eb00
Update to origin/main.
rturrado 67df639
Run black.
rturrado 7748331
Merge branch 'main' into issue_1714_add_variable_names_to_the_ir
rturrado 9634bc9
Fix code coverage warning about uncovered code in mlir_opt
rturrado 8af233e
[no ci] bump nightly version
646039b
[no ci] bump nightly version
c0d1e97
[no ci] bump nightly version
4251be5
[no ci] bump nightly version
a4519e1
[no ci] bump nightly version
9218936
[no ci] bump nightly version
d8c042f
[no ci] bump nightly version
f740e4c
Merge branch 'main' into issue_1714_add_variable_names_to_the_ir
rturrado 54649ee
Address David Ittah's review comments
rturrado 06984ba
Remove PrintUseNameLocAsPrefix.mlir
rturrado 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ | |
Version number (major.minor.patch[-label]) | ||
""" | ||
|
||
__version__ = "0.14.0-dev3" | ||
__version__ = "0.14.0-dev10" |
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
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
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
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,54 @@ | ||
# 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. | ||
|
||
"""Unit tests for use name location option.""" | ||
|
||
# RUN: %PYTHON %s | FileCheck %s | ||
|
||
from utils import print_mlir, print_mlir_opt | ||
|
||
from catalyst import qjit | ||
|
||
|
||
# CHECK-LABEL: @jit_f | ||
@qjit(use_nameloc=True) | ||
def f(x: float, y: float): | ||
"""Check that MLIR module contains name location information, and MLIR code uses that name | ||
location information. | ||
""" | ||
# CHECK: %x: tensor<f64>, %y: tensor<f64> | ||
return x * y | ||
|
||
|
||
assert str(f.mlir_module.body.operations[0].arguments[0].location) == 'loc("x")' | ||
assert str(f.mlir_module.body.operations[0].arguments[1].location) == 'loc("y")' | ||
|
||
print_mlir(f, 0.3, 0.4) | ||
|
||
|
||
# CHECK-LABEL: @jit_f_opt | ||
@qjit(use_nameloc=True) | ||
def f_opt(x: float, y: float): | ||
"""Check that MLIR module contains name location information, and MLIR code uses that name | ||
location information. | ||
Same test as before, but now we exercise mlir_opt property. | ||
""" | ||
# CHECK: %x: tensor<f64>, %y: tensor<f64> | ||
return x * y | ||
|
||
|
||
assert str(f_opt.mlir_module.body.operations[0].arguments[0].location) == 'loc("x")' | ||
assert str(f_opt.mlir_module.body.operations[0].arguments[1].location) == 'loc("y")' | ||
|
||
print_mlir_opt(f_opt, 0.3, 0.4) |
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
Oops, something went wrong.
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.