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
cee2d2ad
Commit
cee2d2ad
authored
5 years ago
by
René Heß
Browse files
Options
Downloads
Patches
Plain Diff
[skip ci] Simulate cache misses in autotune benchmarks
Run the function call over multiple data sets.
parent
301c91bc
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/sumfact/autotune.py
+16
-7
16 additions, 7 deletions
python/dune/codegen/sumfact/autotune.py
with
16 additions
and
7 deletions
python/dune/codegen/sumfact/autotune.py
+
16
−
7
View file @
cee2d2ad
...
@@ -381,7 +381,6 @@ def generate_standalone_kernel_code(kernel, signature, filename, transformations
...
@@ -381,7 +381,6 @@ def generate_standalone_kernel_code(kernel, signature, filename, transformations
codegen_benchmark_function
=
textwrap
.
indent
(
codegen_benchmark_function
,
'
'
)
codegen_benchmark_function
=
textwrap
.
indent
(
codegen_benchmark_function
,
'
'
)
# Declare function arguments
# Declare function arguments
datasets
=
512
codegen_declare_arguments
=
[]
codegen_declare_arguments
=
[]
codegen_declare_input
=
[]
codegen_declare_input
=
[]
function_arguments
=
[
a
for
a
in
kernel
.
args
if
a
.
name
in
arguments
]
function_arguments
=
[
a
for
a
in
kernel
.
args
if
a
.
name
in
arguments
]
...
@@ -403,10 +402,10 @@ def generate_standalone_kernel_code(kernel, signature, filename, transformations
...
@@ -403,10 +402,10 @@ def generate_standalone_kernel_code(kernel, signature, filename, transformations
size
*=
min_stride
size
*=
min_stride
alignment
=
arg
.
dtype
.
itemsize
alignment
=
arg
.
dtype
.
itemsize
real
=
type_floatingpoint
()
real
=
type_floatingpoint
()
codegen_declare_input
.
append
((
'
{} {}[{}] __attribute__ ((aligned ({})));
\n
'
.
format
(
real
,
codegen_declare_input
.
append
((
'
{} {}[
datasets][
{}] __attribute__ ((aligned ({})));
\n
'
.
format
(
real
,
arg
.
name
,
arg
.
name
,
size
,
size
,
alignment
)))
alignment
)))
codegen_declare_arguments
=
''
.
join
(
codegen_declare_arguments
)
codegen_declare_arguments
=
''
.
join
(
codegen_declare_arguments
)
codegen_declare_arguments
=
textwrap
.
indent
(
codegen_declare_arguments
,
'
'
)
codegen_declare_arguments
=
textwrap
.
indent
(
codegen_declare_arguments
,
'
'
)
...
@@ -419,6 +418,10 @@ def generate_standalone_kernel_code(kernel, signature, filename, transformations
...
@@ -419,6 +418,10 @@ def generate_standalone_kernel_code(kernel, signature, filename, transformations
for
arg
in
function_arguments
:
for
arg
in
function_arguments
:
if
'
fastdg
'
in
arg
.
name
:
if
'
fastdg
'
in
arg
.
name
:
lines
=
_initialize_arg
(
arg
)
lines
=
_initialize_arg
(
arg
)
lines
=
[
'
'
+
a
for
a
in
lines
]
lines
=
[
a
.
replace
(
arg
.
name
+
'
;
'
,
arg
.
name
+
'
[i];
'
)
for
a
in
lines
]
lines
.
insert
(
0
,
'
for(std::size_t i=0; i<datasets; ++i){
'
)
lines
.
append
(
'
}
'
)
codegen_initialize_input
+=
'
\n
'
.
join
(
lines
)
+
'
\n
'
codegen_initialize_input
+=
'
\n
'
.
join
(
lines
)
+
'
\n
'
else
:
else
:
lines
=
_initialize_arg
(
arg
)
lines
=
_initialize_arg
(
arg
)
...
@@ -427,8 +430,14 @@ def generate_standalone_kernel_code(kernel, signature, filename, transformations
...
@@ -427,8 +430,14 @@ def generate_standalone_kernel_code(kernel, signature, filename, transformations
codegen_initialize_input
=
textwrap
.
indent
(
codegen_initialize_input
,
'
'
)
codegen_initialize_input
=
textwrap
.
indent
(
codegen_initialize_input
,
'
'
)
# Call the benchmark function
# Call the benchmark function
codegen_call_benchmark_function
=
kernel
.
name
+
'
({})
'
.
format
(
'
,
'
.
join
(
arguments
))
+
'
;
'
arguments_with_datasets
=
arguments
.
copy
()
codegen_call_benchmark_function
=
textwrap
.
indent
(
codegen_call_benchmark_function
,
'
'
)
arguments_with_datasets
=
[
a
if
'
fastdg
'
not
in
a
else
a
+
'
[i]
'
for
a
in
arguments
]
codegen_call_benchmark_function
=
'
for (std::size_t i=0; i<datasets; ++i){
\n
'
codegen_call_benchmark_function
+=
'
'
+
kernel
.
name
+
'
({})
'
.
format
(
'
,
'
.
join
(
arguments_with_datasets
))
+
'
;
\n
'
for
arg
in
input_arguments
:
codegen_call_benchmark_function
+=
'
benchmark::DoNotOptimize({}[i][0]);
\n
'
.
format
(
arg
)
codegen_call_benchmark_function
+=
'
}
'
codegen_call_benchmark_function
=
textwrap
.
indent
(
codegen_call_benchmark_function
,
'
'
)
# Replace placeholders in benchmark template
# Replace placeholders in benchmark template
benchmark
=
benchmark
.
replace
(
'
CODEGEN_TRANSFORMATIONS
'
,
codegen_transformations
)
benchmark
=
benchmark
.
replace
(
'
CODEGEN_TRANSFORMATIONS
'
,
codegen_transformations
)
...
...
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