MCPcopy Create free account
hub / github.com/ROCm/clr / hipStreamBeginCapture_common

Function hipStreamBeginCapture_common

hipamd/src/hip_graph.cpp:1100–1135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1098}
1099
1100hipError_t hipStreamBeginCapture_common(hipStream_t stream, hipStreamCaptureMode mode,
1101 hipGraph_t graph = nullptr) {
1102 getStreamPerThread(stream);
1103 // capture cannot be initiated on legacy stream
1104 if (stream == nullptr || stream == hipStreamLegacy) {
1105 return hipErrorStreamCaptureUnsupported;
1106 }
1107 if (mode < hipStreamCaptureModeGlobal || mode > hipStreamCaptureModeRelaxed) {
1108 return hipErrorInvalidValue;
1109 }
1110 hip::Stream* s = reinterpret_cast<hip::Stream*>(stream);
1111 // It can be initiated if the stream is not already in capture mode
1112 if (s->GetCaptureStatus() == hipStreamCaptureStatusActive) {
1113 return hipErrorIllegalState;
1114 }
1115 if (graph == nullptr) {
1116 s->SetCaptureGraph(new hip::Graph(s->GetDevice()));
1117 } else {
1118 s->SetCaptureGraph(reinterpret_cast<hip::Graph*>(graph));
1119 }
1120 s->SetCaptureId();
1121 s->SetCaptureMode(mode);
1122 s->SetOriginStream();
1123 if (mode != hipStreamCaptureModeRelaxed) {
1124 hip::tls.capture_streams_.push_back(s);
1125 }
1126 if (mode == hipStreamCaptureModeGlobal) {
1127 amd::ScopedLock lock(g_captureStreamsLock);
1128 g_captureStreams.push_back(s);
1129 }
1130 {
1131 amd::ScopedLock lock(g_streamSetLock);
1132 g_allCapturingStreams.insert(s);
1133 }
1134 return hipSuccess;
1135}
1136
1137hipError_t hipStreamBeginCapture(hipStream_t stream, hipStreamCaptureMode mode) {
1138 HIP_INIT_API(hipStreamBeginCapture, stream, mode);

Callers 3

hipStreamBeginCaptureFunction · 0.85

Calls 7

getStreamPerThreadFunction · 0.85
GetCaptureStatusMethod · 0.80
SetCaptureGraphMethod · 0.80
GetDeviceMethod · 0.80
SetCaptureIdMethod · 0.80
SetCaptureModeMethod · 0.80
SetOriginStreamMethod · 0.80

Tested by

no test coverage detected