summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2016-09-05 20:56:09 +0200
committerPauli Virtanen <pav@iki.fi>2017-01-19 22:12:47 +0100
commit7fb8e6b26e20d35480bbb7c31f53d9f9679d2659 (patch)
treeccaf7c8b4281f9de070f56986be56911dca1b8d5
parente23549899878c433edfde4fdb5f83ae34c3b3dff (diff)
downloadnumpy-7fb8e6b26e20d35480bbb7c31f53d9f9679d2659.tar.gz
ENH: umath: turn on overlap detection + copying in ufunc basic calls
After this commit, all code paths in PyUFunc_GeneralizedFunction and PyUFunc_GenericFunction perform input/output operand memory overlap detection, and make copies to eliminate it.
-rw-r--r--numpy/core/src/umath/ufunc_object.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index 61e0567ac..6bd162f5b 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -1440,7 +1440,8 @@ iterator_loop(PyUFuncObject *ufunc,
NPY_ITER_ZEROSIZE_OK |
NPY_ITER_BUFFERED |
NPY_ITER_GROWINNER |
- NPY_ITER_DELAY_BUFALLOC;
+ NPY_ITER_DELAY_BUFALLOC |
+ NPY_ITER_COPY_IF_OVERLAP;
/*
* Allocate the iterator. Because the types of the inputs
@@ -1755,7 +1756,8 @@ execute_fancy_ufunc_loop(PyUFuncObject *ufunc,
NPY_ITER_REFS_OK |
NPY_ITER_ZEROSIZE_OK |
NPY_ITER_BUFFERED |
- NPY_ITER_GROWINNER;
+ NPY_ITER_GROWINNER |
+ NPY_ITER_COPY_IF_OVERLAP;
/*
* Allocate the iterator. Because the types of the inputs
@@ -2294,7 +2296,8 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *ufunc,
NPY_ITER_MULTI_INDEX |
NPY_ITER_REFS_OK |
NPY_ITER_REDUCE_OK |
- NPY_ITER_ZEROSIZE_OK;
+ NPY_ITER_ZEROSIZE_OK |
+ NPY_ITER_COPY_IF_OVERLAP;
/* Create the iterator */
iter = NpyIter_AdvancedNew(nop, op, iter_flags,