-
Notifications
You must be signed in to change notification settings - Fork 91
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
[Feature][PyTorch migration rule] Added PyTorch build script migration rule file #2564
base: SYCLomatic
Are you sure you want to change the base?
Conversation
// check if RuleFilePaths contains any user specified python migration rule | ||
// file | ||
bool pythonRuleFilePresent = std::any_of( | ||
RuleFilePath.begin(), RuleFilePath.end(), | ||
[](const clang::tooling::UnifiedPath &path) { | ||
return path.getPath().contains("python_build_script_migration_rule"); | ||
}); | ||
|
||
if (!pythonRuleFilePresent) { | ||
SmallString<128> PythonRuleFilePath(DpctInstallPath.getCanonicalPath()); | ||
llvm::sys::path::append( | ||
PythonRuleFilePath, | ||
Twine("extensions/python_rules/" | ||
"python_build_script_migration_rule_pytorch.yaml")); | ||
if (llvm::sys::fs::exists(PythonRuleFilePath)) { | ||
std::vector<clang::tooling::UnifiedPath> PythonRuleFiles{ | ||
PythonRuleFilePath}; | ||
importRules(PythonRuleFiles); | ||
// generage helper functions file in the outroot dir here | ||
} |
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.
-
If both two yaml files(clang/tools/dpct/DpctOptRules/python_build_script_migration_rule_ipex.yaml, clang/tools/dpct/DpctOptRules/python_build_script_migration_rule_pytorch.yaml) exisit, which yaml files take effect?
-
clang/tools/dpct/DpctOptRules/python_build_script_migration_rule_ipex.yaml, clang/tools/dpct/DpctOptRules/python_build_script_migration_rule_pytorch.yaml have duplicate migration rules, we can keep only one copy, so that it is easy to maintain them.
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.
-
If any yaml file is specified with --rule-file option, then that rule file is chosen
a. If no --rule-file options is provided, by default, python_build_script_migration_rule_pytorch.yaml is chosen. -
Shall I create another yaml file (python_build_script_migration_rule.yaml) that is always loaded by default regardless of while --rule-file is loaded?
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.
In my opinion:
- When option " --migrate-build-script=Python " or " --migrate-build-script=Python --migrate-build-script-only" is specified, then python_build_script_migration_rule_pytorch.yaml is default loaded for pytorch xpu build env
- When option " --migrate-build-script=Python " or " --migrate-build-script=Python --migrate-build-script-only" is specified, and --rule-file = python_build_script_migration_rule_ipex.yaml is specified, then python_build_script_migration_rule_ipex.yam is loaded for ipex build env.
- As to the common rules between python_build_script_migration_rule_pytorch.yaml and python_build_script_migration_rule_ipex.yaml should be only left in python_build_script_migration_rule_pytorch.yaml, and python_build_script_migration_rule_ipex.yaml files only keeps the rule specific for IPEX.
This PR introduces python_build_script_migration_rule_pytorch.yaml rule file for Python script migration using PyTorch's XPU class instead of IPEX's XPU