Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pipedream
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
Show more breadcrumbs
GRUBER Fabian
pipedream
Commits
2ecd844a
Commit
2ecd844a
authored
4 years ago
by
Nicolas Derumigny
Browse files
Options
Downloads
Patches
Plain Diff
benchmark: adding ability to use the pooled allocator on benchmarks
parent
86128ffe
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/pipedream/benchmark/common.py
+10
-6
10 additions, 6 deletions
src/pipedream/benchmark/common.py
src/pipedream/benchmark/types.py
+6
-1
6 additions, 1 deletion
src/pipedream/benchmark/types.py
with
16 additions
and
7 deletions
src/pipedream/benchmark/common.py
+
10
−
6
View file @
2ecd844a
...
@@ -1196,7 +1196,7 @@ class _Benchmark_Runner:
...
@@ -1196,7 +1196,7 @@ class _Benchmark_Runner:
)
->
ty
.
Tuple
[
ty
.
List
[
'
_ASM_Builder.ASM_Statement
'
],
ty
.
List
[
ir
.
Instruction
]]:
)
->
ty
.
Tuple
[
ty
.
List
[
'
_ASM_Builder.ASM_Statement
'
],
ty
.
List
[
ir
.
Instruction
]]:
"""
"""
Generate inner benchmark loop.
Generate inner benchmark loop.
Does *NOT* emit any code into :out:, code is returned an can later be spliced in
Does *NOT* emit any code into :out:, code is returned an
d
can later be spliced in
"""
"""
if
benchmark
.
kernel_iterations
<
1
:
if
benchmark
.
kernel_iterations
<
1
:
...
@@ -1222,11 +1222,12 @@ class _Benchmark_Runner:
...
@@ -1222,11 +1222,12 @@ class _Benchmark_Runner:
insts
=
list
(
instructions
)
*
benchmark
.
unroll_factor
insts
=
list
(
instructions
)
*
benchmark
.
unroll_factor
Allocator_Class
=
{
Allocator_Class
=
{
Benchmark_Kind
.
THROUGHPUT
:
pseudoalloc
.
MinimizeDepsPseudoAllocator
,
(
Benchmark_Kind
.
THROUGHPUT
,
True
):
pseudoalloc
.
MinimizeDepsPseudoAllocator
,
Benchmark_Kind
.
LATENCY
:
pseudoalloc
.
MaximizeDepsPseudoAllocator
,
(
Benchmark_Kind
.
THROUGHPUT
,
False
):
pseudoalloc
.
MinimizeDepsPooledPseudoAllocator
,
}[
benchmark
.
kind
]
(
Benchmark_Kind
.
LATENCY
,
True
):
pseudoalloc
.
MaximizeDepsPseudoAllocator
,
}[(
benchmark
.
kind
,
benchmark
.
register_pools
is
None
)]
alloc
=
Allocator_Class
(
out
.
free_registers
(),
memory_reg
=
memory_reg
)
alloc
=
Allocator_Class
(
out
.
arch
.
make_register_pools
(
out
.
free_registers
(),
benchmark
.
register_pools
),
\
memory_reg
=
memory_reg
)
kernel_instructions
=
alloc
.
allocate
(
insts
,
out
.
ir_builder
)
kernel_instructions
=
alloc
.
allocate
(
insts
,
out
.
ir_builder
)
out
.
newline
()
out
.
newline
()
...
@@ -2142,6 +2143,9 @@ class _ASM_Builder:
...
@@ -2142,6 +2143,9 @@ class _ASM_Builder:
self
.
_alloc
.
free
(
reg
)
self
.
_alloc
.
free
(
reg
)
def
glob_instruction_tags
(
arch_or_instructions
:
ty
.
Union
[
ir
.
Architecture
,
ty
.
Iterable
[
ir
.
Instruction
]],
def
glob_instruction_tags
(
arch_or_instructions
:
ty
.
Union
[
ir
.
Architecture
,
ty
.
Iterable
[
ir
.
Instruction
]],
tags
:
ty
.
Iterable
[
str
])
->
ty
.
Iterable
[
ir
.
Instruction
]:
tags
:
ty
.
Iterable
[
str
])
->
ty
.
Iterable
[
ir
.
Instruction
]:
if
isinstance
(
arch_or_instructions
,
ir
.
Architecture
):
if
isinstance
(
arch_or_instructions
,
ir
.
Architecture
):
...
...
This diff is collapsed.
Click to expand it.
src/pipedream/benchmark/types.py
+
6
−
1
View file @
2ecd844a
...
@@ -51,6 +51,7 @@ class Benchmark_Spec(yaml.YAML_Serializable):
...
@@ -51,6 +51,7 @@ class Benchmark_Spec(yaml.YAML_Serializable):
def
__init__
(
self
,
name
:
str
,
kind
:
Benchmark_Kind
,
def
__init__
(
self
,
name
:
str
,
kind
:
Benchmark_Kind
,
unroll_factor
:
int
,
kernel_iterations
:
int
,
unroll_factor
:
int
,
kernel_iterations
:
int
,
arch
:
ir
.
Architecture
,
instructions
:
ty
.
List
[
ir
.
Instruction
],
arch
:
ir
.
Architecture
,
instructions
:
ty
.
List
[
ir
.
Instruction
],
register_pools
:
ty
.
Optional
[
ty
.
Dict
[
ir
.
Instruction
,
int
]],
loop_overhead
:
Loop_Overhead
):
loop_overhead
:
Loop_Overhead
):
"""
"""
ctor.
ctor.
...
@@ -62,6 +63,7 @@ class Benchmark_Spec(yaml.YAML_Serializable):
...
@@ -62,6 +63,7 @@ class Benchmark_Spec(yaml.YAML_Serializable):
:param kernel list of instructions inside the kernel (before unrolling)
:param kernel list of instructions inside the kernel (before unrolling)
:param arch asm.Architecture for the CPU architecture this benchmark is for
:param arch asm.Architecture for the CPU architecture this benchmark is for
:param instructions instructions in this benchmark kernel
:param instructions instructions in this benchmark kernel
:param register_pools relative importance of the instruction in terms of amount of register reserved
:param loop_overhead number of instructions dynamically executed to run loop around
:param loop_overhead number of instructions dynamically executed to run loop around
benchmark kernel (does not include instructions of kernel itself)
benchmark kernel (does not include instructions of kernel itself)
"""
"""
...
@@ -74,6 +76,7 @@ class Benchmark_Spec(yaml.YAML_Serializable):
...
@@ -74,6 +76,7 @@ class Benchmark_Spec(yaml.YAML_Serializable):
self
.
kernel_iterations
=
kernel_iterations
self
.
kernel_iterations
=
kernel_iterations
self
.
arch
=
arch
self
.
arch
=
arch
self
.
instructions
=
instructions
self
.
instructions
=
instructions
self
.
register_pools
=
register_pools
self
.
loop_overhead
=
loop_overhead
self
.
loop_overhead
=
loop_overhead
@classmethod
@classmethod
...
@@ -81,7 +84,8 @@ class Benchmark_Spec(yaml.YAML_Serializable):
...
@@ -81,7 +84,8 @@ class Benchmark_Spec(yaml.YAML_Serializable):
kind
:
Benchmark_Kind
,
kind
:
Benchmark_Kind
,
arch
:
ir
.
Architecture
,
arch
:
ir
.
Architecture
,
instructions
:
ty
.
Sequence
[
ir
.
Instruction
],
instructions
:
ty
.
Sequence
[
ir
.
Instruction
],
name
:
str
=
None
,
register_pools
:
ty
.
Optional
[
ty
.
Dict
[
ir
.
Instruction
,
int
]]
=
None
,
name
:
str
=
None
,
num_dynamic_instructions
:
int
,
num_dynamic_instructions
:
int
,
unrolled_length
:
int
=
None
,
unrolled_length
:
int
=
None
,
unroll_factor
:
int
=
None
):
unroll_factor
:
int
=
None
):
...
@@ -136,6 +140,7 @@ class Benchmark_Spec(yaml.YAML_Serializable):
...
@@ -136,6 +140,7 @@ class Benchmark_Spec(yaml.YAML_Serializable):
kernel_iterations
=
kernel_iterations
,
kernel_iterations
=
kernel_iterations
,
arch
=
arch
,
arch
=
arch
,
instructions
=
instructions
,
instructions
=
instructions
,
register_pools
=
register_pools
,
loop_overhead
=
arch
.
loop_overhead
(
kernel_iterations
),
loop_overhead
=
arch
.
loop_overhead
(
kernel_iterations
),
)
)
...
...
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