Skip to content

Commit c1c7404

Browse files
committed
Add warning report when use syclcompat.
1 parent bb75b54 commit c1c7404

File tree

6 files changed

+352
-181
lines changed

6 files changed

+352
-181
lines changed

clang/lib/DPCT/AnalysisInfo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,6 +2434,7 @@ unsigned DpctGlobalInfo::ExtensionDDFlag = 0;
24342434
unsigned DpctGlobalInfo::ExperimentalFlag = 0;
24352435
unsigned DpctGlobalInfo::HelperFuncPreferenceFlag = 0;
24362436
bool DpctGlobalInfo::AnalysisModeFlag = false;
2437+
bool DpctGlobalInfo::UseSYCLCompatFlag = false;
24372438
unsigned int DpctGlobalInfo::ColorOption = 1;
24382439
std::unordered_map<int, std::shared_ptr<DeviceFunctionInfo>>
24392440
DpctGlobalInfo::CubPlaceholderIndexMap;

clang/lib/DPCT/AnalysisInfo.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,6 +1286,8 @@ class DpctGlobalInfo {
12861286
static bool useNoQueueDevice() {
12871287
return getHelperFuncPreference(HelperFuncPreference::NoQueueDevice);
12881288
}
1289+
static void setUseSYCLCompat(bool Flag = true) { UseSYCLCompatFlag = Flag; }
1290+
static bool useSYCLCompat() { return UseSYCLCompatFlag; }
12891291
static bool useEnqueueBarrier() {
12901292
return getUsingExtensionDE(
12911293
DPCPPExtensionsDefaultEnabled::ExtDE_EnqueueBarrier);
@@ -1595,6 +1597,7 @@ class DpctGlobalInfo {
15951597
static unsigned ExperimentalFlag;
15961598
static unsigned HelperFuncPreferenceFlag;
15971599
static bool AnalysisModeFlag;
1600+
static bool UseSYCLCompatFlag;
15981601
static unsigned int ColorOption;
15991602
static std::unordered_map<int, std::shared_ptr<DeviceFunctionInfo>>
16001603
CubPlaceholderIndexMap;

clang/lib/DPCT/CallExprRewriterCommon.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,6 +1709,10 @@ inline auto UseNonUniformGroups = [](const CallExpr *C) -> bool {
17091709
return DpctGlobalInfo::useExpNonUniformGroups();
17101710
};
17111711

1712+
inline auto UseSYCLCompat = [](const CallExpr *C) -> bool {
1713+
return DpctGlobalInfo::useSYCLCompat();
1714+
};
1715+
17121716
class CheckDerefedTypeBeforeCast {
17131717
unsigned Idx;
17141718
std::string TypeName;

clang/lib/DPCT/Diagnostics.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ DEF_WARNING(OUT_OF_PLACE_FFT_EXEC, 1071, LOW_LEVEL, "deprecated")
176176
DEF_COMMENT(OUT_OF_PLACE_FFT_EXEC, 1071, LOW_LEVEL, "deprecated")
177177
DEF_WARNING(UNSUPPORT_FREE_MEMORY_SIZE, 1072, LOW_LEVEL, "SYCL currently does not support getting the available memory on the current device. You may need to adjust the code.")
178178
DEF_COMMENT(UNSUPPORT_FREE_MEMORY_SIZE, 1072, LOW_LEVEL, "SYCL currently does not support getting the available memory on the current device. You may need to adjust the code.")
179-
DEF_WARNING(CANNOT_CAPUTURE_AGUMENTS, 1073, MEDIUM_LEVEL, "deprecated")
180-
DEF_COMMENT(CANNOT_CAPUTURE_AGUMENTS, 1073, MEDIUM_LEVEL, "deprecated")
179+
DEF_WARNING(SYCLCOMPAT, 1073, MEDIUM_LEVEL, "deprecated")
180+
DEF_COMMENT(SYCLCOMPAT, 1073, MEDIUM_LEVEL, "deprecated")
181181
DEF_WARNING(TEX_FLAG_UNSUPPORT, 1074, MEDIUM_LEVEL, "The SYCL Image class does not support some of the flags used in the original code. Unsupported flags were ignored. Data read from SYCL Image could not be normalized as specified in the original code.")
182182
DEF_COMMENT(TEX_FLAG_UNSUPPORT, 1074, MEDIUM_LEVEL, "The SYCL Image class does not support some of the flags used in the original code. Unsupported flags were ignored. Data read from SYCL Image could not be normalized as specified in the original code.")
183183
DEF_WARNING(CHECK_RELATED_QUEUE, 1075, LOW_LEVEL, "deprecated")

clang/lib/DPCT/Rewriters/Math/RewriterHalf2ArithmeticFunctions.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,12 @@ RewriterMap dpct::createHalf2ArithmeticFunctionsRewriterMap() {
138138
"ext::intel::math::hcmadd",
139139
ARG(0), ARG(1), ARG(2))))),
140140
EMPTY_FACTORY_ENTRY("__hcmadd"),
141-
CALL_FACTORY_ENTRY("__hcmadd", CALL(MapNames::getDpctNamespace() +
142-
"complex_mul_add",
143-
ARG(0), ARG(1), ARG(2)))))
141+
CALL_FACTORY_ENTRY(
142+
"__hcmadd",
143+
CALL(DpctGlobalInfo::useSYCLCompat()
144+
? MapNames::getDpctNamespace() + "cmul_add"
145+
: MapNames::getDpctNamespace() + "complex_mul_add",
146+
ARG(0), ARG(1), ARG(2)))))
144147
// __hfma2
145148
MATH_API_REWRITER_DEVICE_OVERLOAD(
146149
CheckArgType(0, "__half2"),

0 commit comments

Comments
 (0)