-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copying a slice to another slice in the same array fails silently #16
Comments
Here's another variation on this problem that we need to handle:
Requires a destination indirect (scatter) copy with an additional transform indirection on the source. |
The problem here is that we are missing a translation from NumPy (local) index space (i.e. every view's indices start from 0) to Legion (global) index space (i.e. every view's indices start wherever that view is placed within the base array) when emitting a scatter copy. The most general case of this pattern (writing through an advanced view) also includes a view on the LHS:
I believe the best way to handle this case is to set up a full scatter-gather copy as follows: The work on StanfordLegion/legion#705 would allow us to avoid materializing an explicit field for (1). |
Hi, is it possible to raise a Actually, even in the last step of the 12-step to CFD (the one used in GTC presentation), we also have this type of copying in Another example is the code shown in issue #29. |
Yes, I meant to tackle this properly after fixing #12, but that's taking longer than expected. I will add some error messages as a stopgap. |
As of b997647 the original testcase should be working. The case of overlapping sub-arrays is not working, but we will emit an error message about it. We also detect cases where a copy requires two indirections on a dimension, and error out. |
My last change uncovered that some of our tests are doing copies between overlapping sub-arrays, reverting until I can fix those. |
Yes, I confirm the original test case is working now. Thanks! |
removed mitigator to nv-legate/cunumeric#16: resolved
* Convolve implementation * Bump the Legate core commit
Bug report due to @piyueh
The following code, when run with
-lg:numpy:test
, prints[False]
, indicating that the slice has not been updated:After some digging I found that we skip copies between sub-regions if they're backed by the same field, which is actually only safe if the slices are equivalent: https://github.com/nv-legate/legate.numpy/blob/2b460c5dfdd60b673e37e25231bf625fdf3ead0e/legate/numpy/deferred.py#L101-L105
If we simply skip this check then the copy ends up happening through a CopyTask, which works with subregions of the same base region.
However, the runtime errors out if the two slices overlap, e.g. if we do
a[0,0:2] = a[0,1:3]
(vanilla NumPy accepts this, and does the expected thing). We should at least check for overlaps in python and produce a reasonable error message.We also want to add a case for this to the test suite.
The text was updated successfully, but these errors were encountered: