File tree Expand file tree Collapse file tree 5 files changed +22
-2
lines changed Expand file tree Collapse file tree 5 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ This issue fixes several bugs that were still found in 1.9.2.
53
53
* Fix back-to-front sorting when gl-coordinate-system is changed
54
54
* Now also compiles on older Linux distros (eg. CentOS 5 / manylinux1)
55
55
* get_keyboard_map now includes keys on layouts with special characters
56
+ * Fix crash due to incorrect alignment when compiling Eigen with AVX
56
57
57
58
------------------------ RELEASE 1.9.2 ------------------------
58
59
Original file line number Diff line number Diff line change @@ -105,7 +105,11 @@ class EXPCL_DTOOL DeletedBufferChain {
105
105
106
106
#elif defined(LINMATH_ALIGN)
107
107
// With SSE2 alignment, we need all 16 bytes to preserve alignment.
108
+ #ifdef __AVX__
109
+ static const size_t flag_reserved_bytes = 32 ;
110
+ #else
108
111
static const size_t flag_reserved_bytes = 16 ;
112
+ #endif
109
113
110
114
#else
111
115
// Otherwise, we only need enough space for the Integer itself.
Original file line number Diff line number Diff line change @@ -453,8 +453,13 @@ DEFAULT_MMAP_THRESHOLD default: 256K
453
453
// drose: We require 16-byte alignment of certain structures, to
454
454
// support SSE2. We don't strictly have to align *everything*, but
455
455
// it's just easier to do so.
456
+ #ifdef __AVX__
457
+ // Eigen requires 32-byte alignment when using AVX instructions.
458
+ #define MALLOC_ALIGNMENT ((size_t )32U )
459
+ #else
456
460
#define MALLOC_ALIGNMENT ((size_t )16U )
457
461
#endif
462
+ #endif
458
463
459
464
#ifndef WIN32
460
465
#ifdef _WIN32
Original file line number Diff line number Diff line change 372
372
// enforce alignment externally.
373
373
#define MEMORY_HOOK_DO_ALIGN 1
374
374
375
- #elif defined(IS_OSX ) || defined(_WIN64 )
375
+ #elif ( defined(IS_OSX ) || defined(_WIN64 )) && !defined( __AVX__ )
376
376
// The OS-provided malloc implementation will do the required
377
377
// alignment.
378
378
#undef MEMORY_HOOK_DO_ALIGN
Original file line number Diff line number Diff line change @@ -55,7 +55,12 @@ get_memory_alignment() {
55
55
// We require 16-byte alignment of certain structures, to support
56
56
// SSE2. We don't strictly have to align *everything*, but it's just
57
57
// easier to do so.
58
+ #ifdef __AVX__
59
+ // Eigen requires 32-byte alignment when using AVX instructions.
60
+ const size_t alignment_size = 32 ;
61
+ #else
58
62
const size_t alignment_size = 16 ;
63
+ #endif
59
64
#else
60
65
// Otherwise, use word alignment.
61
66
const size_t alignment_size = sizeof (void *);
@@ -79,7 +84,12 @@ get_header_reserved_bytes() {
79
84
#ifdef LINMATH_ALIGN
80
85
// If we're doing SSE2 alignment, we must reserve a full 16-byte
81
86
// block, since anything less than that will spoil the alignment.
82
- static const size_t header_reserved_bytes = 16 ;
87
+ #ifdef __AVX__
88
+ // Eigen requires 32-byte alignment when using AVX instructions.
89
+ const size_t header_reserved_bytes = 32 ;
90
+ #else
91
+ const size_t header_reserved_bytes = 16 ;
92
+ #endif
83
93
84
94
#elif defined(MEMORY_HOOK_DO_ALIGN)
85
95
// If we're just aligning to words, we reserve a block as big as two
You can’t perform that action at this time.
0 commit comments