internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: ros2/ros2_documentation

Issue:
Update instructions for checking out develop, release and rolling (master) branches
Due to the release of rolling, and galactic being branched off rolling, there are some instructions that require updating in [Maintaining-a-Source-Checkout.rst](https://github.com/ros2/ros2_documentation/blob/rolling/source/Installation/Maintaining-a-Source-Checkout.rst) . We must clarify between the different type of checkouts.

See [this conversation](https://github.com/ros2/ros2_documentation/pull/1693#discussion_r657035616)  for details.


Discussion:

Resolving patch:
diff --git a/conf.py b/conf.py
--- a/conf.py
+++ b/conf.py
@@ -73,7 +73,7 @@
 
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
-extensions = ['sphinx.ext.intersphinx', 'sphinx_tabs.tabs', 'sphinx_multiversion', 'sphinx_rtd_theme']
+extensions = ['sphinx.ext.intersphinx', 'sphinx_tabs.tabs', 'sphinx_multiversion', 'sphinx_rtd_theme', 'sphinx.ext.ifconfig']
 
 # Intersphinx mapping
 


Test patch:
Repository: nv-legate/cunumeric

Issue:
ndarray.__legate_data_interface__ crashes
I tried to access the legate data using`__legate_data_interface__`, but I am getting an error:
  File "./gemm.py", line 62, in run_gemm
    C_data = C.__legate_data_interface__
  File "/home/wwu/legate.numpy/legate/numpy/array.py", line 90, in __legate_data_interface__
    array = Array(arrow_type, [None, self._thunk])
  File "/home/wwu/legate.core/legate/core/legate.py", line 73, in __init__
    self._region = stores[1].storage[0]
  File "/home/wwu/legate.numpy/legate/numpy/eager.py", line 46, in storage
    return self.deferred.storage
  File "/home/wwu/legate.numpy/legate/numpy/deferred.py", line 169, in storage
    return (self.base.region, self.base.field.field_id)
AttributeError: 'Store' object has no attribute 'region'

Here is my code:
```
def run_gemm(N, I, ft):  # noqa: E741
    print("Problem Size:     M=" + str(N) + " N=" + str(N) + " K=" + str(N))
    print("Total Iterations: " + str(I))
    flops = total_flops(N, N, N)
    print("Total Flops:      " + str(flops / 1e9) + " GFLOPS/iter")
    space = total_space(N, N, N, ft)
    print("Total Size:       " + str(space / 1e6) + " MB")
    A, B, C = initialize(N, N, N, ft)
    # Compute some sums and check for NaNs to force synchronization
    # before we start the timing
    assert not math.isnan(np.sum(A))
    assert not math.isnan(np.sum(B))
    assert not math.isnan(np.sum(C))
    start = datetime.datetime.now()
    # Run for as many iterations as was requested
    #for idx in range(I):
    np.dot(A, B, out=C)
    C_data = C.__legate_data_interface__
```


Discussion:

Resolving patch:
diff --git a/legate/numpy/deferred.py b/legate/numpy/deferred.py
--- a/legate/numpy/deferred.py
+++ b/legate/numpy/deferred.py
@@ -163,10 +163,11 @@ def __init__(self, runtime, base, dtype, scalar, numpy_array=None):
 
     @property
     def storage(self):
-        if isinstance(self.base, Future):
-            return self.base
+        storage = self.base.storage
+        if self.base.kind == Future:
+            return storage
         else:
-            return (self.base.region, self.base.field.field_id)
+            return (storage.region, storage.field.field_id)
 
     @property
     def shape(self):


Test patch:
Repository: nv-legate/cunumeric

Issue:
module.py typo?
I get this error:

```
File "/home/snledbetter/GitHub/legate/legate.core/install/lib/python3.8/site-packages/cunumeric/module.py", line 187, in array
    array = array
UnboundLocalError: local variable 'array' referenced before assignment
```
I opened up module.py and found this function:

```
@copy_docstring(np.array)
def array(obj, dtype=None, copy=True, order="K", subok=False, ndmin=0):
    if not isinstance(obj, ndarray):
        thunk = runtime.get_numpy_thunk(
            obj, stacklevel=2, share=(not copy), dtype=dtype
        )
        array = ndarray(shape=None, stacklevel=2, thunk=thunk)
    else:
        array = array
    if dtype is not None and array.dtype != dtype:
        array = array.astype(dtype)
    elif copy and obj is array:
        array = array.copy()
    if array.ndim < ndmin:
        shape = (np.newaxis,) * (ndmin - array.ndim) + array.shape
        array = array.reshape(shape)
    return array
```
I assumed the point of checking to see if the `obj` was an `ndarray` was to make sure that the `array` variable was the proper type, so I changed line 187 to `array=obj` and that seemed to resolve this error.


Discussion:

Resolving patch:
diff --git a/cunumeric/module.py b/cunumeric/module.py
--- a/cunumeric/module.py
+++ b/cunumeric/module.py
@@ -184,7 +184,7 @@ def array(obj, dtype=None, copy=True, order="K", subok=False, ndmin=0):
         )
         array = ndarray(shape=None, stacklevel=2, thunk=thunk)
     else:
-        array = array
+        array = obj
     if dtype is not None and array.dtype != dtype:
         array = array.astype(dtype)
     elif copy and obj is array:


Test patch:
diff --git a/tests/array_creation.py b/tests/array_creation.py
--- a/tests/array_creation.py
+++ b/tests/array_creation.py
@@ -25,6 +25,11 @@ def test():
     assert np.array_equal(x, z)
     assert x.dtype == z.dtype
 
+    x = num.array([1, 2, 3])
+    y = num.array(x)
+    assert num.array_equal(x, y)
+    assert x.dtype == y.dtype
+
     xe = num.empty((2, 3))
     ye = np.empty((2, 3))
     assert xe.shape == ye.shape
Repository: nv-legate/cunumeric

Issue:
module.py typo?
I get this error:

```
File "/home/snledbetter/GitHub/legate/legate.core/install/lib/python3.8/site-packages/cunumeric/module.py", line 187, in array
    array = array
UnboundLocalError: local variable 'array' referenced before assignment
```
I opened up module.py and found this function:

```
@copy_docstring(np.array)
def array(obj, dtype=None, copy=True, order="K", subok=False, ndmin=0):
    if not isinstance(obj, ndarray):
        thunk = runtime.get_numpy_thunk(
            obj, stacklevel=2, share=(not copy), dtype=dtype
        )
        array = ndarray(shape=None, stacklevel=2, thunk=thunk)
    else:
        array = array
    if dtype is not None and array.dtype != dtype:
        array = array.astype(dtype)
    elif copy and obj is array:
        array = array.copy()
    if array.ndim < ndmin:
        shape = (np.newaxis,) * (ndmin - array.ndim) + array.shape
        array = array.reshape(shape)
    return array
```
I assumed the point of checking to see if the `obj` was an `ndarray` was to make sure that the `array` variable was the proper type, so I changed line 187 to `array=obj` and that seemed to resolve this error.


Discussion:

Resolving patch:
diff --git a/cunumeric/module.py b/cunumeric/module.py
--- a/cunumeric/module.py
+++ b/cunumeric/module.py
@@ -182,7 +182,7 @@ def array(obj, dtype=None, copy=True, order="K", subok=False, ndmin=0):
         )
         array = ndarray(shape=None, stacklevel=2, thunk=thunk)
     else:
-        array = array
+        array = obj
     if dtype is not None and array.dtype != dtype:
         array = array.astype(dtype)
     elif copy and obj is array:


Test patch:
diff --git a/tests/array_creation.py b/tests/array_creation.py
--- a/tests/array_creation.py
+++ b/tests/array_creation.py
@@ -25,6 +25,11 @@ def test():
     assert np.array_equal(x, z)
     assert x.dtype == z.dtype
 
+    x = num.array([1, 2, 3])
+    y = num.array(x)
+    assert num.array_equal(x, y)
+    assert x.dtype == y.dtype
+
     xe = num.empty((2, 3))
     ye = np.empty((2, 3))
     assert xe.shape == ye.shape
Repository: nv-legate/cunumeric

Issue:
Add some missing array methods 
A few numpy array methods were discovered to be missing:
```
                "loads",
                "mafromtxt",
                "matmul",
                "ndfromtxt",
```

These should be copied over as necessary, and the comparison blocklist updated. 

ref: https://github.com/nv-legate/cunumeric/pull/224#discussion_r830657282



Discussion:

Resolving patch:
diff --git a/docs/cunumeric/source/comparison/_comparison_generator.py b/docs/cunumeric/source/comparison/_comparison_generator.py
--- a/docs/cunumeric/source/comparison/_comparison_generator.py
+++ b/docs/cunumeric/source/comparison/_comparison_generator.py
@@ -15,11 +15,8 @@
     "fastCopyAndTranspose",
     "get_array_wrap",
     "iterable",
-    "loads",
-    "mafromtxt",
     "max",
     "min",
-    "ndfromtxt",
     "ndim",
     "product",
     "recfromcsv",
@@ -32,6 +29,13 @@
     "test",
 ]
 
+# these do not have valid intersphinx references
+missing_numpy_refs = {
+    "loads",
+    "mafromtxt",
+    "ndfromtxt",
+}
+
 
 def check_ufunc(obj, n):
     try:
@@ -122,7 +126,10 @@ def _section(
         "",
     ]
     for f in sorted(base_funcs):
-        base_cell = base_fmt.format(f)
+        if f not in missing_numpy_refs:
+            base_cell = base_fmt.format(f)
+        else:
+            base_cell = f"``numpy.{f}``"
         lg_cell = r"\-"
         single_gpu_cell = ""
         multi_gpu_cell = ""


Test patch:
Repository: nv-legate/cunumeric

Issue:
Check in CI that docs/source/api/*.rst files cover all implemented functions



Discussion:

Resolving patch:
diff --git a/cunumeric/_sphinxext/missing_refs.py b/cunumeric/_sphinxext/missing_refs.py
new file mode 100644
--- /dev/null
+++ b/cunumeric/_sphinxext/missing_refs.py
@@ -0,0 +1,78 @@
+# Copyright 2022 NVIDIA Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+from __future__ import annotations
+
+from textwrap import indent
+from typing import Any
+
+from docutils import nodes
+from sphinx import addnodes
+from sphinx.application import Sphinx
+from sphinx.errors import NoUri
+from sphinx.transforms.post_transforms import SphinxPostTransform
+from sphinx.util.logging import get_node_location, getLogger
+
+from . import PARALLEL_SAFE, SphinxParallelSpec
+
+log = getLogger(__name__)
+
+SKIP = []
+
+MISSING = []
+
+
+class MissingRefs(SphinxPostTransform):
+
+    default_priority = 5
+
+    def run(self, **kwargs: Any) -> None:
+        for node in self.document.findall(addnodes.pending_xref):
+            self._check_target(node)
+
+        if MISSING:
+            header = "The following Cunumeric API links are broken:"
+            items = "\n".join(f"{loc}: {target}" for loc, target in MISSING)
+            log.warning(f"{header}\n\n{indent(items, '    ')}\n", type="ref")
+
+    def _check_target(self, node: nodes.Node) -> None:
+        target = node["reftarget"]
+
+        if not target.startswith("cunumeric.") or target in SKIP:
+            return
+
+        domain = self.env.domains[node["refdomain"]]
+
+        assert self.app.builder is not None
+
+        try:
+            uri = domain.resolve_xref(
+                self.env,
+                node.get("refdoc", self.env.docname),
+                self.app.builder,
+                node["reftype"],
+                target,
+                node,
+                nodes.TextElement("", ""),
+            )
+        except NoUri:
+            uri = None
+
+        if uri is None:
+            MISSING.append((f"{get_node_location(node)}", f"{target}"))
+
+
+def setup(app: Sphinx) -> SphinxParallelSpec:
+    app.add_post_transform(MissingRefs)
+    return PARALLEL_SAFE
diff --git a/docs/cunumeric/source/conf.py b/docs/cunumeric/source/conf.py
--- a/docs/cunumeric/source/conf.py
+++ b/docs/cunumeric/source/conf.py
@@ -40,6 +40,7 @@
     "sphinx_markdown_tables",
     "recommonmark",
     "cunumeric._sphinxext.comparison_table",
+    "cunumeric._sphinxext.missing_refs",
     "cunumeric._sphinxext.ufunc_formatter",
 ]
 


Test patch:
Repository: nv-legate/cunumeric

Issue:
implement `numpy.ndim`
This functions is likely easy to implement and would silence warnings like this (i doubt not having ndim will impact performance):
```
**<__array_function__ internals>:180: RuntimeWarning: cuNumeric has not implemented numpy.ndim and is falling back to canonical numpy. You may notice significantly decreased performance for this function call.**
```


Discussion:

Resolving patch:
diff --git a/cunumeric/_sphinxext/_comparison_config.py b/cunumeric/_sphinxext/_comparison_config.py
--- a/cunumeric/_sphinxext/_comparison_config.py
+++ b/cunumeric/_sphinxext/_comparison_config.py
@@ -46,7 +46,6 @@
     "iterable",
     "max",
     "min",
-    "ndim",
     "product",
     "recfromcsv",
     "recfromtxt",
@@ -335,7 +334,7 @@ class SectionConfig:
     "var",
 )
 
-MISC = ("kron",)
+MISC = ("kron", "ndim")
 
 PACK = ("packbits", "unpackbits")
 
diff --git a/cunumeric/module.py b/cunumeric/module.py
--- a/cunumeric/module.py
+++ b/cunumeric/module.py
@@ -966,6 +966,36 @@ def triu(m: ndarray, k: int = 0) -> ndarray:
 # Basic operations
 
 
+@add_boilerplate("a")
+def ndim(a: ndarray) -> int:
+    """
+
+    Return the number of dimensions of an array.
+
+    Parameters
+    ----------
+    a : array_like
+        Input array.  If it is not already an ndarray, a conversion is
+        attempted.
+
+    Returns
+    -------
+    number_of_dimensions : int
+        The number of dimensions in `a`.  Scalars are zero-dimensional.
+
+    See Also
+    --------
+    ndarray.ndim : equivalent method
+    shape : dimensions of array
+    ndarray.shape : dimensions of array
+
+    Availability
+    --------
+    Multiple GPUs, Multiple CPUs
+    """
+    return a.ndim
+
+
 @add_boilerplate("a")
 def shape(a: ndarray) -> NdShape:
     """


Test patch:
diff --git a/tests/integration/test_ndim.py b/tests/integration/test_ndim.py
new file mode 100644
--- /dev/null
+++ b/tests/integration/test_ndim.py
@@ -0,0 +1,40 @@
+# Copyright 2022 NVIDIA Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import numpy as np
+import pytest
+
+import cunumeric as num
+from legate.core import LEGATE_MAX_DIM
+
+
+@pytest.mark.parametrize("ndim", range(LEGATE_MAX_DIM + 1))
+def test_ndarray(ndim):
+    shape = (4,) * ndim
+    a = num.ones(shape)
+    a_np = np.array(a)
+
+    assert np.ndim(a_np) == num.ndim(a)
+
+
+@pytest.mark.parametrize("input", (42, [0, 1, 2], [[0, 1, 2], [3, 4, 5]]))
+def test_python_values(input):
+    assert np.ndim(input) == num.ndim(input)
+
+
+if __name__ == "__main__":
+    import sys
+
+    sys.exit(pytest.main(sys.argv))
Repository: nv-legate/cunumeric

Issue:
astype(bool) only considers 'real' part of complex number
The following minimal example fails:
```
    cnp = np.array([0+1j])
    c = num.array(cnp)
    assert cnp.astype(bool) == c.astype(bool)
```
cuNumeric ignores the imaginary and returns `False`


Discussion:

Resolving patch:
diff --git a/cunumeric/eager.py b/cunumeric/eager.py
--- a/cunumeric/eager.py
+++ b/cunumeric/eager.py
@@ -493,13 +493,7 @@ def convert(self, rhs: Any, warn: bool = True) -> None:
             if self.array.size == 1:
                 self.array.fill(rhs.array.item())
             else:
-                if (
-                    rhs.array.dtype.kind == "c"
-                    and self.array.dtype.kind != "c"
-                ):
-                    self.array[:] = rhs.array.real
-                else:
-                    self.array[:] = rhs.array
+                self.array[:] = rhs.array
 
     def fill(self, value: Any) -> None:
         if self.deferred is not None:


Test patch:
diff --git a/tests/integration/test_astype.py b/tests/integration/test_astype.py
new file mode 100644
--- /dev/null
+++ b/tests/integration/test_astype.py
@@ -0,0 +1,60 @@
+# Copyright 2022 NVIDIA Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import numpy as np
+import pytest
+
+import cunumeric as num
+
+TEST_VECTOR = [0, 0, 1, 2, 3, 0, 1, 2, 3]
+ALL_BUT_COMPLEX = ["?", "b", "h", "i", "l", "B", "H", "I", "L", "e", "f", "d"]
+ALL_TYPES = ALL_BUT_COMPLEX + ["F", "D"]
+
+
+def to_dtype(s):
+    return str(np.dtype(s))
+
+
+@pytest.mark.parametrize("src_dtype", ALL_BUT_COMPLEX, ids=to_dtype)
+@pytest.mark.parametrize("dst_dtype", ALL_TYPES, ids=to_dtype)
+def test_basic(src_dtype, dst_dtype):
+    in_np = np.array(TEST_VECTOR, dtype=src_dtype)
+    in_num = num.array(in_np)
+
+    out_np = in_np.astype(dst_dtype)
+    out_num = in_num.astype(dst_dtype)
+
+    assert np.array_equal(out_num, out_np)
+
+
+@pytest.mark.parametrize("src_dtype", ("F", "D"), ids=to_dtype)
+@pytest.mark.parametrize("dst_dtype", ALL_TYPES, ids=to_dtype)
+def test_complex(src_dtype, dst_dtype):
+    complex_input = [
+        complex(v1, v2) for v1, v2 in zip(TEST_VECTOR[:-1], TEST_VECTOR[1:])
+    ]
+    in_np = np.array(complex_input, dtype=src_dtype)
+    in_num = num.array(in_np)
+
+    out_np = in_np.astype(dst_dtype)
+    out_num = in_num.astype(dst_dtype)
+
+    assert np.array_equal(out_num, out_np)
+
+
+if __name__ == "__main__":
+    import sys
+
+    sys.exit(pytest.main(sys.argv))
Repository: nv-legate/cunumeric

Issue:
NumPy and cuNumeric behave differently in eye function with float k.
np.eye(5, k=0.0)
In Numpy, it raises TypeError: slice indices must be integers or None or have an __index__ method

cunumeric.eye(5, k=0.0)

In Cunumeric, it reports struct.error: required argument is not an integer
   cunumeric/coverage.py:110: in wrapper
       return func(*args, **kwargs)
   cunumeric/module.py:172: in eye
       result._thunk.eye(k)
   cunumeric/deferred.py:1637: in eye
       task.execute()
   ../install/lib/python3.8/site-packages/legate/core/operation.py:167: in execute
       self._context.runtime.submit(self)
   ../install/lib/python3.8/site-packages/legate/core/runtime.py:1083: in submit
       self.flush_scheduling_window()
   ../install/lib/python3.8/site-packages/legate/core/runtime.py:1076: in flush_scheduling_window
       self._schedule(ops)
   ../install/lib/python3.8/site-packages/legate/core/runtime.py:1069: in _schedule
       op.launch(strategy)
   ../install/lib/python3.8/site-packages/legate/core/operation.py:544: in launch
       result = launcher.execute_single()
   ../install/lib/python3.8/site-packages/legate/core/launcher.py:969: in execute_single
       result = self._context.dispatch_single(self.build_single_task(argbuf))
   ../install/lib/python3.8/site-packages/legate/core/launcher.py:937: in build_single_task
       argbuf.get_string(),
   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
   
       def get_string(self) -> Optional[bytes]:
           if self.string is None or self.arglen != len(self.args):
               fmtstr = "".join(self.fmt)
               assert len(fmtstr) == len(self.args) + 1
   >           self.string = struct.pack(fmtstr, *self.args)
   E           struct.error: required argument is not an integer
   
   ../install/lib/python3.8/site-packages/legate/core/_legion/util.py:407: error



Discussion:
Do we just need to check type of k in eye function in module.py? 

Resolving patch:
diff --git a/cunumeric/module.py b/cunumeric/module.py
--- a/cunumeric/module.py
+++ b/cunumeric/module.py
@@ -15,6 +15,7 @@
 from __future__ import annotations
 
 import math
+import operator
 import re
 from collections import Counter
 from itertools import chain
@@ -168,6 +169,7 @@ def eye(
         dtype = np.dtype(dtype)
     if M is None:
         M = N
+    k = operator.index(k)
     result = ndarray((N, M), dtype)
     result._thunk.eye(k)
     return result


Test patch:
Repository: nv-legate/cunumeric

Issue:
#604 caused many cases of test_square in test_eye.py to fail 
case-1
num.eye(5, k=1, dtype=np.float64)
np: 
    [[0. 1. 0. 0. 0.]
    [0. 0. 1. 0. 0.]
    [0. 0. 0. 1. 0.]
    [0. 0. 0. 0. 1.]
    [0. 0. 0. 0. 0.]]
cunumeric: 
    [[1. 1. 0. 0. 0.]
    [0. 1. 1. 0. 0.]
    [0. 0. 1. 1. 0.]
    [0. 0. 0. 1. 1.]
    [0. 0. 0. 0. 1.]]

case-2
num.eye(5, k=2, dtype=np.float64)
np: [[0. 0. 1. 0. 0.]
    [0. 0. 0. 1. 0.]
    [0. 0. 0. 0. 1.]
    [0. 0. 0. 0. 0.]
    [0. 0. 0. 0. 0.]]
   cunumeric: 
    [[0. 0. 1. 0. 0.]
    [1. 0. 0. 1. 0.]
    [0. 1. 0. 0. 1.]
    [0. 0. 1. 0. 0.]
    [0. 0. 0. 1. 0.]]


The failed case only happens on test_square
The failed cases also happens on dtype=np.int32 or None
The test k sequence here is [0, 1, -1, 2, -2]. k=1 and k=2 fail while k=-1 and k=-2 PASS.  
 If the test k sequence is [0, -1, 1, -2, 2], k=-1 and k=-2 would fail while k=1 and k=2 PASS. 
The failure is caused by https://github.com/nv-legate/cunumeric/commit/b04ca61226630b46889c5bf293e8db25e18d5aa3 in pull request #604  



Discussion:
@manopapad Please help to take a look. Thanks.

Resolving patch:
diff --git a/cunumeric/deferred.py b/cunumeric/deferred.py
--- a/cunumeric/deferred.py
+++ b/cunumeric/deferred.py
@@ -1666,7 +1666,16 @@ def eye(self, k: int) -> None:
         # First issue a fill to zero everything out
         self.fill(np.array(0, dtype=self.dtype))
 
+        # We need to add the store we're filling as an input as well, so we get
+        # read-write privileges rather than write-discard. That's because we
+        # cannot create tight region requirements that include just the
+        # diagonal, so necessarily there will be elements in the region whose
+        # values must be carried over from the previous contents. Write-discard
+        # privilege, then, is not appropriate for this call, as it essentially
+        # tells the runtime that it can throw away the previous contents of the
+        # entire region.
         task = self.context.create_auto_task(CuNumericOpCode.EYE)
+        task.add_input(self.base)
         task.add_output(self.base)
         task.add_scalar_arg(k, ty.int32)
 


Test patch: