[Numpy-svn] [numpy/numpy] c9bf9b: ENH: properly fix unaligned load of complex types

GitHub noreply@github....
Tue Jun 11 17:50:27 CDT 2013


  Branch: refs/heads/master
  Home:   https://github.com/numpy/numpy
  Commit: c9bf9b0b1c8a85391695d4ded39921e98c63257d
      https://github.com/numpy/numpy/commit/c9bf9b0b1c8a85391695d4ded39921e98c63257d
  Author: Julian Taylor <jtaylor.debian@googlemail.com>
  Date:   2013-06-10 (Mon, 10 Jun 2013)

  Changed paths:
    M numpy/core/src/multiarray/arraytypes.c.src
    M numpy/core/src/multiarray/dtype_transfer.c

  Log Message:
  -----------
  ENH: properly fix unaligned load of complex types

the workaround of setting the aligned to false unconditionally makes
copying strided complex data extremely slow as it will always do
unaligned elementwise memmoves.
Instead set the alignment requirement for complex types correct in the
dtype to begin with.

Note that on 32 bit gcc complex double will still be aligned to 8 bytes
unless compiled with -malign-double.

It is possible this will introduce new segfaults on architectures
without unaligned loads, but this now indicates a missing alignment
check in the affected code as the array description is correct.


  Commit: aef286debfd11a62f1c337dea55624cee7fd4d9e
      https://github.com/numpy/numpy/commit/aef286debfd11a62f1c337dea55624cee7fd4d9e
  Author: Julian Taylor <jtaylor.debian@googlemail.com>
  Date:   2013-06-10 (Mon, 10 Jun 2013)

  Changed paths:
    M numpy/core/src/multiarray/lowlevel_strided_loops.c.src

  Log Message:
  -----------
  ENH: enable unaligned loads on x86

x86 can handle unaligned load and there is no hand vectorized code in
this file. It would be a serious compiler bug if it adds vectorization
without checking for alignment.
Enables fast complex128 copies which are unaligned on 32 bit gcc unless
compiled with -malign-double.


  Commit: e2dd429afc204bc60e2db0f6ad4fb706ab93c273
      https://github.com/numpy/numpy/commit/e2dd429afc204bc60e2db0f6ad4fb706ab93c273
  Author: Julian Taylor <jtaylor.debian@googlemail.com>
  Date:   2013-06-11 (Tue, 11 Jun 2013)

  Changed paths:
    M numpy/core/src/multiarray/lowlevel_strided_loops.c.src

  Log Message:
  -----------
  BUG: fix non-swapping strided copies in GetStridedCopySwap

Fixed PyArray_GetStridedCopySwap{Pair,}Fn returns paths that do not swap
the data.
It never triggered because the alignment requirement for complex data
was too low (4-8 bytes) and always fullfiled by the memory allocator.
As this is now fixed it caused failures on sparc with 16 byte long
doubles.


  Commit: d4b4ff038d536500e4bfd16f164d88a1a99f5ac3
      https://github.com/numpy/numpy/commit/d4b4ff038d536500e4bfd16f164d88a1a99f5ac3
  Author: Charles Harris <charlesr.harris@gmail.com>
  Date:   2013-06-11 (Tue, 11 Jun 2013)

  Changed paths:
    M numpy/core/src/multiarray/arraytypes.c.src
    M numpy/core/src/multiarray/dtype_transfer.c
    M numpy/core/src/multiarray/lowlevel_strided_loops.c.src

  Log Message:
  -----------
  Merge pull request #3421 from juliantaylor/complex-copy

Poor performance complex strided copies since 1.7


Compare: https://github.com/numpy/numpy/compare/d0f505004892...d4b4ff038d53


More information about the Numpy-svn mailing list