Skip to content

Commit 063378d

Browse files
committed
perf: forward dummy array shape, strides, and size to avoid recomputation/construction overhead
1 parent f6664ab commit 063378d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

numba_cuda/numba/cuda/cudadrv/devicearray.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ def __init__(self, shape, strides, dtype, stream=0, gpu_data=None):
9999
# confirm that all elements of shape are ints
100100
if not all(isinstance(dim, (int, np.integer)) for dim in shape):
101101
raise TypeError("all elements of shape must be ints")
102-
self.shape = tuple(shape)
103-
self.strides = tuple(strides)
102+
self.shape = self._dummy.shape
103+
self.strides = self._dummy.strides
104104
self.dtype = dtype
105-
self.size = int(functools.reduce(operator.mul, self.shape, 1))
105+
self.size = self._dummy.size
106106
# prepare gpu memory
107107
if self.size > 0:
108108
self.alloc_size = _driver.memory_size_from_info(

0 commit comments

Comments
 (0)