From 200b0c40590d0ca7fb5d781f1bacc46a50b7e3c3 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 | 10 +++++----- redGrapes/scheduler/event.hpp | 8 ++++---- redGrapes/task/property/graph.hpp | 10 +++++----- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/redGrapes/resource/resource.hpp b/redGrapes/resource/resource.hpp index 347caddb..b7ec02a0 100644 --- a/redGrapes/resource/resource.hpp +++ b/redGrapes/resource/resource.hpp @@ -46,11 +46,11 @@ class ResourceBase static unsigned int generateID(); public: - unsigned int id; - unsigned int scope_level; - + ChunkedList< Task*, REDGRAPES_RUL_CHUNKSIZE > users; SpinLock users_mutex; - ChunkedList< Task* > users; + 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 3e8cc320..6a1cf35e 100644 --- a/redGrapes/resource/resource_user.hpp +++ b/redGrapes/resource/resource_user.hpp @@ -18,7 +18,7 @@ #include #include -//#include +#include namespace redGrapes { @@ -32,7 +32,7 @@ struct ResourceAccess; struct ResourceUsageEntry { std::shared_ptr< ResourceBase > resource; - typename ChunkedList< Task* >::MutBackwardIterator task_entry; + typename ChunkedList< Task*, REDGRAPES_RUL_CHUNKSIZE >::MutBackwardIterator task_entry; bool operator==( ResourceUsageEntry const & other ) const; }; @@ -52,10 +52,10 @@ class ResourceUser 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; - 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 86e7e90a..0fc9dba1 100644 --- a/redGrapes/scheduler/event.hpp +++ b/redGrapes/scheduler/event.hpp @@ -90,17 +90,17 @@ struct EventPtr */ struct Event { + //! the set of subsequent events + ChunkedList< EventPtr, REDGRAPES_EVENT_FOLLOWER_LIST_CHUNKSIZE > followers; + /*! number of incoming edges * state == 0: event is reached and can be removed */ - std::atomic_uint16_t state; + std::atomic< uint16_t > state; //! waker that is waiting for this event WakerId waker_id; - //! the set of subsequent events - ChunkedList< EventPtr > followers; - Event(); Event(Event &); Event(Event &&); diff --git a/redGrapes/task/property/graph.hpp b/redGrapes/task/property/graph.hpp index 11fcf86c..c11447ec 100644 --- a/redGrapes/task/property/graph.hpp +++ b/redGrapes/task/property/graph.hpp @@ -57,11 +57,6 @@ struct GraphProperty return task; } - Task * task; - - //! number of parents - uint8_t scope_depth; - //! task space that contains this task, must not be null memory::Refcounted< TaskSpace, TaskSpaceDeleter >::Guard space; @@ -81,6 +76,11 @@ struct GraphProperty 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 };