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
2d108a2e
Commit
2d108a2e
authored
4 years ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
Added hardware specific vectorization tests
parent
063c10d0
No related branches found
No related tags found
1 merge request
!192
FIX pystencils install bug
Pipeline
#28469
passed
4 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pystencils_tests/test_vectorization.py
+1
-6
1 addition, 6 deletions
pystencils_tests/test_vectorization.py
pystencils_tests/test_vectorization_specific.py
+35
-0
35 additions, 0 deletions
pystencils_tests/test_vectorization_specific.py
with
36 additions
and
6 deletions
pystencils_tests/test_vectorization.py
+
1
−
6
View file @
2d108a2e
...
...
@@ -6,9 +6,6 @@ from pystencils.backends.simd_instruction_sets import get_supported_instruction_
from
pystencils.cpu.vectorization
import
vectorize
from
pystencils.fast_approximation
import
insert_fast_sqrts
,
insert_fast_divisions
from
pystencils.transformations
import
replace_inner_stride_with_one
from
pystencils.backends.simd_instruction_sets
import
get_supported_instruction_sets
supported_instruction_sets
=
get_supported_instruction_sets
()
if
get_supported_instruction_sets
()
else
[]
def
test_vector_type_propagation
():
...
...
@@ -30,8 +27,6 @@ def test_vector_type_propagation():
np
.
testing
.
assert_equal
(
dst
[
1
:
-
1
,
1
:
-
1
],
2
*
10.0
+
3
)
@pytest.mark.skipif
(
'
avx
'
in
supported_instruction_sets
,
reason
=
"
This test case is specifically for AVX architectures
"
)
def
test_inplace_update
():
shape
=
(
9
,
9
,
3
)
arr
=
np
.
ones
(
shape
,
order
=
'
f
'
)
...
...
@@ -47,7 +42,7 @@ def test_inplace_update():
f1
@=
2
*
s
.
tmp0
f2
@=
2
*
s
.
tmp0
ast
=
ps
.
create_kernel
(
update_rule
,
cpu_vectorize_info
=
{
'
instruction_set
'
:
'
avx
'
}
)
ast
=
ps
.
create_kernel
(
update_rule
,
cpu_vectorize_info
=
True
)
kernel
=
ast
.
compile
()
kernel
(
f
=
arr
)
np
.
testing
.
assert_equal
(
arr
,
2
)
...
...
This diff is collapsed.
Click to expand it.
pystencils_tests/test_vectorization_specific.py
0 → 100644
+
35
−
0
View file @
2d108a2e
import
pytest
import
numpy
as
np
import
sympy
as
sp
import
pystencils
as
ps
from
pystencils.backends.simd_instruction_sets
import
get_supported_instruction_sets
from
pystencils.cpu.vectorization
import
vectorize
from
pystencils.fast_approximation
import
insert_fast_sqrts
,
insert_fast_divisions
from
pystencils.transformations
import
replace_inner_stride_with_one
from
pystencils.backends.simd_instruction_sets
import
get_supported_instruction_sets
supported_instruction_sets
=
get_supported_instruction_sets
()
if
get_supported_instruction_sets
()
else
[]
@pytest.mark.parametrize
(
'
instruction_set
'
,
supported_instruction_sets
)
def
test_vectorisation_varying_arch
(
instruction_set
):
shape
=
(
9
,
9
,
3
)
arr
=
np
.
ones
(
shape
,
order
=
'
f
'
)
@ps.kernel
def
update_rule
(
s
):
f
=
ps
.
fields
(
"
f(3) : [2D]
"
,
f
=
arr
)
s
.
tmp0
@=
f
(
0
)
s
.
tmp1
@=
f
(
1
)
s
.
tmp2
@=
f
(
2
)
f0
,
f1
,
f2
=
f
(
0
),
f
(
1
),
f
(
2
)
f0
@=
2
*
s
.
tmp0
f1
@=
2
*
s
.
tmp0
f2
@=
2
*
s
.
tmp0
ast
=
ps
.
create_kernel
(
update_rule
,
cpu_vectorize_info
=
{
'
instruction_set
'
:
instruction_set
})
kernel
=
ast
.
compile
()
kernel
(
f
=
arr
)
np
.
testing
.
assert_equal
(
arr
,
2
)
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