Skip to content

Add build_create_shared_func to tvm/contrib/cc.py#3840

Merged
merrymercy merged 1 commit intoapache:masterfrom
apivovarov:build_create_shared
Aug 29, 2019
Merged

Add build_create_shared_func to tvm/contrib/cc.py#3840
merrymercy merged 1 commit intoapache:masterfrom
apivovarov:build_create_shared

Conversation

@apivovarov
Copy link
Contributor

@apivovarov apivovarov commented Aug 27, 2019

This builder functions allows to build create_shared function with particular default options and compile_cmd.
Returned function can be used in autotune.LocalBuilder

Example:

# Create tuning_option for ARMv7 hf device (which does not have g++ installed)
from tvm.contrib import cc
build_func = cc.build_create_shared_func(compile_cmd="arm-linux-gnueabihf-g++")

tuning_option = {
    'tuner': 'xgb',
    'n_trial': 1500,
    'early_stopping': 800,

    'measure_option': autotvm.measure_option(
        builder=autotvm.LocalBuilder(
            build_func=build_func
        ),
        runner=autotvm.RPCRunner(
            device_key, host=tr_addr, port=tr_port,
            number=5,
            timeout=10,
        ),
    ),
}

The tuning_option above can be used to tune models for ARMv7 hf devices which does not have g++ installed. Auto-tuning a convolutional network for ARM CPU

Discussion - https://discuss.tvm.ai/t/lib-export-library-cc-param-was-renamed-to-compile-cmd/3644/3

@apivovarov
Copy link
Contributor Author

@weberlo Can you have a look?

@zhiics
Copy link
Member

zhiics commented Aug 27, 2019

LGTM. @merrymercy Can you take a look? Thanks.

Parameters
----------
options : List[str]
The list of additional options string.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this argument meant to specify a base of compiler options or a default set of compiler options. That meaning, if you pass in options=['a'], and the resulting create_shared_wrapper gets called with options=['b'], is the intent that options == ['a', 'b'] or options == ['b']? Because I think the code currently does the latter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My intent was to havecreate_shared function builder which allows me to specify returned function default options and compile_cmd.

@merrymercy merrymercy merged commit 7391fc0 into apache:master Aug 29, 2019
@merrymercy
Copy link
Member

Thanks @apivovarov! It is merged

wweic pushed a commit to wweic/tvm that referenced this pull request Sep 16, 2019
wweic pushed a commit to wweic/tvm that referenced this pull request Sep 16, 2019
wweic pushed a commit to neo-ai/tvm that referenced this pull request Sep 16, 2019
@apivovarov apivovarov deleted the build_create_shared branch October 19, 2019 01:10
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