Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aidge_core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Eclipse Projects
aidge
aidge_core
Commits
092cb4bd
Commit
092cb4bd
authored
6 months ago
by
Cyril Moineau
Browse files
Options
Downloads
Patches
Plain Diff
Adapt aidge mem_info to new API
parent
c7d9e41e
No related branches found
No related tags found
3 merge requests
!279
v0.4.0
,
!253
v0.4.0
,
!163
Export refactor
Pipeline
#53760
failed
6 months ago
Stage: static_analysis
Stage: build
Stage: test
Stage: coverage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aidge_core/mem_info.py
+44
-42
44 additions, 42 deletions
aidge_core/mem_info.py
with
44 additions
and
42 deletions
aidge_core/mem_info.py
+
44
−
42
View file @
092cb4bd
...
@@ -70,14 +70,14 @@ def generate_optimized_memory_info(scheduler: aidge_core.Scheduler, stats_folder
...
@@ -70,14 +70,14 @@ def generate_optimized_memory_info(scheduler: aidge_core.Scheduler, stats_folder
# In the export, we currently use an unified memory buffer whose size
# In the export, we currently use an unified memory buffer whose size
# is determined by the memory peak usage
# is determined by the memory peak usage
mem_size
=
mem_manager
.
get_peak_usage
()
mem_size
=
mem_manager
.
get_peak_usage
()
mem_info
=
[]
mem_info
=
{}
mem_planes
=
mem_manager
.
get_planes
()
mem_planes
=
mem_manager
.
get_planes
()
for
node
in
scheduler
.
get_static_scheduling
():
for
node
in
scheduler
.
get_static_scheduling
():
if
node
.
type
()
==
"
Producer
"
:
if
node
.
type
()
==
"
Producer
"
:
continue
# Skipping memory management
for producer
s
mem_info
[
node
]
=
[]
# No meminfo
for producer
if
node
in
nodes_at_input
:
el
if
node
in
nodes_at_input
:
# Input memory management (suppose tensor ends with [:, channel, height, width]))
# Input memory management (suppose tensor ends with [:, channel, height, width]))
tensor
=
node
.
get_operator
().
get_output
(
0
)
tensor
=
node
.
get_operator
().
get_output
(
0
)
if
tensor
is
None
:
if
tensor
is
None
:
...
@@ -86,47 +86,49 @@ def generate_optimized_memory_info(scheduler: aidge_core.Scheduler, stats_folder
...
@@ -86,47 +86,49 @@ def generate_optimized_memory_info(scheduler: aidge_core.Scheduler, stats_folder
raise
RuntimeError
(
raise
RuntimeError
(
f
"
Input producer dimensions must be with [:, channel, height, width] but got
{
tensor
.
dims
()
}
instead
"
)
f
"
Input producer dimensions must be with [:, channel, height, width] but got
{
tensor
.
dims
()
}
instead
"
)
name
=
node
.
name
()
offset
=
0
# Suppose input data is stored outside the export function
# so the memory offset is not important to consider
# TODO : use get_chan get_height and get_width function !
# TODO : use get_chan get_height and get_width function !
size
=
tensor
.
dims
()[
-
3
]
# Should be nb_channels
node_mem_info
.
append
({
stride
=
tensor
.
dims
()[
-
3
]
# Should be nb_channels
"
size
"
:
tensor
.
dims
()[
-
3
],
# Should be nb_channels
length
=
tensor
.
dims
()[
-
1
]
# Should be width
"
offset
"
:
0
,
# Suppose input data is stored outside the export function
count
=
tensor
.
dims
()[
-
2
]
# Should be height
# so the memory offset is not important to consider
cont_offset
=
0
# Suppose input data is stored outside the export function
"
stride
"
:
tensor
.
dims
()[
-
3
],
# Should be nb_channels
# so the memory offset is not important to consider
"
length
"
:
tensor
.
dims
()[
-
1
],
# Should be width
# Size of input
"
count
"
:
tensor
.
dims
()[
-
2
],
# Should be height
cont_size
=
tensor
.
dims
()[
-
1
]
*
\
"
cont_offset
"
:
0
,
# Suppose input data is stored outside the export function
tensor
.
dims
()[
-
2
]
*
tensor
.
dims
()[
-
3
]
# so the memory offset is not important to consider
wrap_offset
=
0
# No wrapping
"
cont_size
"
:
tensor
.
dims
()[
-
1
]
*
\
wrap_size
=
0
# No wrapping
tensor
.
dims
()[
-
2
]
*
\
tensor
.
dims
()[
-
3
],
# Size of input
"
wrap_offset
"
:
0
,
# No wrapping
"
wrap_size
"
:
0
# No wrapping
})
mem_info
[
node
]
=
[{
"
size
"
:
plane
.
size
,
"
offset
"
:
plane
.
offset
,
"
stride
"
:
plane
.
stride
,
"
length
"
:
plane
.
length
,
"
count
"
:
plane
.
count
,
"
cont_offset
"
:
plane
.
get_contiguous_offset
(),
"
cont_size
"
:
plane
.
get_contiguous_size
(),
"
wrap_offset
"
:
plane
.
get_wrapped_offset
(),
"
wrap_size
"
:
plane
.
get_wrapped_size
()
}]
else
:
else
:
plane
=
mem_planes
[
node
][
0
]
node_mem_info
=
[]
name
=
node
.
name
()
for
out_id
in
range
(
node
.
get_nb_outputs
()):
offset
=
plane
.
offset
plane
=
mem_planes
[
node
][
out_id
]
size
=
plane
.
size
node_mem_info
.
append
({
stride
=
plane
.
stride
"
size
"
:
plane
.
size
,
length
=
plane
.
length
"
offset
"
:
plane
.
offset
,
count
=
plane
.
count
"
stride
"
:
plane
.
stride
,
cont_offset
=
plane
.
get_contiguous_offset
()
"
length
"
:
plane
.
length
,
cont_size
=
plane
.
get_contiguous_size
()
"
count
"
:
plane
.
count
,
wrap_offset
=
plane
.
get_wrapped_offset
()
"
cont_offset
"
:
plane
.
get_contiguous_offset
(),
wrap_size
=
plane
.
get_wrapped_size
()
"
cont_size
"
:
plane
.
get_contiguous_size
(),
"
wrap_offset
"
:
plane
.
get_wrapped_offset
(),
mem_info
.
append
({
"
wrap_size
"
:
plane
.
get_wrapped_size
()
"
layer_name
"
:
name
,
})
"
size
"
:
size
,
mem_info
[
node
]
=
node_mem_info
"
offset
"
:
offset
,
"
stride
"
:
stride
,
"
length
"
:
length
,
"
count
"
:
count
,
"
cont_offset
"
:
cont_offset
,
"
cont_size
"
:
cont_size
,
"
wrap_offset
"
:
wrap_offset
,
"
wrap_size
"
:
wrap_size
})
return
mem_size
,
mem_info
return
mem_size
,
mem_info
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