Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yet more atomics & cache-line fixes on work-stealing queue #53424

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/work-stealing-queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#ifndef WORK_STEALING_QUEUE_H
#define WORK_STEALING_QUEUE_H

#include <stdalign.h>

#include "julia_atomics.h"
#include "assert.h"

Expand Down Expand Up @@ -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
Expand Down