MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / endCaptureOnError

Method endCaptureOnError

samples/common/sampleDevice.h:199–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197 }
198
199 void endCaptureOnError(TrtCudaStream& stream)
200 {
201 // There are two possibilities why stream capture would fail:
202 // (1) stream is in cudaErrorStreamCaptureInvalidated state.
203 // (2) TRT reports a failure.
204 // In case (1), the returning mGraph should be nullptr.
205 // In case (2), the returning mGraph is not nullptr, but it should not be used.
206 const auto ret = cudaStreamEndCapture(stream.get(), &mGraph);
207 if (ret == cudaErrorStreamCaptureInvalidated)
208 {
209 assert(mGraph == nullptr);
210 }
211 else
212 {
213 assert(ret == cudaSuccess);
214 assert(mGraph != nullptr);
215 cudaCheck(cudaGraphDestroy(mGraph));
216 mGraph = nullptr;
217 }
218 // Clean up any CUDA error.
219 cudaGetLastError();
220 sample::gLogWarning << "The CUDA graph capture on the stream has failed." << std::endl;
221 }
222
223private:
224 cudaGraph_t mGraph{};

Callers 1

createEnqueueFunctionMethod · 0.45

Calls 2

cudaCheckFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected