Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-codegen
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Christian Heinigk
dune-codegen
Commits
e27b8015
Commit
e27b8015
authored
6 years ago
by
Marcel Koch
Browse files
Options
Downloads
Patches
Plain Diff
separate c index array and vectorized index array
parent
2c0878ee
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/dune/codegen/blockstructured/vectorization.py
+44
-14
44 additions, 14 deletions
python/dune/codegen/blockstructured/vectorization.py
with
44 additions
and
14 deletions
python/dune/codegen/blockstructured/vectorization.py
+
44
−
14
View file @
e27b8015
...
...
@@ -338,38 +338,67 @@ def find_accumulation_inames(knl):
return
inames
def
add_iname_array
(
knl
,
vec_
iname
):
insns_with_macro_points
=
lp
.
find_instructions
(
knl
,
Tagged
(
vec_
iname
))
def
add_iname_array
(
knl
,
iname
):
insns_with_macro_points
=
lp
.
find_instructions
(
knl
,
Tagged
(
iname
))
if
insns_with_macro_points
:
array_name
=
vec_iname
+
'
_arr
'
vector_name
=
vec_iname
+
'
_vec
'
new_iname
=
knl
.
get_var_name_generator
()(
iname
)
new_dom
=
BasicSet
(
'
{{ [{0}] : 0<={0}<{1} }}
'
.
format
(
new_iname
,
get_form_option
(
'
number_of_blocks
'
)))
array_name
=
iname
+
'
_arr
'
new_temporaries
=
dict
()
new_temporaries
[
array_name
]
=
DuneTemporaryVariable
(
array_name
,
managed
=
True
,
shape
=
(
get_form_option
(
'
number_of_blocks
'
),),
scope
=
lp
.
temp_var_scope
.
PRIVATE
,
dtype
=
np
.
float64
,
base_storage
=
vec_i
name
+
'
_buff
'
,
base_storage
=
array_
name
+
'
_buff
'
,
_base_storage_access_may_be_aliasing
=
True
)
replacemap
=
dict
()
replacemap
[
iname
]
=
prim
.
Subscript
(
prim
.
Variable
(
array_name
),
(
prim
.
Variable
(
iname
),))
new_insns
=
[
lp
.
Assignment
(
assignee
=
prim
.
Subscript
(
prim
.
Variable
(
array_name
),
(
prim
.
Variable
(
new_iname
),)),
expression
=
prim
.
Variable
(
new_iname
),
id
=
'
init_{}_buffer
'
.
format
(
array_name
),
within_inames
=
frozenset
({
new_iname
}),
within_inames_is_final
=
True
)]
for
insn
in
knl
.
instructions
:
if
insn
in
insns_with_macro_points
:
transformed_insn
=
insn
.
with_transformed_expressions
(
lambda
expr
:
substitute
(
expr
,
replacemap
))
new_insns
.
append
(
transformed_insn
.
copy
(
depends_on
=
'
init_{}_buffer
'
.
format
(
array_name
)))
else
:
new_insns
.
append
(
insn
)
knl
=
knl
.
copy
(
instructions
=
new_insns
,
domains
=
knl
.
domains
+
[
new_dom
],
temporary_variables
=
dict
(
**
knl
.
temporary_variables
,
**
new_temporaries
))
return
knl
def
add_vcl_iname_array
(
knl
,
iname
,
vec_iname
,
vcl_size
):
insns_with_macro_points
=
lp
.
find_instructions
(
knl
,
And
((
Tagged
(
iname
),
Iname
(
vec_iname
))))
if
insns_with_macro_points
:
iname_array
=
iname
+
'
_arr
'
vector_name
=
iname
+
'
_vec{}
'
.
format
(
vcl_size
)
new_temporaries
=
dict
()
new_temporaries
[
vector_name
]
=
DuneTemporaryVariable
(
vector_name
,
managed
=
True
,
shape
=
(
get_form_option
(
'
number_of_blocks
'
),),
scope
=
lp
.
temp_var_scope
.
PRIVATE
,
dtype
=
np
.
float64
,
base_storage
=
vec_
iname
+
'
_buff
'
,
base_storage
=
iname
_array
+
'
_buff
'
,
_base_storage_access_may_be_aliasing
=
True
)
silenced_warning
=
[
"
read_no_write({})
"
.
format
(
vector_name
)]
new_insns
=
[
lp
.
Assignment
(
assignee
=
prim
.
Subscript
(
prim
.
Variable
(
array_name
),
(
prim
.
Variable
(
vec_iname
),)),
expression
=
prim
.
Variable
(
vec_iname
),
id
=
'
init_{}_buffer
'
.
format
(
vec_iname
),
within_inames
=
frozenset
({
vec_iname
}),
within_inames_is_final
=
True
)]
replacemap
=
dict
()
replacemap
[
vec_
iname
]
=
prim
.
Subscript
(
prim
.
Variable
(
vector_name
)
,
(
prim
.
Variable
(
vec_iname
),))
replacemap
[
iname
_array
]
=
prim
.
Variable
(
vector_name
)
new_insns
=
[]
for
insn
in
knl
.
instructions
:
if
insn
in
insns_with_macro_points
:
transformed_insn
=
insn
.
with_transformed_expressions
(
lambda
expr
:
substitute
(
expr
,
replacemap
))
new_insns
.
append
(
transformed_insn
.
copy
(
depends_on
=
'
init_{}_buffer
'
.
format
(
vec_
iname
)))
new_insns
.
append
(
transformed_insn
.
copy
(
depends_on
=
'
init_{}_buffer
'
.
format
(
iname
_array
)))
else
:
new_insns
.
append
(
insn
)
...
...
@@ -377,7 +406,8 @@ def add_iname_array(knl, vec_iname):
temporary_variables
=
dict
(
**
knl
.
temporary_variables
,
**
new_temporaries
),
silenced_warnings
=
knl
.
silenced_warnings
+
silenced_warning
)
knl
=
lp
.
duplicate_inames
(
knl
,
[
vec_iname
],
within
=
Id
(
'
init_{}_buffer
'
.
format
(
vec_iname
)))
knl
=
lp
.
split_array_axis
(
knl
,
(
vector_name
,),
0
,
vcl_size
)
knl
=
lp
.
tag_array_axes
(
knl
,
(
vector_name
,),
(
'
c
'
,
'
vec
'
))
return
knl
...
...
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