Repository: numba/numba

Issue:
Reminder to postpone deprecation of eager compilation of CUDA device functions.
As title. Context: https://github.com/numba/numba/pull/7496#discussion_r736484435


Discussion:

Resolving patch:
diff --git a/numba/core/config.py b/numba/core/config.py
--- a/numba/core/config.py
+++ b/numba/core/config.py
@@ -385,17 +385,6 @@ def avx_default():
         CUDA_PER_THREAD_DEFAULT_STREAM = _readenv(
             "NUMBA_CUDA_PER_THREAD_DEFAULT_STREAM", int, 0)
 
-        # Compute contiguity of device arrays using the relaxed strides
-        # checking algorithm.
-        NPY_RELAXED_STRIDES_CHECKING = _readenv(
-            "NUMBA_NPY_RELAXED_STRIDES_CHECKING",
-            int, 1)
-
-        # HSA Configs
-
-        # Disable HSA support
-        DISABLE_HSA = _readenv("NUMBA_DISABLE_HSA", int, 0)
-
         # The default number of threads to use.
         NUMBA_DEFAULT_NUM_THREADS = max(
             1,
diff --git a/numba/core/decorators.py b/numba/core/decorators.py
--- a/numba/core/decorators.py
+++ b/numba/core/decorators.py
@@ -41,10 +41,6 @@ def jit(signature_or_function=None, locals={}, cache=False,
         Mapping of local variable names to Numba types. Used to override the
         types deduced by Numba's type inference engine.
 
-    target (deprecated): str
-        Specifies the target platform to compile for. Valid targets are cpu,
-        gpu, npyufunc, and cuda. Defaults to cpu.
-
     pipeline_class: type numba.compiler.CompilerBase
             The compiler pipeline type for customizing the compilation stages.
 
@@ -106,7 +102,7 @@ def jit(signature_or_function=None, locals={}, cache=False,
     --------
     The function can be used in the following ways:
 
-    1) jit(signatures, target='cpu', **targetoptions) -> jit(function)
+    1) jit(signatures, **targetoptions) -> jit(function)
 
         Equivalent to:
 
@@ -127,7 +123,7 @@ def foo(x, y):
             def bar(x, y):
                 return x + y
 
-    2) jit(function, target='cpu', **targetoptions) -> dispatcher
+    2) jit(function, **targetoptions) -> dispatcher
 
         Create a dispatcher function object that specializes at call site.
 
@@ -137,7 +133,7 @@ def bar(x, y):
             def foo(x, y):
                 return x + y
 
-            @jit(target='cpu', nopython=True)
+            @jit(nopython=True)
             def bar(x, y):
                 return x + y
 
@@ -148,14 +144,11 @@ def bar(x, y):
         raise DeprecationError(_msg_deprecated_signature_arg.format('restype'))
     if options.get('nopython', False) and options.get('forceobj', False):
         raise ValueError("Only one of 'nopython' or 'forceobj' can be True.")
-    if 'target' in options:
-        target = options.pop('target')
-        warnings.warn("The 'target' keyword argument is deprecated.", NumbaDeprecationWarning)
-    else:
-        if "_target" in options:
-            # Set the "target_backend" option if "_target" is defined.
-            options['target_backend'] = options['_target']
-        target = options.pop('_target', 'cpu')
+
+    if "_target" in options:
+        # Set the "target_backend" option if "_target" is defined.
+        options['target_backend'] = options['_target']
+    target = options.pop('_target', 'cpu')
 
     options['boundscheck'] = boundscheck
 
@@ -230,7 +223,7 @@ def wrapper(func):
     return wrapper
 
 
-def generated_jit(function=None, target='cpu', cache=False,
+def generated_jit(function=None, cache=False,
                   pipeline_class=None, **options):
     """
     This decorator allows flexible type-based compilation
@@ -241,7 +234,7 @@ def generated_jit(function=None, target='cpu', cache=False,
     dispatcher_args = {}
     if pipeline_class is not None:
         dispatcher_args['pipeline_class'] = pipeline_class
-    wrapper = _jit(sigs=None, locals={}, target=target, cache=cache,
+    wrapper = _jit(sigs=None, locals={}, target='cpu', cache=cache,
                    targetoptions=options, impl_kind='generated',
                    **dispatcher_args)
     if function is not None:
diff --git a/numba/misc/dummyarray.py b/numba/misc/dummyarray.py
--- a/numba/misc/dummyarray.py
+++ b/numba/misc/dummyarray.py
@@ -165,12 +165,9 @@ def __init__(self, dims, itemsize):
         self.itemsize = itemsize
         self.size = functools.reduce(operator.mul, self.shape, 1)
         self.extent = self._compute_extent()
-        if config.NPY_RELAXED_STRIDES_CHECKING:
-            self.flags = self._relaxed_compute_layout()
-        else:
-            self.flags = self._compute_layout()
+        self.flags = self._compute_layout()
 
-    def _relaxed_compute_layout(self):
+    def _compute_layout(self):
         # The logic here is based on that in _UpdateContiguousFlags from
         # numpy/core/src/multiarray/flagsobject.c in NumPy v1.19.1 (commit
         # 13661ac70).
@@ -208,30 +205,6 @@ def _relaxed_compute_layout(self):
 
         return flags
 
-    def _compute_layout(self):
-        flags = {}
-
-        if not self.dims:
-            # Records have no dims, and we can treat them as contiguous
-            flags['F_CONTIGUOUS'] = True
-            flags['C_CONTIGUOUS'] = True
-            return flags
-
-        leftmost = self.dims[0].is_contiguous(self.itemsize)
-        rightmost = self.dims[-1].is_contiguous(self.itemsize)
-
-        def is_contig(traverse):
-            last = next(traverse)
-            for dim in traverse:
-                if last.size != 0 and last.size * last.stride != dim.stride:
-                    return False
-                last = dim
-            return True
-
-        flags['F_CONTIGUOUS'] = leftmost and is_contig(iter(self.dims))
-        flags['C_CONTIGUOUS'] = rightmost and is_contig(reversed(self.dims))
-        return flags
-
     def _compute_extent(self):
         firstidx = [0] * self.ndim
         lastidx = [s - 1 for s in self.shape]


Test patch:
diff --git a/numba/cuda/tests/cudadrv/test_cuda_ndarray.py b/numba/cuda/tests/cudadrv/test_cuda_ndarray.py
--- a/numba/cuda/tests/cudadrv/test_cuda_ndarray.py
+++ b/numba/cuda/tests/cudadrv/test_cuda_ndarray.py
@@ -4,7 +4,6 @@
 from numba import cuda
 from numba.cuda.testing import unittest, CUDATestCase
 from numba.cuda.testing import skip_on_cudasim
-from numba.tests.support import override_config
 
 
 class TestCudaNDArray(CUDATestCase):
@@ -322,46 +321,30 @@ def test_devicearray_contiguous_device_strided(self):
     def test_devicearray_relaxed_strides(self):
         # From the reproducer in Issue #6824.
 
-        with override_config('NPY_RELAXED_STRIDES_CHECKING', 1):
-            # Construct a device array that is contiguous even though
-            # the strides for the first axis (800) are not equal to
-            # the strides * size (10 * 8 = 80) for the previous axis,
-            # because the first axis size is 1.
-            arr = devicearray.DeviceNDArray((1, 10), (800, 8), np.float64)
+        # Construct a device array that is contiguous even though
+        # the strides for the first axis (800) are not equal to
+        # the strides * size (10 * 8 = 80) for the previous axis,
+        # because the first axis size is 1.
+        arr = devicearray.DeviceNDArray((1, 10), (800, 8), np.float64)
 
-            # Ensure we still believe the array to be contiguous because
-            # strides checking is relaxed.
-            self.assertTrue(arr.flags['C_CONTIGUOUS'])
-            self.assertTrue(arr.flags['F_CONTIGUOUS'])
-
-    @skip_on_cudasim('DeviceNDArray class not present in simulator')
-    def test_devicearray_strict_strides(self):
-        # From the reproducer in Issue #6824.
-
-        with override_config('NPY_RELAXED_STRIDES_CHECKING', 0):
-            # Construct a device array that is not contiguous because
-            # the strides for the first axis (800) are not equal to
-            # the strides * size (10 * 8 = 80) for the previous axis.
-            arr = devicearray.DeviceNDArray((1, 10), (800, 8), np.float64)
-
-            # Ensure we don't believe the array to be contiguous becase strides
-            # checking is strict.
-            self.assertFalse(arr.flags['C_CONTIGUOUS'])
-            self.assertFalse(arr.flags['F_CONTIGUOUS'])
+        # Ensure we still believe the array to be contiguous because
+        # strides checking is relaxed.
+        self.assertTrue(arr.flags['C_CONTIGUOUS'])
+        self.assertTrue(arr.flags['F_CONTIGUOUS'])
 
     def test_c_f_contiguity_matches_numpy(self):
         # From the reproducer in Issue #4943.
 
         shapes = ((1, 4), (4, 1))
         orders = ('C', 'F')
-        with override_config('NPY_RELAXED_STRIDES_CHECKING', 1):
-            for shape, order in itertools.product(shapes, orders):
-                arr = np.ndarray(shape, order=order)
-                d_arr = cuda.to_device(arr)
-                self.assertEqual(arr.flags['C_CONTIGUOUS'],
-                                 d_arr.flags['C_CONTIGUOUS'])
-                self.assertEqual(arr.flags['F_CONTIGUOUS'],
-                                 d_arr.flags['F_CONTIGUOUS'])
+
+        for shape, order in itertools.product(shapes, orders):
+            arr = np.ndarray(shape, order=order)
+            d_arr = cuda.to_device(arr)
+            self.assertEqual(arr.flags['C_CONTIGUOUS'],
+                             d_arr.flags['C_CONTIGUOUS'])
+            self.assertEqual(arr.flags['F_CONTIGUOUS'],
+                             d_arr.flags['F_CONTIGUOUS'])
 
     @skip_on_cudasim('Typing not done in the simulator')
     def test_devicearray_typing_order_simple_c(self):