Skip to content

Commit 6bc1d80

Browse files
committed
Refine migration command with profiling enabled
Signed-off-by: chenwei.sun <chenwei.sun@intel.com>
1 parent f6f7c51 commit 6bc1d80

4 files changed

Lines changed: 6 additions & 15 deletions

File tree

clang/examples/DPCT/Runtime/cudaEventRecordWithFlags.cu

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Option: --enable-profiling
2+
13
void test(cudaEvent_t event, cudaStream_t stream) {
24
// Start
35
cudaEventRecordWithFlags(event /*cudaEvent_t*/, stream /*cudaStream_t*/,

clang/lib/DPCT/DPCT.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,8 @@ int runDPCT(int argc, const char **argv) {
10721072
Experimentals.addValue(ExperimentalFeatures::Exp_NonUniformGroups);
10731073
} else if (Option == "--no-dry-pattern") {
10741074
NoDRYPattern.setValue(true);
1075+
} else if (Option == "--enable-profiling") {
1076+
EnablepProfiling.setValue(true);
10751077
}
10761078
// Need add more option.
10771079
}

clang/lib/DPCT/RulesLang/RulesLang.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3276,19 +3276,6 @@ void EventAPICallRule::handleEventRecordWithProfilingDisabled(
32763276
static std::set<std::pair<const Decl *, std::string>> DeclDupFilter;
32773277
auto &SM = DpctGlobalInfo::getSourceManager();
32783278

3279-
int NumArgs = CE->getNumArgs();
3280-
if (NumArgs == 3) { // Special process for cudaEventRecordWithFlags().
3281-
auto APIName = CE->getDirectCallee()->getNameInfo().getName().getAsString();
3282-
const Expr *SecArg = CE->getArg(2);
3283-
ExprAnalysis Arg2EA(SecArg);
3284-
auto Arg2Name = Arg2EA.getReplacedString();
3285-
if (Arg2Name != "cudaEventRecordDefault") {
3286-
report(CE->getBeginLoc(), Diagnostics::NOT_SUPPORTED_PARAMETER, false,
3287-
APIName, "parameter " + Arg2Name + " is unsupported");
3288-
return;
3289-
}
3290-
}
3291-
32923279
const ValueDecl *MD = nullptr;
32933280
if ((MD = getDecl(CE->getArg(0))) == nullptr)
32943281
return;

clang/test/dpct/query_api_mapping/Runtime/test.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,5 +559,5 @@
559559
// cudaEventRecordWithFlags: CUDA API:
560560
// cudaEventRecordWithFlags-NEXT: cudaEventRecordWithFlags(event /*cudaEvent_t*/, stream /*cudaStream_t*/,
561561
// cudaEventRecordWithFlags-NEXT: cudaEventRecordDefault /*unsigned int*/);
562-
// cudaEventRecordWithFlags-NEXT: Is migrated to:
563-
// cudaEventRecordWithFlags-NEXT: *event = dpct::get_in_order_queue().ext_oneapi_submit_barrier();
562+
// cudaEventRecordWithFlags-NEXT: Is migrated to (with the option --enable-profiling):
563+
// cudaEventRecordWithFlags-NEXT: dpct::sync_barrier(event /*cudaEvent_t*/, stream /*unsigned int*/);

0 commit comments

Comments
 (0)