Skip to content

Commit

Permalink
Add warning for cudaStreamCaptureStatusInvalidated enum value
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmed, Daiyaan <[email protected]>
  • Loading branch information
daiyaan-ahmed6 committed May 3, 2024
1 parent 4b6d51d commit 3b99638
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions clang/lib/DPCT/ASTTraversal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3389,6 +3389,9 @@ void EnumConstantRule::runRule(const MatchFinder::MatchResult &Result) {
EnumName == "cudaComputeModeExclusiveProcess") {
handleComputeMode(EnumName, E);
return;
} else if (EnumName == "cudaStreamCaptureStatusInvalidated") {
report(E->getBeginLoc(), Diagnostics::KNOWN_UNSUPPORTED_TYPE, true,
"cudaStreamCaptureStatus::cudaStreamCaptureStatusInvalidated");
} else if (auto ET = dyn_cast<EnumType>(E->getType())) {
if (auto ETD = ET->getDecl()) {
auto EnumTypeName = ETD->getName().str();
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/DPCT/MapNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1049,8 +1049,8 @@ void MapNames::setExplicitNamespaceMap() {
{"cudaStreamCaptureStatusInvalidated",
std::make_shared<EnumNameRule>(
DpctGlobalInfo::useExtGraphs()
? getClNamespace() +
"ext::oneapi::experimental::queue_state::executing"
? "("+ getClNamespace() +
"ext::oneapi::experimental::queue_state) -1"
: "0")},
// enum CUmem_advise_enum
{"CU_MEM_ADVISE_SET_READ_MOSTLY", std::make_shared<EnumNameRule>("0")},
Expand Down
7 changes: 6 additions & 1 deletion clang/test/dpct/cuda-stream-api-cuda10-after.cu
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@ int main() {
cudaStreamCaptureStatus captureStatus = cudaStreamCaptureStatusNone;
captureStatus = cudaStreamCaptureStatusActive;
captureStatus = cudaStreamCaptureStatusInvalidated;

// CHECK: /*
// CHECK-NEXT: DPCT1027:{{[0-9]+}}: The call to cudaStreamIsCapturing was replaced with 0 because SYCL currently does not support capture operations on queues.
// CHECK-NEXT: */
// CHECK: MY_ERROR_CHECKER(0);
MY_ERROR_CHECKER(cudaStreamIsCapturing(s0, &captureStatus));

if (captureStatus == cudaStreamCaptureStatusInvalidated) {
return -1;
}

return 0;
}
}

0 comments on commit 3b99638

Please sign in to comment.