Skip to content

Commit fa88075

Browse files
committed
[SYCLomatic] Fix bug that dpct.cmake is copied into out-root directory when both --migrate-build-script=Python and --migrate-build-script-onlyare specified
Signed-off-by: chenwei.sun <chenwei.sun@intel.com>
1 parent dba8684 commit fa88075

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

clang/lib/DPCT/DPCT.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,8 @@ static void loadMainSrcFileInfo(clang::tooling::UnifiedPath OutRoot) {
525525
llvm::errs() << getLoadYamlFailWarning(YamlFilePath);
526526
}
527527

528-
if (MigrateBuildScriptOnly || DpctGlobalInfo::migrateCMakeScripts()) {
528+
if (MigrateBuildScriptOnly && !DpctGlobalInfo::migratePythonScripts() ||
529+
DpctGlobalInfo::migrateCMakeScripts()) {
529530
std::string Major = PreTU->SDKVersionMajor;
530531
std::string Minor = PreTU->SDKVersionMinor;
531532
if (!Major.empty() && !Minor.empty()) {

clang/test/dpct/python_migration/case_006/case_006_torch_cuda.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@
77

88
// RUN: dpct -in-root ./ -out-root out_ipex ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_ipex.yaml
99
// RUN: diff --strip-trailing-cr %S/expected.py %T/out_ipex/input.py >> %T/diff.txt
10+
11+
// RUN: mkdir -p %T/out_pytorch1
12+
// RUN: cp %S/MainSourceFiles.yaml %T/out_pytorch1/MainSourceFiles.yaml
13+
// RUN: dpct -in-root ./ -out-root out_pytorch1 ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_pytorch.yaml
14+
// RUN: diff --strip-trailing-cr %S/expected.py %T/out_pytorch1/input.py >> %T/diff.txt
15+
// RUN: test ! -f %T/out_pytorch1/dpct.cmake

0 commit comments

Comments
 (0)