One: [onert] DELETE_CACHED_DATA doesn't work

Created on 23 Apr 2020  路  8Comments  路  Source: Samsung/ONE

While working on https://github.com/Samsung/ONE/pull/200, I found DELETE_CACHED_DATA doesn't work. The inv3's peak memory should be under 400mb(== about 380mb).

odroid@odroid:/home/dragon/Works/github/ONE$ ./Product/out/bin/nnpackage_run ./benchmark_nnpkg_models/inception_v3/ -m 1
... run 0 takes 540.749 ms
===================================
MODEL_LOAD takes 509.086 ms
PREPARE    takes 14032.8 ms
EXECUTE    takes
- Min:  540.749 ms
- Max:  540.749 ms
- Mean: 540.749 ms
===================================
RSS
- MODEL_LOAD takes 191628 kb
- PREPARE    takes 474768 kb
- EXECUTE    takes 470664 kb
- PEAK       takes 474768 kb
===================================
HWM
- MODEL_LOAD takes 193476 kb
- PREPARE    takes 474768 kb
- EXECUTE    takes 474768 kb
- PEAK       takes 474768 kb
===================================
bug

Most helpful comment

@ragmani it is a getter function of shared_ptr, which returns the current use count for the pointer. https://en.cppreference.com/w/cpp/memory/shared_ptr/use_count

All 8 comments

ab1a04a 2nd commit

odroid@odroid:/home/dragon/Works/github/ONE$ ./Product/out/bin/nnpackage_run ./benchmark_nnpkg_models/inception_v3/ -m 1

... run 0 takes 536.837 ms
===================================
MODEL_LOAD takes 498.442 ms
PREPARE    takes 14211.3 ms
EXECUTE    takes
- Min:  536.837 ms
- Max:  536.837 ms
- Mean: 536.837 ms
===================================
RSS
- MODEL_LOAD takes 192716 kb
- PREPARE    takes 474772 kb
- EXECUTE    takes 470680 kb
- PEAK       takes 474772 kb
===================================
HWM
- MODEL_LOAD takes 193396 kb
- PREPARE    takes 474772 kb
- EXECUTE    takes 474772 kb
- PEAK       takes 474772 kb
===================================

8b37f5c Initial commit

odroid@odroid:/home/dragon/Works/github/ONE$ ./Product/out/bin/nnpackage_run ./benchmark_nnpkg_models/inception_v3/ -m 1
... run 0 takes 538.241 ms
===================================
MODEL_LOAD takes 498.744 ms
PREPARE    takes 14661.5 ms
EXECUTE    takes
- Min:  538.241 ms
- Max:  538.241 ms
- Mean: 538.241 ms
===================================
RSS
- MODEL_LOAD takes 193496 kb
- PREPARE    takes 385156 kb
- EXECUTE    takes 383016 kb
- PEAK       takes 385156 kb
===================================
HWM
- MODEL_LOAD takes 193496 kb
- PREPARE    takes 385156 kb
- EXECUTE    takes 385156 kb
- PEAK       takes 385156 kb
===================================

I'll take a look.

I've found something wrong about an option. After fixing that,

# before
RSS
- MODEL_LOAD takes 192716 kb
- PREPARE    takes 474772 kb
- EXECUTE    takes 470680 kb
- PEAK       takes 474772 kb
===================================

# after
RSS
- MODEL_LOAD takes 193436 kb
- PREPARE    takes 475240 kb
- EXECUTE    takes 378208 kb
- PEAK       takes 475240 kb
===================================

Weird PREPARE peak memory..

Operand's Data's use_count diff

# current master
[CachedDataDeleter] void onert::compiler::CachedDataDeleter::run()
[CachedDataDeleter] void onert::compiler::CachedDataDeleter::deleteCachedData(const OperandIndex&) OP#34
void onert::ir::Operand::releaseData()
[CachedDataDeleter] OP#34: 3 -> 2

# past branch which works well 
[CachedDataDeleter] void neurun::compiler::CachedDataDeleter::run()
[CachedDataDeleter] void neurun::compiler::CachedDataDeleter::deleteCachedData(const OperandIndex&) Operand #34
void neurun::ir::Operand::releaseData()
[CachedDataDeleter] Operand #34: 2 -> 1

Hmm,,, what makes the use_count 3?

What is use_count ?

@ragmani it is a getter function of shared_ptr, which returns the current use count for the pointer. https://en.cppreference.com/w/cpp/memory/shared_ptr/use_count

294 will fix this.

$ DELETE_CACHED_DATA=1 Product/out/bin/nnpackage_run Product/inceptionv3_slim_2016 -m1
...
===================================
RSS
- MODEL_LOAD takes 191332 kb
- PREPARE    takes 378876 kb
- EXECUTE    takes 374552 kb
- PEAK       takes 378876 kb

294 will fix peak memory usage.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mhs4670go picture mhs4670go  路  3Comments

kishcs picture kishcs  路  3Comments

seanshpark picture seanshpark  路  3Comments

mhs4670go picture mhs4670go  路  3Comments

lucenticus picture lucenticus  路  3Comments