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
f678a2fa
Commit
f678a2fa
authored
2 months ago
by
Richard Angersbach
Browse files
Options
Downloads
Patches
Plain Diff
Add unit test for checking border cases of freezing illegal usages of ReductionAssignments
parent
eb6e8c0f
No related branches found
No related tags found
1 merge request
!438
Reduction Support
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/nbackend/kernelcreation/test_freeze.py
+31
-0
31 additions, 0 deletions
tests/nbackend/kernelcreation/test_freeze.py
with
31 additions
and
0 deletions
tests/nbackend/kernelcreation/test_freeze.py
+
31
−
0
View file @
f678a2fa
...
...
@@ -66,6 +66,7 @@ from pystencils.sympyextensions.integer_functions import (
ceil_to_multiple
,
div_ceil
,
)
from
pystencils.sympyextensions.reduction
import
AddReductionAssignment
def
test_freeze_simple
():
...
...
@@ -494,6 +495,36 @@ def test_invalid_arrays():
_
=
freeze
(
symb_arr
)
def
test_invalid_reduction_assignments
():
x
=
fields
(
f
"
x: float64[1d]
"
)
w
=
TypedSymbol
(
"
w
"
,
"
float64
"
)
ctx
=
KernelCreationContext
()
freeze
=
FreezeExpressions
(
ctx
)
one
=
PsExpression
.
make
(
PsConstant
(
1
,
ctx
.
index_dtype
))
counter
=
ctx
.
get_symbol
(
"
ctr
"
,
ctx
.
index_dtype
)
ispace
=
FullIterationSpace
(
ctx
,
[
FullIterationSpace
.
Dimension
(
one
,
one
,
one
,
counter
)]
)
ctx
.
set_iteration_space
(
ispace
)
invalid_assignment
=
Assignment
(
w
,
-
1
*
x
.
center
())
reduction_assignment
=
AddReductionAssignment
(
w
,
3
*
x
.
center
())
# reduction symbol is used before ReductionAssignment
with
pytest
.
raises
(
FreezeError
):
_
=
[
freeze
(
asm
)
for
asm
in
[
invalid_assignment
,
reduction_assignment
]]
# reduction symbol is used after ReductionAssignment
with
pytest
.
raises
(
FreezeError
):
_
=
[
freeze
(
asm
)
for
asm
in
[
reduction_assignment
,
invalid_assignment
]]
# duplicate ReductionAssignment
with
pytest
.
raises
(
FreezeError
):
_
=
[
freeze
(
asm
)
for
asm
in
[
reduction_assignment
,
reduction_assignment
]]
def
test_memory_access
():
ctx
=
KernelCreationContext
()
freeze
=
FreezeExpressions
(
ctx
)
...
...
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