@@ -160,7 +160,7 @@ void CUDAGraph::capture_end() {
160
160
161
161
c10::cuda::CUDACachingAllocator::endAllocateToPool (capture_dev_, mempool_id_);
162
162
163
- TORCH_CHECK (graph_ != NULL , " Invalid capture." );
163
+ TORCH_CHECK (graph_ != nullptr , " Invalid capture." );
164
164
has_graph_ = true ;
165
165
166
166
// In typical graph usage some tensors (e.g. the tensors used for graph IO) are not freed
@@ -175,7 +175,7 @@ void CUDAGraph::capture_end() {
175
175
// cudaGraphInstantiateWithFlags
176
176
// https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__GRAPH.html#group__CUDART__GRAPH_1ga2c652a24ba93e52b99a47bec0888233
177
177
#if (defined(CUDA_VERSION) && CUDA_VERSION >= 11040)
178
- int version;
178
+ int version = 0 ;
179
179
AT_CUDA_CHECK (cudaDriverGetVersion (&version));
180
180
if (version < 11040 ) {
181
181
#endif
@@ -203,7 +203,7 @@ void CUDAGraph::capture_end() {
203
203
}
204
204
205
205
size_t numCUDAGraphNodes = 0 ;
206
- AT_CUDA_CHECK (cudaGraphGetNodes (graph_, NULL , &numCUDAGraphNodes));
206
+ AT_CUDA_CHECK (cudaGraphGetNodes (graph_, nullptr , &numCUDAGraphNodes));
207
207
if (numCUDAGraphNodes == 0 ) {
208
208
TORCH_WARN (" The CUDA Graph is empty. This usually means that the graph was " ,
209
209
" attempted to be captured on wrong device or stream." );
@@ -233,7 +233,7 @@ void CUDAGraph::replay() {
233
233
// graph_exec_ may be replayed in any stream.
234
234
AT_CUDA_CHECK (cudaGraphLaunch (graph_exec_, at::cuda::getCurrentCUDAStream ()));
235
235
236
- int version;
236
+ int version = 0 ;
237
237
AT_CUDA_CHECK (cudaDriverGetVersion (&version));
238
238
if (version < 11040 ) {
239
239
// Workaround for bug in libcuda.so that causes replayed graphs with
0 commit comments