Lib.export_library cc param was renamed to compile_cmd


#1

This is not a question but smth which google hopefully can find.
lib.export_library cc param was renamed to compile_cmd (at least for Relay)

# before:
lib.export_library(path_lib, cc="arm-linux-gnueabihf-g++")

# now:
lib.export_library(path_lib, compile_cmd="arm-linux-gnueabihf-g++")

PR: https://github.com/dmlc/tvm/pull/3227


#2

PR to Revert compile_cmd kwarg name change was merged


Thank you @weberlo !


#3

@weberlo What is the recommended way to create build function for ARMv7 devices now?

before PR-3227 I just did

build_func = cc.cross_compiler(cc="arm-linux-gnueabihf-g++")

But cc.cross_compiler API was changed - string cc was replaced with function compile_func

I ended up with the following code where I create my own function arm_gnueabihf_create_shared just to override default compile_cmd from g++ to arm-linux-gnueabihf-g++
It works but it is not that simple. Do you have better way to get build_func which uses arm-linux-gnueabihf-g++ internally?

from tvm.contrib import cc

def arm_gnueabihf_create_shared(output, 
                                objects, 
                                options=None,
                                compile_cmd="arm-linux-gnueabihf-g++"):
    cc.create_shared(output, objects, options, compile_cmd)

arm_gnueabihf_create_shared.output_format = "so"

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

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

#4

I opened PR to simplify build_func creation - https://github.com/dmlc/tvm/pull/3840