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
f71ce708
Commit
f71ce708
authored
5 months ago
by
Richard Angersbach
Browse files
Options
Downloads
Patches
Plain Diff
Enforce usage of typed symbols for reductions
parent
c73deaf6
No related branches found
No related tags found
1 merge request
!438
Reduction Support
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/pystencils/backend/kernelcreation/freeze.py
+3
-1
3 additions, 1 deletion
src/pystencils/backend/kernelcreation/freeze.py
tests/kernelcreation/test_reduction.py
+1
-1
1 addition, 1 deletion
tests/kernelcreation/test_reduction.py
with
4 additions
and
2 deletions
src/pystencils/backend/kernelcreation/freeze.py
+
3
−
1
View file @
f71ce708
...
@@ -176,6 +176,8 @@ class FreezeExpressions:
...
@@ -176,6 +176,8 @@ class FreezeExpressions:
return
PsAssignment
(
lhs
,
binop_str_to_expr
(
expr
.
op
[
0
],
lhs
.
clone
(),
rhs
))
return
PsAssignment
(
lhs
,
binop_str_to_expr
(
expr
.
op
[
0
],
lhs
.
clone
(),
rhs
))
def
map_ReducedAssignment
(
self
,
expr
:
ReducedAssignment
):
def
map_ReducedAssignment
(
self
,
expr
:
ReducedAssignment
):
assert
isinstance
(
expr
.
lhs
,
TypedSymbol
)
lhs
=
self
.
visit
(
expr
.
lhs
)
lhs
=
self
.
visit
(
expr
.
lhs
)
rhs
=
self
.
visit
(
expr
.
rhs
)
rhs
=
self
.
visit
(
expr
.
rhs
)
...
@@ -183,7 +185,7 @@ class FreezeExpressions:
...
@@ -183,7 +185,7 @@ class FreezeExpressions:
assert
isinstance
(
lhs
,
PsSymbolExpr
)
assert
isinstance
(
lhs
,
PsSymbolExpr
)
orig_lhs_symb
=
lhs
.
symbol
orig_lhs_symb
=
lhs
.
symbol
dtype
=
r
hs
.
dtype
# TODO: kernel with (implicit) up/downcasts?
dtype
=
l
hs
.
dtype
assert
isinstance
(
dtype
,
PsNumericType
)
assert
isinstance
(
dtype
,
PsNumericType
)
...
...
This diff is collapsed.
Click to expand it.
tests/kernelcreation/test_reduction.py
+
1
−
1
View file @
f71ce708
...
@@ -24,7 +24,7 @@ def test_reduction(dtype, op):
...
@@ -24,7 +24,7 @@ def test_reduction(dtype, op):
gpu_avail
=
False
gpu_avail
=
False
x
=
ps
.
fields
(
f
'
x:
{
dtype
}
[1d]
'
)
x
=
ps
.
fields
(
f
'
x:
{
dtype
}
[1d]
'
)
w
=
sp
.
Symbol
(
"
w
"
)
w
=
ps
.
Typed
Symbol
(
"
w
"
,
dtype
)
# kernel with reduction assignment
# kernel with reduction assignment
...
...
This diff is collapsed.
Click to expand it.
Frederik Hennig
@da15siwa
mentioned in commit
4e688b86
·
2 months ago
mentioned in commit
4e688b86
mentioned in commit 4e688b867339c90a6fba3ad12c383d1e59211ed9
Toggle commit list
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