Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils
Commits
2fd2aa56
Commit
2fd2aa56
authored
4 months ago
by
Daniel Bauer
Committed by
Frederik Hennig
4 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix canonicalization of >2 loops with the same counter
parent
288af99f
No related branches found
No related tags found
1 merge request
!435
Fix canonicalization of >2 loops with the same counter
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/pystencils/backend/transformations/canonicalize_symbols.py
+2
-1
2 additions, 1 deletion
...ystencils/backend/transformations/canonicalize_symbols.py
tests/nbackend/transformations/test_canonicalize_symbols.py
+8
-5
8 additions, 5 deletions
tests/nbackend/transformations/test_canonicalize_symbols.py
with
10 additions
and
6 deletions
src/pystencils/backend/transformations/canonicalize_symbols.py
+
2
−
1
View file @
2fd2aa56
...
...
@@ -102,10 +102,11 @@ class CanonicalizeSymbols:
cc
.
mark_as_updated
(
lhs
.
symbol
)
case
PsLoop
(
ctr
,
_
,
_
,
_
,
_
):
decl_symb
=
ctr
.
symbol
for
c
in
node
.
children
[::
-
1
]:
self
.
visit
(
c
,
cc
)
cc
.
mark_as_updated
(
ctr
.
symbol
)
cc
.
end_lifespan
(
ctr
.
symb
ol
)
cc
.
end_lifespan
(
decl_
symb
)
case
PsConditional
(
cond
,
then
,
els
):
if
els
is
not
None
:
...
...
This diff is collapsed.
Click to expand it.
tests/nbackend/transformations/test_canonicalize_symbols.py
+
8
−
5
View file @
2fd2aa56
...
...
@@ -104,13 +104,16 @@ def test_loop_counters():
loops
=
factory
.
loops_from_ispace
(
ispace
,
body
)
loops_copy
=
loops
.
clone
()
loops_clone
=
loops
.
clone
()
loops_clone2
=
loops
.
clone
()
ast
=
PsBlock
([
loops
,
loops_c
opy
])
ast
=
PsBlock
([
loops
,
loops_c
lone
,
loops_clone2
])
ast
=
canonicalize
(
ast
)
assert
loops_copy
.
counter
.
symbol
.
name
==
"
ctr_0
"
assert
not
loops_copy
.
counter
.
symbol
.
get_dtype
().
const
assert
loops
.
counter
.
symbol
.
name
==
"
ctr_0__0
"
assert
loops_clone2
.
counter
.
symbol
.
name
==
"
ctr_0
"
assert
not
loops_clone2
.
counter
.
symbol
.
get_dtype
().
const
assert
loops_clone
.
counter
.
symbol
.
name
==
"
ctr_0__0
"
assert
not
loops_clone
.
counter
.
symbol
.
get_dtype
().
const
assert
loops
.
counter
.
symbol
.
name
==
"
ctr_0__1
"
assert
not
loops
.
counter
.
symbol
.
get_dtype
().
const
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment