Skip to content

Commit 66d7e36

Browse files
committed
Fix segfault in get_capture_info_v2
1 parent 37e9958 commit 66d7e36

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/cpp/cuda.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,9 +1679,9 @@ namespace pycuda
16791679
{
16801680
CUgraph _capturing_graph;
16811681
CUstreamCaptureStatus _capture_status;
1682-
const CUgraphNode *_deps;
1683-
size_t _dep_count;
1684-
uint64_t _id_out;
1682+
const CUgraphNode *_deps = nullptr;
1683+
size_t _dep_count = 0;
1684+
uint64_t _id_out = 0;
16851685
CUDAPP_CALL_GUARDED(cuStreamGetCaptureInfo_v2, (m_stream, &_capture_status, &_id_out, &_capturing_graph, &_deps, &_dep_count));
16861686
py::list list_root_nodes = array_of_nodes_to_list(_deps, _dep_count);
16871687
graph *node = new graph(_capturing_graph);

test/test_graph.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,15 @@ def test_many_dynamic_params(self):
9696
func_times = mod.get_function("times")
9797

9898
stream_1 = drv.Stream()
99+
_ , _, _, _ = stream_1.get_capture_info_v2()
99100

100101
import numpy
101102
a = numpy.zeros((4, 4)).astype(numpy.float32)
102103
a_gpu = drv.mem_alloc_like(a)
103104
b = numpy.zeros((4, 4)).astype(numpy.float32)
104105
b_gpu = drv.mem_alloc_like(b)
105106
result = numpy.zeros_like(b)
107+
_ , _, _, _ = stream_1.get_capture_info_v2()
106108
stream_1.begin_capture()
107109
stat , _, x_graph, deps = stream_1.get_capture_info_v2()
108110
assert stat == drv.capture_status.ACTIVE, "Capture should be active"

0 commit comments

Comments
 (0)