Skip to content

Commit 413137a

Browse files
committed
perf: avoid extra cai access
1 parent 1c9e7aa commit 413137a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

numba_cuda/numba/cuda/dispatcher.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,11 +1629,15 @@ def typeof_pyval(self, val):
16291629
try:
16301630
return typeof(val, Purpose.argument)
16311631
except ValueError:
1632-
if cuda.is_cuda_array(val):
1632+
if (
1633+
interface := getattr(val, "__cuda_array_interface__")
1634+
) is not None:
16331635
# When typing, we don't need to synchronize on the array's
16341636
# stream - this is done when the kernel is launched.
1637+
16351638
return typeof(
1636-
cuda.as_cuda_array(val, sync=False), Purpose.argument
1639+
cuda.from_cuda_array_interface(interface, sync=False),
1640+
Purpose.argument,
16371641
)
16381642
else:
16391643
raise

0 commit comments

Comments
 (0)