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

[Target] Add support for target object with host field compatible with previous api #7534

Merged
merged 74 commits into from
Mar 31, 2021

Conversation

zxybazh
Copy link
Member

@zxybazh zxybazh commented Feb 26, 2021

This PR is to support the new target obejct with host field in TVM, migrating functions to support both version. Future deprecation of old target host api is pending dicussion in the RFC channel. Fixed the problem of adding existing target host to its target.

@zxybazh
Copy link
Member Author

zxybazh commented Feb 26, 2021

This is the python script part and a lot of testcases could be added.

@junrushao
Copy link
Member

Let's also note the potential influence that this change can affect the target string used in AutoTVM/Ansor and avoid introducing any regression.

@junrushao
Copy link
Member

@zxybazh would you like to fix the CI issue? Thanks a lot!

Copy link
Member

@junrushao junrushao left a comment

Choose a reason for hiding this comment

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

Thanks for the improvement! Please find my review below

include/tvm/target/target.h Outdated Show resolved Hide resolved
Comment on lines 180 to 182
TVM_DLL void RefreshHost(Target*, Target*);
TVM_DLL void RefreshHost(TargetsMap*, Target*);
TVM_DLL void RefreshHost(Map<Target, IRModule>*, Target*);
Copy link
Member

Choose a reason for hiding this comment

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

  1. Functions in the header file needs clear documentation. More specifically, we need to document very clearly that those functions are not encouraged for common use :-)
  2. Please list the names of arguments.
  3. Also, please consider a name for the function better indicating they are dedicated to legacy behavior. What about Target::SplitIntoLegacyTargetPair?
  4. Consider moving those functions into static functions of the Target class

Copy link
Member Author

Choose a reason for hiding this comment

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

I found that I cannot move the part of the helper function into the Target class because it requires a Map<Target, ObjectRef> type which cannot be compiled correctly. Therefore, I would put the functions outside the class for now.

python/tvm/autotvm/measure/measure_methods.py Outdated Show resolved Hide resolved
python/tvm/autotvm/task/relay_integration.py Outdated Show resolved Hide resolved
python/tvm/relay/backend/vm.py Outdated Show resolved Hide resolved
python/tvm/target/target.py Outdated Show resolved Hide resolved
python/tvm/target/target.py Outdated Show resolved Hide resolved
python/tvm/target/target.py Outdated Show resolved Hide resolved
src/auto_scheduler/measure_record.cc Outdated Show resolved Hide resolved
src/target/target.cc Outdated Show resolved Hide resolved
Copy link
Member

@junrushao junrushao 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 @zxybazh for the contribution!

@junrushao junrushao merged commit 0bd1536 into apache:main Mar 31, 2021
@zxybazh zxybazh deleted the target branch April 26, 2021 21:20
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
…h previous api (apache#7534)

* Fix legacy code on target host

* Modify legacy code for target host change

* Add tests and fix merge issue

* Add condition for same host

* Modify all files for new target host api compatibility

* Add newline

* Change import format

* Optimize test file

* Add match error info for unit tests

* Fix for heterogeneous targets

* Fix format for dict iteration

* Fix target host type error

* Skip one testcase for tvm infinite loop bug

* Fixed bug for target map compatibility

* Fix another TargetsMap issue

* Fix typo and infinite loop error

* Temporary fix for handle issue

* Fix vm target

* Add condition support for str case

* Add GetHost function and fix previous bugs

* Fix measure_record.cc

* Fix search_task.cc

* Fix compiler.cc, memory_alloc.cc

* Fix driver_api.cc

* Fix format

* Fix bugs and GetHost function usage

* Fix clang format

* Fix bug

* Modify python tests

* Change python unit tests to new target api

* Fi test_runtime_heterogeneous.py

* Modify tutorials & remove extra print

* Update more tests to new api

* Refine the tutorial target usage

* change argument name for Target constructor function

* Fix target export function

* Fix and validate all tutorial usage

* Remove unused argument

* Fix format

* Fix bug in driver/build_module.py for heterogeneous target

* Fix bug in driver/build_module.py for heterogeneous target more

* Fix target host type error

* Fix cudnn target host bug

* Fix according to reviews, add helper function in python

* Refactor code as helper function

* Expand helper function

* Fix bug add and update python helper function

* Update target hosts

* Fix format & refresh function

* Fix unit test bug

* Fix bug in refreshing host

* Fix bug

* Add SetHost function

* Update export function

* Fix format

* Fix export bug in target

* Fix bug on host referencing

* Addtional tests

* Address review issues

* Fix format target.py

* Fix issues and format

* Add some 3rd party dependencies

* Merge main branch

* Fix target.h format

* Remove redundent import

* Fix function name

* Add parameter name

* Fix new code bug

* Fix bug in lowering
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
…h previous api (apache#7534)

* Fix legacy code on target host

* Modify legacy code for target host change

* Add tests and fix merge issue

* Add condition for same host

* Modify all files for new target host api compatibility

* Add newline

* Change import format

* Optimize test file

* Add match error info for unit tests

* Fix for heterogeneous targets

* Fix format for dict iteration

* Fix target host type error

* Skip one testcase for tvm infinite loop bug

* Fixed bug for target map compatibility

* Fix another TargetsMap issue

* Fix typo and infinite loop error

* Temporary fix for handle issue

* Fix vm target

* Add condition support for str case

* Add GetHost function and fix previous bugs

* Fix measure_record.cc

* Fix search_task.cc

* Fix compiler.cc, memory_alloc.cc

* Fix driver_api.cc

* Fix format

* Fix bugs and GetHost function usage

* Fix clang format

* Fix bug

* Modify python tests

* Change python unit tests to new target api

* Fi test_runtime_heterogeneous.py

* Modify tutorials & remove extra print

* Update more tests to new api

* Refine the tutorial target usage

* change argument name for Target constructor function

* Fix target export function

* Fix and validate all tutorial usage

* Remove unused argument

* Fix format

* Fix bug in driver/build_module.py for heterogeneous target

* Fix bug in driver/build_module.py for heterogeneous target more

* Fix target host type error

* Fix cudnn target host bug

* Fix according to reviews, add helper function in python

* Refactor code as helper function

* Expand helper function

* Fix bug add and update python helper function

* Update target hosts

* Fix format & refresh function

* Fix unit test bug

* Fix bug in refreshing host

* Fix bug

* Add SetHost function

* Update export function

* Fix format

* Fix export bug in target

* Fix bug on host referencing

* Addtional tests

* Address review issues

* Fix format target.py

* Fix issues and format

* Add some 3rd party dependencies

* Merge main branch

* Fix target.h format

* Remove redundent import

* Fix function name

* Add parameter name

* Fix new code bug

* Fix bug in lowering
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
…h previous api (apache#7534)

* Fix legacy code on target host

* Modify legacy code for target host change

* Add tests and fix merge issue

* Add condition for same host

* Modify all files for new target host api compatibility

* Add newline

* Change import format

* Optimize test file

* Add match error info for unit tests

* Fix for heterogeneous targets

* Fix format for dict iteration

* Fix target host type error

* Skip one testcase for tvm infinite loop bug

* Fixed bug for target map compatibility

* Fix another TargetsMap issue

* Fix typo and infinite loop error

* Temporary fix for handle issue

* Fix vm target

* Add condition support for str case

* Add GetHost function and fix previous bugs

* Fix measure_record.cc

* Fix search_task.cc

* Fix compiler.cc, memory_alloc.cc

* Fix driver_api.cc

* Fix format

* Fix bugs and GetHost function usage

* Fix clang format

* Fix bug

* Modify python tests

* Change python unit tests to new target api

* Fi test_runtime_heterogeneous.py

* Modify tutorials & remove extra print

* Update more tests to new api

* Refine the tutorial target usage

* change argument name for Target constructor function

* Fix target export function

* Fix and validate all tutorial usage

* Remove unused argument

* Fix format

* Fix bug in driver/build_module.py for heterogeneous target

* Fix bug in driver/build_module.py for heterogeneous target more

* Fix target host type error

* Fix cudnn target host bug

* Fix according to reviews, add helper function in python

* Refactor code as helper function

* Expand helper function

* Fix bug add and update python helper function

* Update target hosts

* Fix format & refresh function

* Fix unit test bug

* Fix bug in refreshing host

* Fix bug

* Add SetHost function

* Update export function

* Fix format

* Fix export bug in target

* Fix bug on host referencing

* Addtional tests

* Address review issues

* Fix format target.py

* Fix issues and format

* Add some 3rd party dependencies

* Merge main branch

* Fix target.h format

* Remove redundent import

* Fix function name

* Add parameter name

* Fix new code bug

* Fix bug in lowering
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request May 11, 2021
…h previous api (apache#7534)

* Fix legacy code on target host

* Modify legacy code for target host change

* Add tests and fix merge issue

* Add condition for same host

* Modify all files for new target host api compatibility

* Add newline

* Change import format

* Optimize test file

* Add match error info for unit tests

* Fix for heterogeneous targets

* Fix format for dict iteration

* Fix target host type error

* Skip one testcase for tvm infinite loop bug

* Fixed bug for target map compatibility

* Fix another TargetsMap issue

* Fix typo and infinite loop error

* Temporary fix for handle issue

* Fix vm target

* Add condition support for str case

* Add GetHost function and fix previous bugs

* Fix measure_record.cc

* Fix search_task.cc

* Fix compiler.cc, memory_alloc.cc

* Fix driver_api.cc

* Fix format

* Fix bugs and GetHost function usage

* Fix clang format

* Fix bug

* Modify python tests

* Change python unit tests to new target api

* Fi test_runtime_heterogeneous.py

* Modify tutorials & remove extra print

* Update more tests to new api

* Refine the tutorial target usage

* change argument name for Target constructor function

* Fix target export function

* Fix and validate all tutorial usage

* Remove unused argument

* Fix format

* Fix bug in driver/build_module.py for heterogeneous target

* Fix bug in driver/build_module.py for heterogeneous target more

* Fix target host type error

* Fix cudnn target host bug

* Fix according to reviews, add helper function in python

* Refactor code as helper function

* Expand helper function

* Fix bug add and update python helper function

* Update target hosts

* Fix format & refresh function

* Fix unit test bug

* Fix bug in refreshing host

* Fix bug

* Add SetHost function

* Update export function

* Fix format

* Fix export bug in target

* Fix bug on host referencing

* Addtional tests

* Address review issues

* Fix format target.py

* Fix issues and format

* Add some 3rd party dependencies

* Merge main branch

* Fix target.h format

* Remove redundent import

* Fix function name

* Add parameter name

* Fix new code bug

* Fix bug in lowering
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