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

[AutoScheduler] Add custom build function #7185

Merged
merged 6 commits into from
Jan 5, 2021

Conversation

leowang1225
Copy link
Contributor

Signed-off-by: leowang1225 810916296@qq.com

Thanks for contributing to TVM! Please refer to guideline https://tvm.apache.org/docs/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from Reviewers by @ them in the pull request thread.

Signed-off-by: leowang1225 <810916296@qq.com>
@leowang1225
Copy link
Contributor Author

Signed-off-by: leowang1225 810916296@qq.com

Thanks for contributing to TVM! Please refer to guideline https://tvm.apache.org/docs/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from Reviewers by @ them in the pull request thread.

@merrymercy @FrozenGene please help to review!

python/tvm/auto_scheduler/measure.py Outdated Show resolved Hide resolved
python/tvm/auto_scheduler/measure.py Outdated Show resolved Hide resolved
python/tvm/auto_scheduler/measure.py Outdated Show resolved Hide resolved
Signed-off-by: leowang1225 <810916296@qq.com>
"""

def __init__(self, timeout=15, n_parallel=multiprocessing.cpu_count(), build_func="default"):
self.__init_handle_by_constructor__(_ffi_api.LocalBuilder, timeout, n_parallel, build_func)
if build_func == "default":
Copy link
Contributor

Choose a reason for hiding this comment

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

So this is designed to use the class static member?
Why not just use a self.build_func.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

when auto_scheduler.local_builder.build is called, the context can't get LocalBuilder class instance

Copy link
Member

Choose a reason for hiding this comment

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

He should keep the state information of build_func between functions, so just self.build_func can not meet the requirement because we will create one class instance.

Copy link
Contributor

Choose a reason for hiding this comment

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

@FrozenGene @leowang1225
Since we pass the BuildFunc.name to the constructor, how about just register the custom build function by @tvm._ffi.register_func and pass the fuction name to it?
In this way, it can be serialized in args in the local_build_worker below.

python/tvm/auto_scheduler/measure.py Outdated Show resolved Hide resolved
Signed-off-by: leowang1225 <810916296@qq.com>
@FrozenGene
Copy link
Member

@jcf94 could you have another one round of review?

"""

def __init__(self, timeout=15, n_parallel=multiprocessing.cpu_count(), build_func="default"):
self.__init_handle_by_constructor__(_ffi_api.LocalBuilder, timeout, n_parallel, build_func)
if build_func == "default":
Copy link
Contributor

Choose a reason for hiding this comment

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

@FrozenGene @leowang1225
Since we pass the BuildFunc.name to the constructor, how about just register the custom build function by @tvm._ffi.register_func and pass the fuction name to it?
In this way, it can be serialized in args in the local_build_worker below.

python/tvm/auto_scheduler/measure.py Show resolved Hide resolved
@jcf94
Copy link
Contributor

jcf94 commented Jan 4, 2021

@jcf94 could you have another one round of review?

Sorry for I'm a little busy this afternoon.

Copy link
Contributor

@jcf94 jcf94 left a comment

Choose a reason for hiding this comment

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

Currently I don't have any better suggestions.

Signed-off-by: leowang1225 <810916296@qq.com>
@FrozenGene FrozenGene merged commit 23bd825 into apache:main Jan 5, 2021
@FrozenGene
Copy link
Member

Thanks for the great work @leowang1225 and thanks for the reviewing @jcf94 , it is merged now.

tkonolige pushed a commit to tkonolige/incubator-tvm that referenced this pull request Jan 11, 2021
* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* cheduler] Add custom build function

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>
masahi pushed a commit to masahi/tvm that referenced this pull request Jan 14, 2021
* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* cheduler] Add custom build function

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>
TusharKanekiDey pushed a commit to TusharKanekiDey/tvm that referenced this pull request Jan 20, 2021
* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* cheduler] Add custom build function

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Jan 21, 2021
* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* cheduler] Add custom build function

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>
electriclilies pushed a commit to electriclilies/tvm that referenced this pull request Feb 18, 2021
* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* cheduler] Add custom build function

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>

* [AutoScheduler] Add custom build function

Signed-off-by: leowang1225 <810916296@qq.com>
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.

3 participants