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
24193b84
Commit
24193b84
authored
1 year ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
Fix alignement detection
parent
6c462e3d
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/kernelcreation.py
+0
-2
0 additions, 2 deletions
pystencils/cpu/kernelcreation.py
pystencils/cpu/vectorization.py
+8
-5
8 additions, 5 deletions
pystencils/cpu/vectorization.py
with
8 additions
and
7 deletions
pystencils/cpu/kernelcreation.py
+
0
−
2
View file @
24193b84
...
...
@@ -76,8 +76,6 @@ def create_kernel(assignments: NodeCollection,
base_pointer_spec
=
config
.
base_pointer_specification
if
base_pointer_spec
is
None
:
base_pointer_spec
=
[]
if
config
.
cpu_vectorize_info
and
config
.
cpu_vectorize_info
.
get
(
'
nontemporal
'
):
base_pointer_spec
=
[[
'
spatialInner0
'
],
[
'
spatialInner1
'
]]
if
len
(
loop_order
)
>=
2
else
[[
'
spatialInner0
'
]]
base_pointer_info
=
{
field
.
name
:
parse_base_pointer_info
(
base_pointer_spec
,
loop_order
,
field
.
spatial_dimensions
,
field
.
index_dimensions
)
for
field
in
fields_without_buffers
}
...
...
This diff is collapsed.
Click to expand it.
pystencils/cpu/vectorization.py
+
8
−
5
View file @
24193b84
...
...
@@ -140,12 +140,16 @@ def vectorize_inner_loops_and_adapt_load_stores(ast_node, assume_aligned, nontem
strided
,
keep_loop_stop
,
assume_sufficient_line_padding
,
default_float_type
):
"""
Goes over all innermost loops, changes increment to vector width and replaces field accesses by vector type.
"""
vector_width
=
ast_node
.
instruction_set
[
'
width
'
]
all_loops
=
filtered_tree_iteration
(
ast_node
,
ast
.
LoopOverCoordinate
,
stop_type
=
ast
.
SympyAssignment
)
loop_generator
=
filtered_tree_iteration
(
ast_node
,
ast
.
LoopOverCoordinate
,
stop_type
=
ast
.
SympyAssignment
)
all_loops
=
[
loop
for
loop
in
loop_generator
]
inner_loops
=
[
loop
for
loop
in
all_loops
if
loop
.
is_innermost_loop
]
zero_loop_counters
=
{
loop
.
loop_counter_symbol
:
0
for
loop
in
all_loops
}
assert
ast_node
.
instruction_set
,
\
"
The ast needs to hold information about the instruction_set for the vectorisation
"
vector_width
=
ast_node
.
instruction_set
[
'
width
'
]
vector_int_width
=
ast_node
.
instruction_set
[
'
intwidth
'
]
for
loop_node
in
inner_loops
:
loop_range
=
loop_node
.
stop
-
loop_node
.
start
...
...
@@ -175,7 +179,7 @@ def vectorize_inner_loops_and_adapt_load_stores(ast_node, assume_aligned, nontem
base
,
index
=
indexed
.
args
if
loop_counter_symbol
in
index
.
atoms
(
sp
.
Symbol
):
loop_counter_is_offset
=
loop_counter_symbol
not
in
(
index
-
loop_counter_symbol
).
atoms
()
aligned_access
=
(
index
-
loop_counter_symbol
).
subs
(
zero_loop_counters
)
==
0
aligned_access
=
(
index
-
loop_counter_symbol
).
subs
(
zero_loop_counters
)
%
vector_width
==
0
stride
=
sp
.
simplify
(
index
.
subs
({
loop_counter_symbol
:
loop_counter_symbol
+
1
})
-
index
)
if
not
loop_counter_is_offset
and
(
not
strided
or
loop_counter_symbol
in
stride
.
atoms
()):
successful
=
False
...
...
@@ -204,7 +208,6 @@ def vectorize_inner_loops_and_adapt_load_stores(ast_node, assume_aligned, nontem
loop_node
.
step
=
vector_width
loop_node
.
subs
(
substitutions
)
vector_int_width
=
ast_node
.
instruction_set
[
'
intwidth
'
]
arg_1
=
CastFunc
(
loop_counter_symbol
,
VectorType
(
loop_counter_symbol
.
dtype
,
vector_int_width
))
arg_2
=
CastFunc
(
tuple
(
range
(
vector_int_width
if
type
(
vector_int_width
)
is
int
else
2
)),
VectorType
(
loop_counter_symbol
.
dtype
,
vector_int_width
))
...
...
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