From 034e0700f25c0e2601ed797a5276cdb74082b44c Mon Sep 17 00:00:00 2001 From: Diogo Netto Date: Thu, 22 Feb 2024 02:31:41 +0000 Subject: [PATCH] yet more atomics & cache-line fixes on work-stealing queue --- src/work-stealing-queue.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/work-stealing-queue.h b/src/work-stealing-queue.h index 5902c2ac6af9f..c444ccb3da682 100644 --- a/src/work-stealing-queue.h +++ b/src/work-stealing-queue.h @@ -3,6 +3,8 @@ #ifndef WORK_STEALING_QUEUE_H #define WORK_STEALING_QUEUE_H +#include + #include "julia_atomics.h" #include "assert.h" @@ -35,10 +37,10 @@ static inline ws_array_t *create_ws_array(size_t capacity, int32_t eltsz) JL_NOT } typedef struct { - _Atomic(int64_t) top; - char _padding[JL_CACHE_BYTE_ALIGNMENT - sizeof(_Atomic(int64_t))]; - _Atomic(int64_t) bottom; // put on a separate cache line. conservatively estimate cache line size as 128 bytes - _Atomic(ws_array_t *) array; + // align to JL_CACHE_BYTE_ALIGNMENT + alignas(JL_CACHE_BYTE_ALIGNMENT) _Atomic(int64_t) top; + alignas(JL_CACHE_BYTE_ALIGNMENT) _Atomic(int64_t) bottom; + alignas(JL_CACHE_BYTE_ALIGNMENT) _Atomic(ws_array_t *) array; } ws_queue_t; static inline ws_array_t *ws_queue_push(ws_queue_t *q, void *elt, int32_t eltsz) JL_NOTSAFEPOINT