Skip to content

Commit c97541b

Browse files
committed
Merge remote-tracking branch 'origin/SYCLomatic' into shared
2 parents 43a8124 + 7053fdf commit c97541b

11 files changed

Lines changed: 196 additions & 66 deletions

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/lib/DPCT/RulesAsm/Parser/AsmParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void InlineAsmParser::addBuiltinIdentifier() {
102102

103103
InlineAsmBuiltinType *
104104
InlineAsmContext::getBuiltinType(InlineAsmBuiltinType::TypeKind Kind) {
105-
assert(Kind > 0 && Kind < InlineAsmBuiltinType::NUM_TYPES && "Unknown Kind");
105+
assert(Kind >= 0 && Kind < InlineAsmBuiltinType::NUM_TYPES && "Unknown Kind");
106106
if (AsmBuiltinTypes[Kind])
107107
return AsmBuiltinTypes[Kind];
108108

clang/test/dpct/asm/optimize.cu

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,14 @@ __device__ int test5() {
176176
MACRO(7, s32 == 0, asm("add.s32.sat %0, %1, %2;" : "=r"(s32) : "r"(s32x), "r"(0)));
177177
return 0;
178178
}
179+
180+
// CHECK: inline void foo() {
181+
// CHECK-NEXT: #if defined(__SYCL_DEVICE_ONLY__) && defined(__NVPTX__)
182+
// CHECK-NEXT: asm volatile(".reg .b8 byte0;\n");
183+
// CHECK-NEXT: #else
184+
// CHECK-NEXT: uint8_t byte0;
185+
// CHECK-NEXT: #endif
186+
inline __device__ void foo() {
187+
asm volatile(".reg .b8 byte0;\n");
188+
}
189+

clang/test/dpct/lit.local.cfg

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ else:
124124

125125
# Run the dpct sanity test.
126126
if not config.unsupported:
127-
skipped_cases = ["cudnn_sanity.cu", "nccl_sanity.cu", "nvshmem.cu"]
127+
skipped_cases = ["cudnn_sanity.cu", "nccl_sanity.cu", "nvshmem.cu", "cutensor.cu"]
128128
complete_process = run_sanity("cudnn_sanity.cu")
129129
err_message = ""
130130
if complete_process.returncode != 0:
@@ -147,6 +147,13 @@ if not config.unsupported:
147147
"Please make sure install the header file of nvshmem and " + \
148148
"export nvshmem.h in CPATH.\n"
149149
skipped_cases.extend(get_skipped_cases_with_string("<nccl.h>"))
150+
complete_process = run_sanity("cutensor.cu")
151+
if complete_process.returncode != 0:
152+
if "'cutensor.h' file not found" in complete_process.stdout:
153+
err_message += "'cutensor.h' header file not found in platform. " + \
154+
"Please make sure install the header file of cuTENSOR and " + \
155+
"export cutensor.h in CPATH.\n"
156+
skipped_cases.extend(get_skipped_cases_with_string("<cutensor.h>"))
150157

151158
if (err_message):
152159
sys.stderr.write(err_message)
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
MainSourceFile: '/path/to/MainSrcFiles_placehold'
3+
Replacements:
4+
- FilePath: '/path/to/src/foo.cpp'
5+
Offset: 0
6+
Length: 0
7+
ReplacementText: ''
8+
ConstantFlag: ''
9+
ConstantOffset: 0
10+
InitStr: ''
11+
NewHostVarName: ''
12+
BlockLevelFormatFlag: false
13+
- FilePath: '/path/to/src/baz.cpp'
14+
Offset: 0
15+
Length: 0
16+
ReplacementText: ''
17+
ConstantFlag: ''
18+
ConstantOffset: 0
19+
InitStr: ''
20+
NewHostVarName: ''
21+
BlockLevelFormatFlag: false
22+
23+
MainSourceFilesDigest:
24+
- MainSourceFile: '/path/to/src/foo.cpp'
25+
Digest: e2636fb8d174ac319083b0306294d3bd
26+
HasCUDASyntax: true
27+
- MainSourceFile: '/path/to/src/baz.cpp'
28+
Digest: 991d7e4825fc597205bf68f2eda27acd
29+
HasCUDASyntax: true
30+
- MainSourceFile: '/path/to/src/layer.cudnn.cpp'
31+
Digest: 991d7e4825fc597205bf68f2eda27ace
32+
HasCUDASyntax: true
33+
- MainSourceFile: '/path/to/chash/chash.c'
34+
Digest: 9f681b5a2cafa7dff67d7e4ac13d1302
35+
HasCUDASyntax: true
36+
- MainSourceFile: '/path/to/cchash/cchash.cc'
37+
Digest: 9f681b5a2cafa7dff67d7e4ac13d1303
38+
HasCUDASyntax: true
39+
- MainSourceFile: '/path/to/cxxhash/cxxhash.cxx'
40+
Digest: 9f681b5a2cafa7dff67d7e4ac13d1304
41+
HasCUDASyntax: true
42+
- MainSourceFile: '/path/to/cxxhash/cpphash.cpp'
43+
Digest: 9f681b5a2cafa7dff67d7e4ac13d1305
44+
HasCUDASyntax: true
45+
- MainSourceFile: '/path/to/chash/chash.c'
46+
Digest: 9f681b5a2cafa7dff67d7e4ac13d1302
47+
HasCUDASyntax: false
48+
DpctVersion: 19.0.0
49+
SDKVersionMajor: '12'
50+
SDKVersionMinor: '0'
51+
MainHelperFileName: ''
52+
USMLevel: ''
53+
FeatureMap: {}
54+
CompileTargets: {}
55+
OptionMap:
56+
AnalysisScopePath:
57+
Value: '/path/to//target'
58+
Specified: false
59+
AsyncHandler:
60+
Value: 'false'
61+
Specified: false
62+
BuildScript:
63+
Value: '1'
64+
Specified: true
65+
CodePinEnabled:
66+
Value: 'false'
67+
Specified: false
68+
CommentsEnabled:
69+
Value: 'false'
70+
Specified: false
71+
CompilationsDir:
72+
Value: '/path/to/build'
73+
Specified: true
74+
CtadEnabled:
75+
Value: 'false'
76+
Specified: false
77+
EnablepProfiling:
78+
Value: 'true'
79+
Specified: true
80+
ExperimentalFlag:
81+
Value: '16384'
82+
Specified: true
83+
ExplicitNamespace:
84+
Value: '20'
85+
Specified: false
86+
ExtensionDDFlag:
87+
Value: '0'
88+
Specified: false
89+
ExtensionDEFlag:
90+
Value: '4294967295'
91+
Specified: false
92+
RuleFile:
93+
Value: ''
94+
ValueVec:
95+
- '/path/to/cmake_script_migration_rule.yaml'
96+
Specified: false
97+
SyclNamedLambda:
98+
Value: 'false'
99+
Specified: false
100+
UsmLevel:
101+
Value: '1'
102+
Specified: false
103+
...

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+
// dpct.cmake should not be copied into %T/out_pytorch1 direcotrtory.
15+
// RUN: test ! -f %T/out_pytorch1/dpct.cmake

docs/dev_guide/api-mapping-status/ASM_API_migration_status.csv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ bfind,NO,
1515
bmsk,NO,
1616
bra,NO,
1717
brev,YES,
18-
brkpt,NO,
18+
brkpt,YES,
1919
brx,NO,
2020
call,NO,
2121
clz,YES,
2222
cnot,YES,
2323
copysign,YES,
2424
cos,YES,
25-
cp,NO,
25+
cp,YES, Partial
2626
createpolicy,NO,
2727
cvt,YES, Partial
2828
cvta,NO,
@@ -69,7 +69,7 @@ popc,YES,
6969
prefetch,YES, Partial
7070
prmt,YES,
7171
rcp,YES,
72-
red,NO,
72+
red,YES, Partial
7373
redux,NO,
7474
rem,YES,
7575
ret,YES,

docs/dev_guide/api-mapping-status/CUB_API_migration_status.csv

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ cub::BlockDiscontinuity::FlagTails,NO,
3131
cub::BlockDiscontinuity::FlagHeadsAndTails,NO,
3232
cub::BlockExchange::StripedToBlocked,YES,
3333
cub::BlockExchange::BlockedToStriped,YES,
34-
cub::BlockExchange::WarpStripedToBlocked,NO,
35-
cub::BlockExchange::BlockedToWarpStriped,NO,
34+
cub::BlockExchange::WarpStripedToBlocked,YES,
35+
cub::BlockExchange::BlockedToWarpStriped,YES,
3636
cub::BlockExchange::ScatterToBlocked,YES,
3737
cub::BlockExchange::ScatterToStriped,YES,
3838
cub::BlockExchange::ScatterToStripedGuarded,NO,
@@ -160,8 +160,8 @@ cub::StoreDirectBlocked,YES,
160160
cub::StoreDirectBlockedVectorized,NO,
161161
cub::LoadDirectStriped,YES,
162162
cub::StoreDirectStriped,YES,
163-
cub::LoadDirectWarpStriped,NO,
164-
cub::StoreDirectWarpStriped,NO,
163+
cub::LoadDirectWarpStriped,YES,
164+
cub::StoreDirectWarpStriped,YES,
165165
cub::SHR_ADD,YES,
166166
cub::SHL_ADD,YES,
167167
cub::BFE,YES,

0 commit comments

Comments
 (0)