-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCLomatic][BUG fix]Bug fixes for Python script migration (#2530)
- Loading branch information
1 parent
59ccd86
commit 1782388
Showing
13 changed files
with
182 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
cuda_sources = list(glob.glob(os.path.join(extensions_cuda_dir, "*.cpp"))) | ||
cuda_sources = list(glob.glob(os.path.join(extensions_cuda_dir, "*.dp.cpp"))) | ||
|
||
# srcs in normal args (single & double quotes) | ||
## single quote | ||
out = func('foo.cpp', 'bar.dp.cpp') | ||
## double quotes | ||
out = func("foo.cpp", "bar.dp.cpp") | ||
|
||
# srcs in list arg | ||
## single quote | ||
out = func(['foo.cpp', 'bar.dp.cpp']) | ||
## double quotes | ||
out = func(["foo.cpp", "bar.dp.cpp"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
cuda_sources = list(glob.glob(os.path.join(extensions_cuda_dir, "*.cu"))) | ||
|
||
# srcs in normal args (single & double quotes) | ||
## single quote | ||
out = func('foo.cpp', 'bar.cu') | ||
## double quotes | ||
out = func("foo.cpp", "bar.cu") | ||
|
||
# srcs in list arg | ||
## single quote | ||
out = func(['foo.cpp', 'bar.cu']) | ||
## double quotes | ||
out = func(["foo.cpp", "bar.cu"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
setup( | ||
name='quant_cuda', | ||
ext_modules=[cpp_extension.DPCPPExtension( | ||
'quant_cuda', ['quant_cuda.cpp', 'quant_cuda_kernel.cpp'] | ||
'quant_cuda', ["quant_cuda.cpp", 'quant_cuda_kernel.dp.cpp'] | ||
, include_dirs=cpp_extension.include_paths(),)], | ||
cmdclass={'build_ext': cpp_extension.DpcppBuildExtension} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
setup( | ||
name='quant_cuda', | ||
ext_modules=[cpp_extension.CUDAExtension( | ||
'quant_cuda', ['quant_cuda.cpp', 'quant_cuda_kernel.cu'] | ||
'quant_cuda', ["quant_cuda.cpp", 'quant_cuda_kernel.cu'] | ||
)], | ||
cmdclass={'build_ext': cpp_extension.BuildExtension} | ||
) |
83 changes: 83 additions & 0 deletions
83
clang/test/dpct/python_migration/case_007/MainSourceFiles.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
--- | ||
MainSourceFile: '/path/to/MainSrcFiles_placehold' | ||
Replacements: | ||
- FilePath: '/path/to/src/foo.cpp' | ||
Offset: 0 | ||
Length: 0 | ||
ReplacementText: '' | ||
ConstantFlag: '' | ||
ConstantOffset: 0 | ||
InitStr: '' | ||
NewHostVarName: '' | ||
BlockLevelFormatFlag: false | ||
- FilePath: '/path/to/src/baz.cpp' | ||
Offset: 0 | ||
Length: 0 | ||
ReplacementText: '' | ||
ConstantFlag: '' | ||
ConstantOffset: 0 | ||
InitStr: '' | ||
NewHostVarName: '' | ||
BlockLevelFormatFlag: false | ||
|
||
MainSourceFilesDigest: | ||
- MainSourceFile: '/path/to/src/foo.cpp' | ||
Digest: e2636fb8d174ac319083b0306294d3bd | ||
HasCUDASyntax: true | ||
- MainSourceFile: '/path/to/src/baz.cpp' | ||
Digest: 991d7e4825fc597205bf68f2eda27acd | ||
HasCUDASyntax: false | ||
DpctVersion: 19.0.0 | ||
MainHelperFileName: '' | ||
USMLevel: '' | ||
FeatureMap: {} | ||
CompileTargets: {} | ||
OptionMap: | ||
AnalysisScopePath: | ||
Value: '/path/to//target' | ||
Specified: false | ||
AsyncHandler: | ||
Value: 'false' | ||
Specified: false | ||
BuildScript: | ||
Value: '1' | ||
Specified: true | ||
CodePinEnabled: | ||
Value: 'false' | ||
Specified: false | ||
CommentsEnabled: | ||
Value: 'false' | ||
Specified: false | ||
CompilationsDir: | ||
Value: '/path/to/build' | ||
Specified: true | ||
CtadEnabled: | ||
Value: 'false' | ||
Specified: false | ||
EnablepProfiling: | ||
Value: 'true' | ||
Specified: true | ||
ExperimentalFlag: | ||
Value: '16384' | ||
Specified: true | ||
ExplicitNamespace: | ||
Value: '20' | ||
Specified: false | ||
ExtensionDDFlag: | ||
Value: '0' | ||
Specified: false | ||
ExtensionDEFlag: | ||
Value: '4294967295' | ||
Specified: false | ||
RuleFile: | ||
Value: '' | ||
ValueVec: | ||
- '/path/to/python_build_script_migration_rule_ipex.yaml' | ||
Specified: false | ||
SyclNamedLambda: | ||
Value: 'false' | ||
Specified: false | ||
UsmLevel: | ||
Value: '1' | ||
Specified: false | ||
... |
12 changes: 12 additions & 0 deletions
12
clang/test/dpct/python_migration/case_007/case_007_test_extension_name.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// RUN: rm -rf %T && mkdir -p %T | ||
// RUN: cd %T | ||
// RUN: mkdir -p out | ||
// RUN: cp %S/input.py ./input.py | ||
// RUN: cp %S/MainSourceFiles.yaml ./out/MainSourceFiles.yaml | ||
// RUN: dpct -in-root ./ -out-root out ./input.py --migrate-build-script-only | ||
// RUN: echo "begin" > %T/diff.txt | ||
// RUN: diff --strip-trailing-cr %S/expected.py %T/out/input.py >> %T/diff.txt | ||
// RUN: echo "end" >> %T/diff.txt | ||
|
||
// CHECK: begin | ||
// CHECK-NEXT: end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# baz.cpp is a C++ file | ||
out = func("bar.dp.cpp", "baz.cpp") | ||
# foo.cpp is a C++ file with CUDA syntax | ||
out = func("foo.cpp.dp.cpp", "bar.dp.cpp") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# baz.cpp is a C++ file | ||
out = func("bar.cu", "baz.cpp") | ||
# foo.cpp is a C++ file with CUDA syntax | ||
out = func("foo.cpp", "bar.cu") |
10 changes: 10 additions & 0 deletions
10
clang/test/dpct/python_migration/case_008/case_008_comments.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// RUN: rm -rf %T && mkdir -p %T | ||
// RUN: cd %T | ||
// RUN: cp %S/input.py ./input.py | ||
// RUN: dpct -in-root ./ -out-root out ./input.py --migrate-build-script-only | ||
// RUN: echo "begin" > %T/diff.txt | ||
// RUN: diff --strip-trailing-cr %S/expected.py %T/out/input.py >> %T/diff.txt | ||
// RUN: echo "end" >> %T/diff.txt | ||
|
||
// CHECK: begin | ||
// CHECK-NEXT: end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# import torch | ||
import torch | ||
import intel_extension_for_pytorch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# import torch | ||
import torch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters