Skip to content

[MetaSchedule] Reduce Local Builder Memory Usage - #11074

Merged
masahi merged 1 commit into
apache:mainfrom
zxybazh:bugfix/2022-04-19/popen-pool-restart
Apr 21, 2022
Merged

masahi merged 1 commit into
apache:mainfrom
zxybazh:bugfix/2022-04-19/popen-pool-restart

Conversation

@zxybazh

@zxybazh zxybazh commented Apr 20, 2022

Copy link
Copy Markdown
Member

This PR introduce a fix to restart Popen pool in every usage. It's a current work around to avoid significant memory usage by Popen workers reused during tuning following #10874. Considering the time cost of postprocessors and evolutionary search, current implementation will not increase the overhead by a large margin in practice.

CC: @tqchen @junrushao1994 @shingjan

@junrushao

Copy link
Copy Markdown
Member

@zxybazh Thanks you for effort! Would you mind also doing this for RPCRunner and LocalRunner? Thanks a lot!

@zxybazh

zxybazh commented Apr 21, 2022

Copy link
Copy Markdown
Member Author

@zxybazh Thanks you for effort! Would you mind also doing this for RPCRunner and LocalRunner? Thanks a lot!

Thanks for the suggestion. I would like to keep RPCRunner and LocalRunner the same because:

  1. The mem usage is linear to its worker number, for RPCRunner & LocalRunner it's a very small amount.
  2. Runners are async in meta schedule, if we force single use of PopenPool it will cause thread join errors in my tests. While sync runners can avoid such error, it also brings tuning efficiency loss.

Therefore, let's keep the runners the way they are and apply this fix for local builder mem usage reduction.

@shingjan shingjan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. Just some nits. Thanks for sending this fix!

Comment thread python/tvm/meta_schedule/builder/local_builder.py
Comment thread python/tvm/meta_schedule/builder/local_builder.py

@junrushao junrushao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Retrigger CI.

Address issues.

Retrigger CI.
@zxybazh
zxybazh force-pushed the bugfix/2022-04-19/popen-pool-restart branch from 86e0afa to bb55bfe Compare April 21, 2022 06:55
@masahi
masahi merged commit b952425 into apache:main Apr 21, 2022
shtinsa pushed a commit to Deelvin/tvm that referenced this pull request May 17, 2022
Retrigger CI.

Address issues.

Retrigger CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants