Skip to content

Commit e5ce544

Browse files
author
Godavarthy Surya, Anusha
authored
SWDEV-469423 - hipStreamEndCapture graph* can be nullptr (#170)
1 parent 38d48c9 commit e5ce544

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

hipamd/src/hip_graph.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,19 +1245,23 @@ hipError_t hipStreamEndCapture_common(hipStream_t stream, hip::Graph** pGraph) {
12451245

12461246
hipError_t hipStreamEndCapture(hipStream_t stream, hipGraph_t* pGraph) {
12471247
HIP_INIT_API(hipStreamEndCapture, stream, pGraph);
1248-
if (pGraph == nullptr) {
1249-
HIP_RETURN(hipErrorInvalidValue);
1250-
}
12511248
hip::Graph* graph;
12521249
hipError_t status = hipStreamEndCapture_common(stream, &graph);
1253-
*pGraph = reinterpret_cast<hipGraph_t>(graph);
1250+
if (pGraph != nullptr) {
1251+
*pGraph = reinterpret_cast<hipGraph_t>(graph);
1252+
}
12541253
HIP_RETURN(status);
12551254
}
12561255

12571256
hipError_t hipStreamEndCapture_spt(hipStream_t stream, hipGraph_t* pGraph) {
12581257
HIP_INIT_API(hipStreamEndCapture, stream, pGraph);
12591258
PER_THREAD_DEFAULT_STREAM(stream);
1260-
HIP_RETURN_DURATION(hipStreamEndCapture_common(stream, reinterpret_cast<hip::Graph**>(pGraph)));
1259+
hip::Graph* graph;
1260+
hipError_t status = hipStreamEndCapture_common(stream, &graph);
1261+
if (pGraph != nullptr) {
1262+
*pGraph = reinterpret_cast<hipGraph_t>(graph);
1263+
}
1264+
HIP_RETURN(status);
12611265
}
12621266

12631267
hipError_t hipGraphCreate(hipGraph_t* pGraph, unsigned int flags) {

0 commit comments

Comments
 (0)