-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Conversation
This is the python script part and a lot of testcases could be added. |
Let's also note the potential influence that this change can affect the target string used in AutoTVM/Ansor and avoid introducing any regression. |
@zxybazh would you like to fix the CI issue? Thanks a lot! |
There was a problem hiding this 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
TVM_DLL void RefreshHost(Target*, Target*); | ||
TVM_DLL void RefreshHost(TargetsMap*, Target*); | ||
TVM_DLL void RefreshHost(Map<Target, IRModule>*, Target*); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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 :-)
- Please list the names of arguments.
- Also, please consider a name for the function better indicating they are dedicated to legacy behavior. What about
Target::SplitIntoLegacyTargetPair
? - Consider moving those functions into static functions of the Target class
There was a problem hiding this comment.
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.
There was a problem hiding this 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!
…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
…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
…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
…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
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.