Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RUNTIME] Fast path for single thread run to allow app level threading #7454

Merged
merged 2 commits into from
Feb 18, 2021

Conversation

masahi
Copy link
Member

@masahi masahi commented Feb 13, 2021

@jwfromm @tqchen

Seems using TVM's own thread pool doesn't allow running multiple independent instance of mods concurrently across different cores with TVM_NUM_THREADS=1. All threads run on a single core for some reason.

Need to figure out what SetAffinity function is doing

void SetAffinity(bool exclude_worker0, bool reverse = false) {

@masahi masahi marked this pull request as draft February 13, 2021 02:04
@masahi masahi marked this pull request as ready for review February 13, 2021 08:42
@tqchen
Copy link
Member

tqchen commented Feb 13, 2021

Interesting, thanks @masahi , I think we should avoid set affinity when nthread ==1 , cc @yidawang @ZihengJiang @icemelon9

@binarybana
Copy link
Contributor

Perhaps another guard for the nthread == 1 case at this point?

// Do not set affinity if there are more workers than found cores

Though it feels weird to be using a threadpool at all for the nthread == 1 case.

Also, unrelated, but saw this while looking around this code: I'm probably just reading this wrong, but to me the below line looks odd: why is the kBig mode hardcoded here?

num_workers_used_ = threads_->Configure(threading::ThreadGroup::kBig, 0, exclude_worker0_);

Copy link
Contributor

@jwfromm jwfromm left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for making this change @masahi

@jwfromm jwfromm merged commit 944d8d1 into apache:main Feb 18, 2021
masahi added a commit to masahi/tvm that referenced this pull request Feb 22, 2021
apache#7454)

* Fast path for single thread run to allow app level threading

* add sync counter to avoid error in one of tests
Lokiiiiii pushed a commit to Lokiiiiii/tvm that referenced this pull request Mar 2, 2021
apache#7454)

* Fast path for single thread run to allow app level threading

* add sync counter to avoid error in one of tests
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Mar 2, 2021
apache#7454)

* Fast path for single thread run to allow app level threading

* add sync counter to avoid error in one of tests
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