From 3f18e5c13fbb31b96faea20ba64c0be7c81305eb Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Wed, 6 Dec 2023 22:57:00 +0100 Subject: [PATCH] reordering of struct members for better packing --- redGrapes/resource/resource.hpp | 8 ++++---- redGrapes/resource/resource_user.hpp | 4 ++-- redGrapes/scheduler/event.hpp | 8 ++++---- redGrapes/task/property/graph.hpp | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/redGrapes/resource/resource.hpp b/redGrapes/resource/resource.hpp index 52b23265..289b879c 100644 --- a/redGrapes/resource/resource.hpp +++ b/redGrapes/resource/resource.hpp @@ -47,11 +47,11 @@ namespace redGrapes static unsigned int generateID(); public: - unsigned int id; - unsigned int scope_level; - - SpinLock users_mutex; ChunkedList users; + SpinLock users_mutex; + + uint16_t id; + uint8_t scope_level; /** * Create a new resource with an unused ID. diff --git a/redGrapes/resource/resource_user.hpp b/redGrapes/resource/resource_user.hpp index 3edf6082..67b1ce6f 100644 --- a/redGrapes/resource/resource_user.hpp +++ b/redGrapes/resource/resource_user.hpp @@ -51,10 +51,10 @@ namespace redGrapes static bool is_superset(ResourceUser const& a, ResourceUser const& b); static bool is_serial(ResourceUser const& a, ResourceUser const& b); - uint8_t scope_level; - ChunkedList access_list; ChunkedList unique_resources; + + uint8_t scope_level; }; // class ResourceUser } // namespace redGrapes diff --git a/redGrapes/scheduler/event.hpp b/redGrapes/scheduler/event.hpp index 838b6ec5..05125963 100644 --- a/redGrapes/scheduler/event.hpp +++ b/redGrapes/scheduler/event.hpp @@ -92,17 +92,17 @@ namespace redGrapes */ struct Event { + //! the set of subsequent events + ChunkedList followers; + /*! number of incoming edges * state == 0: event is reached and can be removed */ - std::atomic_uint16_t state; + std::atomic state; //! waker that is waiting for this event WakerId waker_id; - //! the set of subsequent events - ChunkedList followers; - Event(); Event(Event&); Event(Event&&); diff --git a/redGrapes/task/property/graph.hpp b/redGrapes/task/property/graph.hpp index 055e0b08..c0fe4614 100644 --- a/redGrapes/task/property/graph.hpp +++ b/redGrapes/task/property/graph.hpp @@ -53,11 +53,6 @@ namespace redGrapes return task; } - Task* task; - - //! number of parents - uint8_t scope_depth; - //! task space that contains this task, must not be null memory::Refcounted::Guard space; @@ -77,6 +72,11 @@ namespace redGrapes scheduler::Event result_set_event; scheduler::Event result_get_event; + Task* task; + + //! number of parents + uint8_t scope_depth; + inline scheduler::EventPtr get_pre_event() { return scheduler::EventPtr{nullptr, this->task, scheduler::T_EVT_PRE};