Skip to content

Commit 3e6c0d2

Browse files
committed
Fix access violation in occupancy queries with uninitialized hStream
Zero-initialize CUlaunchConfig struct to prevent garbage values in hStream field when no stream is provided. The driver dereferences hStream even when querying occupancy, causing access violations on some platforms (observed on Windows with RTX Pro 6000).
1 parent f569e6c commit 3e6c0d2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

cuda_core/cuda/core/_launch_config.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5+
from libc.string cimport memset
6+
57
from cuda.core._utils.cuda_utils cimport (
68
HANDLE_RETURN,
79
)
@@ -139,9 +141,9 @@ cdef class LaunchConfig:
139141

140142
cdef cydriver.CUlaunchConfig _to_native_launch_config(self):
141143
_lazy_init()
142-
# TODO: memset to zero?
143144
cdef cydriver.CUlaunchConfig drv_cfg
144145
cdef cydriver.CUlaunchAttribute attr
146+
memset(&drv_cfg, 0, sizeof(drv_cfg))
145147
self._attrs.resize(0)
146148

147149
# Handle grid dimensions and cluster configuration

0 commit comments

Comments
 (0)