Skip to content

Commit

Permalink
gemm: request 8-byte buffer alignment on macos
Browse files Browse the repository at this point in the history
A user showed that in certain configurations on macos, the TLS allocation can
even be 8-byte aligned.
  • Loading branch information
bluss committed Sep 20, 2023
1 parent d6aef69 commit d960917
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/gemm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,10 @@ const MASK_BUF_SIZE: usize = KERNEL_MAX_SIZE + KERNEL_MAX_ALIGN - 1;

// Pointers into buffer will be manually aligned anyway, due to
// bugs we have seen on certain platforms (macos) that look like
// we don't get more than 16-aligned allocations out of TLS
// we don't get aligned allocations out of TLS - 16- and 8-byte
// allocations have been seen, make the minimal align request we can.
#[cfg_attr(not(target_os = "macos"), repr(align(32)))]
#[cfg_attr(target_os = "macos", repr(align(16)))]
#[cfg_attr(target_os = "macos", repr(align(8)))]
struct MaskBuffer {
buffer: [u8; MASK_BUF_SIZE],
}
Expand Down

0 comments on commit d960917

Please sign in to comment.