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
18007275
Commit
18007275
authored
1 year ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
Fix if loada and loadu are similar
parent
39f90c5b
No related branches found
No related tags found
1 merge request
!351
[FIX] Alignement detection
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pystencils/cpu/vectorization.py
+4
-1
4 additions, 1 deletion
pystencils/cpu/vectorization.py
pystencils_tests/test_vectorization_specific.py
+7
-4
7 additions, 4 deletions
pystencils_tests/test_vectorization_specific.py
with
11 additions
and
5 deletions
pystencils/cpu/vectorization.py
+
4
−
1
View file @
18007275
...
...
@@ -149,6 +149,9 @@ def vectorize_inner_loops_and_adapt_load_stores(ast_node, assume_aligned, nontem
vector_width
=
ast_node
.
instruction_set
[
'
width
'
]
vector_int_width
=
ast_node
.
instruction_set
[
'
intwidth
'
]
load_a
=
ast_node
.
instruction_set
[
'
loadA
'
]
load_u
=
ast_node
.
instruction_set
[
'
loadU
'
]
for
loop_node
in
inner_loops
:
loop_range
=
loop_node
.
stop
-
loop_node
.
start
...
...
@@ -177,7 +180,7 @@ def vectorize_inner_loops_and_adapt_load_stores(ast_node, assume_aligned, nontem
for
indexed
in
loop_node
.
atoms
(
sp
.
Indexed
):
base
,
index
=
indexed
.
args
if
loop_counter_symbol
in
index
.
atoms
(
sp
.
Symbol
):
if
not
isinstance
(
vector_width
,
int
):
if
not
isinstance
(
vector_width
,
int
)
or
load_a
==
load_u
:
# When the vector width is not known during code generation, we cannot determine whether
# the access is aligned or not. None of the current sizeless vector ISAs (SVE and RISC-V-V)
# have separate load/store instructions for aligned and unaligned, so there is no disadvantage
...
...
This diff is collapsed.
Click to expand it.
pystencils_tests/test_vectorization_specific.py
+
7
−
4
View file @
18007275
...
...
@@ -119,11 +119,14 @@ def test_alignment_and_correct_ghost_layers(gl_field, gl_kernel, instruction_set
cpu_vectorize_info
=
opt
,
ghost_layers
=
gl_kernel
)
ast
=
ps
.
create_kernel
(
update_rule
,
config
=
config
)
kernel
=
ast
.
compile
()
if
gl_kernel
!=
gl_field
:
with
pytest
.
raises
(
ValueError
):
dh
.
run_kernel
(
kernel
)
else
:
if
ast
.
instruction_set
[
'
loadA
'
]
==
ast
.
instruction_set
[
'
loadU
'
]:
dh
.
run_kernel
(
kernel
)
else
:
if
gl_kernel
!=
gl_field
:
with
pytest
.
raises
(
ValueError
):
dh
.
run_kernel
(
kernel
)
else
:
dh
.
run_kernel
(
kernel
)
@pytest.mark.parametrize
(
'
instruction_set
'
,
supported_instruction_sets
)
...
...
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