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
1c89555f
Commit
1c89555f
authored
3 weeks ago
by
Frederik Hennig
Browse files
Options
Downloads
Patches
Plain Diff
Revert "fix testsuite for ARM on Apple M1"
This reverts commit
7e38e676
parent
7e38e676
No related branches found
No related tags found
No related merge requests found
Pipeline
#79707
passed
3 weeks ago
Stage: Code Quality
Stage: Unit Tests
Stage: legacy_test
Stage: docs
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/fixtures.py
+10
-15
10 additions, 15 deletions
tests/fixtures.py
tests/kernelcreation/test_half_precision.py
+4
-15
4 additions, 15 deletions
tests/kernelcreation/test_half_precision.py
tests/nbackend/test_vectorization.py
+8
-8
8 additions, 8 deletions
tests/nbackend/test_vectorization.py
with
22 additions
and
38 deletions
tests/fixtures.py
+
10
−
15
View file @
1c89555f
...
...
@@ -17,8 +17,6 @@ import pytest
from
types
import
ModuleType
import
pystencils
as
ps
from
pystencils.jit
import
CpuJit
from
pystencils.jit.cpu
import
GccInfo
AVAILABLE_TARGETS
=
ps
.
Target
.
available_targets
()
TARGET_IDS
=
[
t
.
name
for
t
in
AVAILABLE_TARGETS
]
...
...
@@ -31,18 +29,7 @@ def target(request) -> ps.Target:
@pytest.fixture
def
cpujit
(
target
:
ps
.
Target
,
tmp_path
)
->
CpuJit
:
# Set target in compiler info such that `-march` is set accordingly
cinfo
=
GccInfo
(
target
=
target
)
return
CpuJit
(
compiler_info
=
cinfo
,
objcache
=
tmp_path
)
@pytest.fixture
def
gen_config
(
request
:
pytest
.
FixtureRequest
,
target
:
ps
.
Target
,
cpujit
:
CpuJit
):
def
gen_config
(
request
:
pytest
.
FixtureRequest
,
target
:
ps
.
Target
,
tmp_path
):
"""
Default codegen configuration for the current target.
For GPU targets, set default indexing options.
...
...
@@ -56,7 +43,15 @@ def gen_config(request: pytest.FixtureRequest, target: ps.Target, cpujit: CpuJit
gen_config
.
cpu
.
vectorize
.
assume_inner_stride_one
=
True
if
target
.
is_cpu
():
gen_config
.
jit
=
cpujit
from
pystencils.jit.cpu
import
CpuJit
,
GccInfo
# Set target in compiler info such that `-march` is set accordingly
cinfo
=
GccInfo
(
target
=
target
)
gen_config
.
jit
=
CpuJit
(
compiler_info
=
cinfo
,
objcache
=
tmp_path
)
return
gen_config
...
...
This diff is collapsed.
Click to expand it.
tests/kernelcreation/test_half_precision.py
+
4
−
15
View file @
1c89555f
...
...
@@ -4,26 +4,16 @@ import platform
import
numpy
as
np
import
pystencils
as
ps
from
pystencils.jit.cpu
import
CpuJit
,
ClangInfo
@pytest.fixture
def
cpujit
(
target
:
ps
.
Target
,
tmp_path
)
->
CpuJit
:
# Set target in compiler info such that `-march` is set accordingly
cinfo
=
ClangInfo
(
target
=
target
)
return
CpuJit
(
compiler_info
=
cinfo
,
objcache
=
tmp_path
)
@pytest.mark.parametrize
(
'
target
'
,
(
ps
.
Target
.
CPU
,
ps
.
Target
.
CurrentGPU
))
def
test_half_precison
(
target
,
cpujit
):
def
test_half_precison
(
target
):
if
target
==
ps
.
Target
.
CPU
:
if
not
platform
.
machine
()
in
[
'
arm64
'
,
'
aarch64
'
]:
pytest
.
xfail
(
"
skipping half precision test on non arm platform
"
)
if
'
clang
'
not
in
ps
.
cpu
.
cpujit
.
get_compiler_config
()[
'
command
'
]:
pytest
.
xfail
(
"
skipping half precision because clang compiler is not used
"
)
if
target
.
is_gpu
():
pytest
.
importorskip
(
"
cupy
"
)
...
...
@@ -40,7 +30,6 @@ def test_half_precison(target, cpujit):
up
=
ps
.
Assignment
(
f3
.
center
,
f1
.
center
+
2.1
*
f2
.
center
)
config
=
ps
.
CreateKernelConfig
(
target
=
dh
.
default_target
,
default_dtype
=
np
.
float32
)
config
.
jit
=
cpujit
ast
=
ps
.
create_kernel
(
up
,
config
=
config
)
kernel
=
ast
.
compile
()
...
...
This diff is collapsed.
Click to expand it.
tests/nbackend/test_vectorization.py
+
8
−
8
View file @
1c89555f
...
...
@@ -144,7 +144,7 @@ def create_vector_kernel(
cinfo
=
GccInfo
(
target
=
setup
.
target
)
kfactory
=
KernelFactory
(
ctx
)
kernel
=
kfactory
.
create_generic_kernel
(
func
=
kfactory
.
create_generic_kernel
(
platform
,
PsBlock
([
loop_nest
]),
"
vector_kernel
"
,
...
...
@@ -152,6 +152,7 @@ def create_vector_kernel(
CpuJit
(
cinfo
),
)
kernel
=
func
.
compile
()
return
kernel
...
...
@@ -173,7 +174,7 @@ def test_update_kernel(vectorization_setup: VectorTestSetup, ghost_layers: int):
Assignment
(
dst
.
center
(
3
),
x
[
3
]),
]
kernel
=
create_vector_kernel
(
update
,
src
,
setup
,
ghost_layers
)
.
compile
()
kernel
=
create_vector_kernel
(
update
,
src
,
setup
,
ghost_layers
)
shape
=
(
23
,
17
)
...
...
@@ -219,7 +220,7 @@ def test_trailing_iterations(vectorization_setup: VectorTestSetup):
update
=
[
Assignment
(
f
(
0
),
2
*
f
(
0
))]
kernel
=
create_vector_kernel
(
update
,
f
,
setup
)
.
compile
()
kernel
=
create_vector_kernel
(
update
,
f
,
setup
)
for
trailing_iters
in
range
(
setup
.
lanes
):
shape
=
(
setup
.
lanes
*
12
+
trailing_iters
,
1
)
...
...
@@ -240,7 +241,7 @@ def test_only_trailing_iterations(vectorization_setup: VectorTestSetup):
update
=
[
Assignment
(
f
(
0
),
2
*
f
(
0
))]
kernel
=
create_vector_kernel
(
update
,
f
,
setup
)
.
compile
()
kernel
=
create_vector_kernel
(
update
,
f
,
setup
)
for
trailing_iters
in
range
(
1
,
setup
.
lanes
):
shape
=
(
trailing_iters
,
1
)
...
...
@@ -261,7 +262,7 @@ def test_set(vectorization_setup: VectorTestSetup):
update
=
[
Assignment
(
f
(
0
),
DEFAULTS
.
spatial_counters
[
0
])]
kernel
=
create_vector_kernel
(
update
,
f
,
setup
)
.
compile
()
kernel
=
create_vector_kernel
(
update
,
f
,
setup
)
shape
=
(
23
,
1
)
f_arr
=
create_numpy_array_with_layout
(
...
...
@@ -309,7 +310,7 @@ def test_strided_load(vectorization_setup: VectorTestSetup, int_or_float):
)
]
kernel
=
create_vector_kernel
(
update
,
f
,
setup
)
.
compile
()
kernel
=
create_vector_kernel
(
update
,
f
,
setup
)
f_shape
=
(
21
,
17
)
f_arr
=
create_numpy_array_with_layout
(
...
...
@@ -387,11 +388,10 @@ def test_strided_store(vectorization_setup: VectorTestSetup, int_or_float):
scatter_pattern
=
f
"
{
prefix
}
_i
{
setup
.
type_width
}
scatter_
{
suffix
}
"
+
r
"
\(.*,.*,.*,\s*
"
+
str
(
setup
.
type_width
//
8
)
+
r
"
\);
"
assert
len
(
re
.
findall
(
scatter_pattern
,
kernel
.
get_c_
code
()
))
==
3
assert
len
(
re
.
findall
(
scatter_pattern
,
kernel
.
code
))
==
3
if
Target
.
X86_AVX512
in
Target
.
available_vector_cpu_targets
():
# We don't have AVX512 CPUs on the CI runners
kernel
=
kernel
.
compile
()
f_shape
=
(
21
,
17
)
f_arr
=
create_numpy_array_with_layout
(
...
...
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