Skip to content

Commit

Permalink
Add missing config.DISABLE_PERFORMANCE_WARNINGS checks
Browse files Browse the repository at this point in the history
Fix a few functions that raise a NumbaPerformanceWarning` without
checking whether `config.DISABLE_PERFORMANCE_WARNINGS` is set.
  • Loading branch information
maxkapur committed Nov 21, 2024
1 parent bb31021 commit 28013a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion numba_cuda/numba/cuda/cudadrv/devicearray.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,10 @@ def auto_device(obj, stream=0, copy=True, user_explicit=False):
sentry_contiguous(obj)
devobj = from_array_like(obj, stream=stream)
if copy:
if config.CUDA_WARN_ON_IMPLICIT_COPY:
if (
config.CUDA_WARN_ON_IMPLICIT_COPY
and not config.DISABLE_PERFORMANCE_WARNINGS
):
if (
not user_explicit and
(not isinstance(obj, DeviceNDArray)
Expand Down
5 changes: 4 additions & 1 deletion numba_cuda/numba/cuda/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,10 @@ def __init__(self, dispatcher, griddim, blockdim, stream, sharedmem):
self.stream = stream
self.sharedmem = sharedmem

if config.CUDA_LOW_OCCUPANCY_WARNINGS:
if (
config.CUDA_LOW_OCCUPANCY_WARNINGS
and not config.DISABLE_PERFORMANCE_WARNINGS
):
# Warn when the grid has fewer than 128 blocks. This number is
# chosen somewhat heuristically - ideally the minimum is 2 times
# the number of SMs, but the number of SMs varies between devices -
Expand Down

0 comments on commit 28013a0

Please sign in to comment.