payload: {"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-tvm/pulls/comments/348648549","pull_request_review_id":320148703,"id":348648549,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM0ODY0ODU0OQ==","diff_hunk":"@@ -133,22 +133,39 @@ class ThreadGroup::Impl {\n           sizeof(cpu_set_t), &cpuset);\n #endif\n     }\n-    if (exclude_worker0) {  // bind the master thread to core 0\n-      cpu_set_t cpuset;\n-      CPU_ZERO(&cpuset);\n-      if (reverse) {\n-        CPU_SET(sorted_order_[sorted_order_.size() - 1], &cpuset);\n-      } else {\n-        CPU_SET(sorted_order_[0], &cpuset);\n+    if (exclude_worker0) {  // master thread run task\n+#if defined(__ANDROID__)\n+      SetFullCpuAffinity();\n+#else\n+      const char* bind_master_thread = getenv(\"TVM_BIND_MASTER_THREAD\");\n+      if (bind_master_thread) {\n+        cpu_set_t cpuset;\n+        CPU_ZERO(&cpuset);\n+        if (reverse) {\n+          CPU_SET(sorted_order_[sorted_order_.size() - 1], &cpuset);\n+        } else {\n+          CPU_SET(sorted_order_[0], &cpuset);\n+        }\n       }\n+     pthread_atfork(nullptr, nullptr, ThreadGroup::Impl::SetFullCpuAffinity);","path":"src/runtime/threading_backend.cc","position":25,"original_position":25,"commit_id":"63994477bcc2c8cdd08e4fb061a687cecb3eebe0","original_commit_id":"63994477bcc2c8cdd08e4fb061a687cecb3eebe0","user":{"login":"tqchen","id":2577440,"node_id":"MDQ6VXNlcjI1Nzc0NDA=","avatar_url":"https://avatars3.githubusercontent.com/u/2577440?v=4","gravatar_id":"","url":"https://api.github.com/users/tqchen","html_url":"https://github.com/tqchen","followers_url":"https://api.github.com/users/tqchen/followers","following_url":"https://api.github.com/users/tqchen/following{/other_user}","gists_url":"https://api.github.com/users/tqchen/gists{/gist_id}","starred_url":"https://api.github.com/users/tqchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tqchen/subscriptions","organizations_url":"https://api.github.com/users/tqchen/orgs","repos_url":"https://api.github.com/users/tqchen/repos","events_url":"https://api.github.com/users/tqchen/events{/privacy}","received_events_url":"https://api.github.com/users/tqchen/received_events","type":"User","site_admin":false},"body":"Please check the editor, seems alignment was not right(number of spaces","created_at":"2019-11-20T17:34:50Z","updated_at":"2019-11-20T17:35:29Z","html_url":"https://github.com/apache/incubator-tvm/pull/4344#discussion_r348648549","pull_request_url":"https://api.github.com/repos/apache/incubator-tvm/pulls/4344","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-tvm/pulls/comments/348648549"},"html":{"href":"https://github.com/apache/incubator-tvm/pull/4344#discussion_r348648549"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-tvm/pulls/4344"}}},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-tvm/pulls/4344","id":341282694,"node_id":"MDExOlB1bGxSZXF1ZXN0MzQxMjgyNjk0","html_url":"https://github.com/apache/incubator-tvm/pull/4344","diff_url":"https://github.com/apache/incubator-tvm/pull/4344.diff","patch_url":"https://github.com/apache/incubator-tvm/pull/4344.patch","issue_url":"https://api.github.com/repos/apache/incubator-tvm/issues/4344","number":4344,"state":"open","locked":false,"title":"[ThreadPool] Solve thread transitions issue","user":{"login":"FrozenGene","id":7287321,"node_id":"MDQ6VXNlcjcyODczMjE=","avatar_url":"https://avatars2.githubusercontent.com/u/7287321?v=4","gravatar_id":"","url":"https://api.github.com/users/FrozenGene","html_url":"https://github.com/FrozenGene","followers_url":"https://api.github.com/users/FrozenGene/followers","following_url":"https://api.github.com/users/FrozenGene/following{/other_user}","gists_url":"https://api.github.com/users/FrozenGene/gists{/gist_id}","starred_url":"https://api.github.com/users/FrozenGene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FrozenGene/subscriptions","organizations_url":"https://api.github.com/users/FrozenGene/orgs","repos_url":"https://api.github.com/users/FrozenGene/repos","events_url":"https://api.github.com/users/FrozenGene/events{/privacy}","received_events_url":"https://api.github.com/users/FrozenGene/received_events","type":"User","site_admin":false},"body":"This pr solves thread transitions issue. \r\n\r\nWhen we use OpenCV + TVM, we will produce much thread transitions so that OpenCV + TVM is slow. Auto tuning has issue too. The reason is we bind task 0 to master cpu by default.\r\n\r\nMore detail / background and reproduceable test case: https://discuss.tvm.ai/t/use-tvm-darknet-to-detect-vidoes-after-relay-build-module-build-cv2-ops-cost-much-more-time/4730/\r\n\r\nAfter this PR, we don't bind task 0 to master cpu by default but export one environment `TVM_EXCLUDE_WORKER0` to set. If users set `TVM_EXCLUDE_WORKER0` be 1, we will bind task 0 to master as previous.\r\n\r\n@vinx13 @yidawang @tqchen ","created_at":"2019-11-15T03:55:19Z","updated_at":"2019-11-20T17:35:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"41a4d290a71a9801ee0ebec086c9c827b8929d96","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":858780915,"node_id":"MDU6TGFiZWw4NTg3ODA5MTU=","url":"https://api.github.com/repos/apache/incubator-tvm/labels/status:%20need%20review","name":"status: need review","color":"fbca04","default":false,"description":""}],"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-tvm/pulls/4344/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-tvm/pulls/4344/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-tvm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-tvm/issues/4344/comments","statuses_url":"https://api.github.com/repos/apache/incubator-tvm/statuses/63994477bcc2c8cdd08e4fb061a687cecb3eebe0","head":{"label":"FrozenGene:thread","ref":"thread","sha":"63994477bcc2c8cdd08e4fb061a687cecb3eebe0","user":{"login":"FrozenGene","id":7287321,"node_id":"MDQ6VXNlcjcyODczMjE=","avatar_url":"https://avatars2.githubusercontent.com/u/7287321?v=4","gravatar_id":"","url":"https://api.github.com/users/FrozenGene","html_url":"https://github.com/FrozenGene","followers_url":"https://api.github.com/users/FrozenGene/followers","following_url":"https://api.github.com/users/FrozenGene/following{/other_user}","gists_url":"https://api.github.com/users/FrozenGene/gists{/gist_id}","starred_url":"https://api.github.com/users/FrozenGene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FrozenGene/subscriptions","organizations_url":"https://api.github.com/users/FrozenGene/orgs","repos_url":"https://api.github.com/users/FrozenGene/repos","events_url":"https://api.github.com/users/FrozenGene/events{/privacy}","received_events_url":"https://api.github.com/users/FrozenGene/received_events","type":"User","site_admin":false},"repo":{"id":155194851,"node_id":"MDEwOlJlcG9zaXRvcnkxNTUxOTQ4NTE=","name":"tvm","full_name":"FrozenGene/tvm","private":false,"owner":{"login":"FrozenGene","id":7287321,"node_id":"MDQ6VXNlcjcyODczMjE=","avatar_url":"https://avatars2.githubusercontent.com/u/7287321?v=4","gravatar_id":"","url":"https://api.github.com/users/FrozenGene","html_url":"https://github.com/FrozenGene","followers_url":"https://api.github.com/users/FrozenGene/followers","following_url":"https://api.github.com/users/FrozenGene/following{/other_user}","gists_url":"https://api.github.com/users/FrozenGene/gists{/gist_id}","starred_url":"https://api.github.com/users/FrozenGene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FrozenGene/subscriptions","organizations_url":"https://api.github.com/users/FrozenGene/orgs","repos_url":"https://api.github.com/users/FrozenGene/repos","events_url":"https://api.github.com/users/FrozenGene/events{/privacy}","received_events_url":"https://api.github.com/users/FrozenGene/received_events","type":"User","site_admin":false},"html_url":"https://github.com/FrozenGene/tvm","description":"Open deep learning compiler stack for cpu, gpu and specialized accelerators","fork":true,"url":"https://api.github.com/repos/FrozenGene/tvm","forks_url":"https://api.github.com/repos/FrozenGene/tvm/forks","keys_url":"https://api.github.com/repos/FrozenGene/tvm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FrozenGene/tvm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FrozenGene/tvm/teams","hooks_url":"https://api.github.com/repos/FrozenGene/tvm/hooks","issue_events_url":"https://api.github.com/repos/FrozenGene/tvm/issues/events{/number}","events_url":"https://api.github.com/repos/FrozenGene/tvm/events","assignees_url":"https://api.github.com/repos/FrozenGene/tvm/assignees{/user}","branches_url":"https://api.github.com/repos/FrozenGene/tvm/branches{/branch}","tags_url":"https://api.github.com/repos/FrozenGene/tvm/tags","blobs_url":"https://api.github.com/repos/FrozenGene/tvm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FrozenGene/tvm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FrozenGene/tvm/git/refs{/sha}","trees_url":"https://api.github.com/repos/FrozenGene/tvm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FrozenGene/tvm/statuses/{sha}","languages_url":"https://api.github.com/repos/FrozenGene/tvm/languages","stargazers_url":"https://api.github.com/repos/FrozenGene/tvm/stargazers","contributors_url":"https://api.github.com/repos/FrozenGene/tvm/contributors","subscribers_url":"https://api.github.com/repos/FrozenGene/tvm/subscribers","subscription_url":"https://api.github.com/repos/FrozenGene/tvm/subscription","commits_url":"https://api.github.com/repos/FrozenGene/tvm/commits{/sha}","git_commits_url":"https://api.github.com/repos/FrozenGene/tvm/git/commits{/sha}","comments_url":"https://api.github.com/repos/FrozenGene/tvm/comments{/number}","issue_comment_url":"https://api.github.com/repos/FrozenGene/tvm/issues/comments{/number}","contents_url":"https://api.github.com/repos/FrozenGene/tvm/contents/{+path}","compare_url":"https://api.github.com/repos/FrozenGene/tvm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FrozenGene/tvm/merges","archive_url":"https://api.github.com/repos/FrozenGene/tvm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FrozenGene/tvm/downloads","issues_url":"https://api.github.com/repos/FrozenGene/tvm/issues{/number}","pulls_url":"https://api.github.com/repos/FrozenGene/tvm/pulls{/number}","milestones_url":"https://api.github.com/repos/FrozenGene/tvm/milestones{/number}","notifications_url":"https://api.github.com/repos/FrozenGene/tvm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FrozenGene/tvm/labels{/name}","releases_url":"https://api.github.com/repos/FrozenGene/tvm/releases{/id}","deployments_url":"https://api.github.com/repos/FrozenGene/tvm/deployments","created_at":"2018-10-29T10:43:18Z","updated_at":"2019-11-04T17:35:33Z","pushed_at":"2019-11-20T11:16:04Z","git_url":"git://github.com/FrozenGene/tvm.git","ssh_url":"git@github.com:FrozenGene/tvm.git","clone_url":"https://github.com/FrozenGene/tvm.git","svn_url":"https://github.com/FrozenGene/tvm","homepage":"https://tvm.ai","size":18767,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"26eb4053071750b6c48f5da3cd6510d0c96a74d9","user":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":70746484,"node_id":"MDEwOlJlcG9zaXRvcnk3MDc0NjQ4NA==","name":"incubator-tvm","full_name":"apache/incubator-tvm","private":false,"owner":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/apache/incubator-tvm","description":"Open deep learning compiler stack for cpu, gpu and specialized accelerators","fork":false,"url":"https://api.github.com/repos/apache/incubator-tvm","forks_url":"https://api.github.com/repos/apache/incubator-tvm/forks","keys_url":"https://api.github.com/repos/apache/incubator-tvm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-tvm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-tvm/teams","hooks_url":"https://api.github.com/repos/apache/incubator-tvm/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-tvm/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-tvm/events","assignees_url":"https://api.github.com/repos/apache/incubator-tvm/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-tvm/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-tvm/tags","blobs_url":"https://api.github.com/repos/apache/incubator-tvm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-tvm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-tvm/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-tvm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-tvm/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-tvm/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-tvm/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-tvm/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-tvm/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-tvm/subscription","commits_url":"https://api.github.com/repos/apache/incubator-tvm/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-tvm/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-tvm/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-tvm/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-tvm/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-tvm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-tvm/merges","archive_url":"https://api.github.com/repos/apache/incubator-tvm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-tvm/downloads","issues_url":"https://api.github.com/repos/apache/incubator-tvm/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-tvm/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-tvm/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-tvm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-tvm/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-tvm/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-tvm/deployments","created_at":"2016-10-12T22:20:28Z","updated_at":"2019-11-20T17:31:38Z","pushed_at":"2019-11-20T17:31:35Z","git_url":"git://github.com/apache/incubator-tvm.git","ssh_url":"git@github.com:apache/incubator-tvm.git","clone_url":"https://github.com/apache/incubator-tvm.git","svn_url":"https://github.com/apache/incubator-tvm","homepage":"https://tvm.ai","size":18776,"stargazers_count":4651,"watchers_count":4651,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1214,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":140,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":1214,"open_issues":140,"watchers":4651,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-tvm/pulls/4344"},"html":{"href":"https://github.com/apache/incubator-tvm/pull/4344"},"issue":{"href":"https://api.github.com/repos/apache/incubator-tvm/issues/4344"},"comments":{"href":"https://api.github.com/repos/apache/incubator-tvm/issues/4344/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-tvm/pulls/4344/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-tvm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-tvm/pulls/4344/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-tvm/statuses/63994477bcc2c8cdd08e4fb061a687cecb3eebe0"}},"author_association":"CONTRIBUTOR"}}
other: {"actor":{"display_login":"tqchen"}}