Skip to content

Commit dc8dc57

Browse files
committed
update
Signed-off-by: Chen, Sheng S <sheng.s.chen@intel.com>
1 parent a7530a5 commit dc8dc57

21 files changed

Lines changed: 135 additions & 115 deletions

clang/include/clang/DPCT/DPCTOptions.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -827,10 +827,10 @@ DPCT_ENUM_OPTION(
827827
"Experimental extension that allows use of SYCL prefetch APIs.\n",
828828
false),
829829
DPCT_OPTION_ENUM_VALUE(
830-
"l0-ipc", int(ExperimentalFeatures::Exp_IPC),
830+
"level_zero", int(ExperimentalFeatures::Exp_IPC),
831831
"Experimental extension that allows the use of Level Zero APIs "
832-
"to migrate IPC code, with the DPCT_EXT_ONEAPI_BACKEND_LEVEL_ZERO "
833-
"macro defined to enable these APIs.\n",
832+
"to migrate the target code. For example, migrate the CUDA Inter "
833+
"Process Communication(IPC) APIs. \n",
834834
false),
835835
DPCT_OPTION_ENUM_VALUE(
836836
"all", int(ExperimentalFeatures::Exp_All),

clang/lib/DPCT/AnalysisInfo.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,9 @@ void DpctFileInfo::insertHeader(HeaderType Type, unsigned Offset,
905905
// Add the label for profiling macro "DPCT_PROFILING_ENABLED", which will be
906906
// replaced by "#define DPCT_PROFILING_ENABLED" or not in the post
907907
// replacement.
908+
if (DpctGlobalInfo::useExtIPC())
909+
OS << "#define ONEAPI_BACKEND_LEVEL_ZERO_EXT" << getNL();
910+
908911
OS << "{{NEEDREPLACEP0}}";
909912

910913
if (DpctGlobalInfo::getUsmLevel() == UsmLevel::UL_None)

clang/lib/DPCT/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ set(RUNTIME_HEADERS
2121
${CMAKE_SOURCE_DIR}/../clang/runtime/dpct-rt/include/dpct/lib_common_utils.hpp
2222
${CMAKE_SOURCE_DIR}/../clang/runtime/dpct-rt/include/dpct/ccl_utils.hpp
2323
${CMAKE_SOURCE_DIR}/../clang/runtime/dpct-rt/include/dpct/sparse_utils.hpp
24+
${CMAKE_SOURCE_DIR}/../clang/runtime/dpct-rt/include/dpct/ze_utils.hpp
2425
${CMAKE_SOURCE_DIR}/../clang/runtime/dpct-rt/include/dpct/fft_utils.hpp
2526
${CMAKE_SOURCE_DIR}/../clang/runtime/dpct-rt/include/dpct/lapack_utils.hpp
2627
${CMAKE_SOURCE_DIR}/../clang/runtime/dpct-rt/include/dpct/group_utils.hpp
@@ -71,6 +72,7 @@ set(PROCESS_FILES_OUTPUT
7172
${CMAKE_BINARY_DIR}/tools/clang/include/clang/DPCT/rng_utils.hpp.inc
7273
${CMAKE_BINARY_DIR}/tools/clang/include/clang/DPCT/lib_common_utils.hpp.inc
7374
${CMAKE_BINARY_DIR}/tools/clang/include/clang/DPCT/ccl_utils.hpp.inc
75+
${CMAKE_BINARY_DIR}/tools/clang/include/clang/DPCT/ze_utils.hpp.inc
7476
${CMAKE_BINARY_DIR}/tools/clang/include/clang/DPCT/sparse_utils.hpp.inc
7577
${CMAKE_BINARY_DIR}/tools/clang/include/clang/DPCT/fft_utils.hpp.inc
7678
${CMAKE_BINARY_DIR}/tools/clang/include/clang/DPCT/lapack_utils.hpp.inc

clang/lib/DPCT/DPCT.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ int runDPCT(int argc, const char **argv) {
998998
Experimentals.addValue(ExperimentalFeatures::Exp_Graph);
999999
else if (Option.ends_with("prefetch"))
10001000
Experimentals.addValue(ExperimentalFeatures::Exp_Prefetch);
1001-
else if (Option.ends_with("l0-ipc"))
1001+
else if (Option.ends_with("level_zero"))
10021002
Experimentals.addValue(ExperimentalFeatures::Exp_IPC);
10031003
} else if (Option == "--no-dry-pattern") {
10041004
NoDRYPattern.setValue(true);

clang/lib/DPCT/FileGenerator/GenHelperFunction.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ const std::string CodePinSerializationBasicAllContentStr =
150150
#include "clang/DPCT/codepin/serialization/basic.hpp.inc"
151151
;
152152

153+
const std::string ZEUtilsAllContentStr =
154+
#include "clang/DPCT/ze_utils.hpp.inc"
155+
;
156+
153157
const std::string CmakeAllContentStr =
154158
#include "clang/DPCT/dpct.cmake.inc"
155159
;

clang/lib/DPCT/FileGenerator/GenHelperFunction.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ extern const std::string MathDetailAllContentStr;
4545
extern const std::string MemoryDetailAllContentStr;
4646
extern const std::string CodePinAllContentStr;
4747
extern const std::string CodePinSerializationBasicAllContentStr;
48+
extern const std::string ZEUtilsAllContentStr;
4849
extern const std::string DpctCmakeHelperFileStr;
4950
void genHelperFunction(const clang::tooling::UnifiedPath &OutRoot);
5051
void genCmakeHelperFunction(const clang::tooling::UnifiedPath &OutRoot);

clang/lib/DPCT/RuleInfra/MapNames.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ void MapNames::setExplicitNamespaceMap(
365365
HelperFeatureEnum::device_ext)},
366366
{"cudaIpcMemHandle_t",
367367
std::make_shared<TypeNameRule>(getDpctNamespace() +
368-
"experimental::dpct_ipc_mem_handle_t")},
368+
"experimental::ipc_mem_handle_ext_t")},
369369
{"char1", std::make_shared<TypeNameRule>("int8_t")},
370370
{"char2", std::make_shared<TypeNameRule>(getClNamespace() + "char2")},
371371
{"char3", std::make_shared<TypeNameRule>(getClNamespace() + "char3")},

clang/lib/DPCT/RulesLang/APINamesMisc.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ ASSIGNABLE_FACTORY(FEATURE_REQUEST_FACTORY(
151151
UNSUPPORT_FACTORY_ENTRY("cudaIpcGetMemHandle",
152152
Diagnostics::TRY_EXPERIMENTAL_FEATURE,
153153
ARG("cudaIpcGetMemHandle"),
154-
ARG("--use-experimental-features=l0-ipc")))))
154+
ARG("--use-experimental-features=level_zero")))))
155155

156156
ASSIGNABLE_FACTORY(FEATURE_REQUEST_FACTORY(
157157
HelperFeatureEnum::device_ext,
@@ -164,7 +164,7 @@ ASSIGNABLE_FACTORY(FEATURE_REQUEST_FACTORY(
164164
UNSUPPORT_FACTORY_ENTRY("cudaIpcCloseMemHandle",
165165
Diagnostics::TRY_EXPERIMENTAL_FEATURE,
166166
ARG("cudaIpcCloseMemHandle"),
167-
ARG("--use-experimental-features=l0-ipc")))))
167+
ARG("--use-experimental-features=level_zero")))))
168168

169169
ASSIGNABLE_FACTORY(FEATURE_REQUEST_FACTORY(
170170
HelperFeatureEnum::device_ext,
@@ -177,4 +177,4 @@ ASSIGNABLE_FACTORY(FEATURE_REQUEST_FACTORY(
177177
UNSUPPORT_FACTORY_ENTRY("cudaIpcOpenMemHandle",
178178
Diagnostics::TRY_EXPERIMENTAL_FEATURE,
179179
ARG("cudaIpcOpenMemHandle"),
180-
ARG("--use-experimental-features=l0-ipc")))))
180+
ARG("--use-experimental-features=level_zero")))))

clang/lib/DPCT/RulesLang/RulesLang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ void TypeInDeclRule::runRule(const MatchFinder::MatchResult &Result) {
931931
if (CanonicalTypeStr == "cudaIpcMemHandle_st") {
932932
if (!DpctGlobalInfo::useExtIPC()) {
933933
report(TL->getBeginLoc(), Diagnostics::TRY_EXPERIMENTAL_FEATURE, false,
934-
"cudaIpcMemHandle_t", "--use-experimental-features=l0-ipc");
934+
"cudaIpcMemHandle_t", "--use-experimental-features=level_zero");
935935
return;
936936
}
937937
}

clang/runtime/dpct-rt/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ set(dpct_rt_files
1212
include/dpct/dnnl_utils.hpp
1313
include/dpct/dpl_utils.hpp
1414
include/dpct/rng_utils.hpp
15+
include/dpct/ze_utils.hpp
1516
include/dpct/lib_common_utils.hpp
1617
include/dpct/ccl_utils.hpp
1718
include/dpct/sparse_utils.hpp

0 commit comments

Comments
 (0)