Skip to content

Commit

Permalink
reordering of struct members for better packing
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsippel committed Dec 7, 2023
1 parent 35d7229 commit 200b0c4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions redGrapes/resource/resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions redGrapes/resource/resource_user.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <redGrapes/util/chunked_list.hpp>
#include <redGrapes/util/trace.hpp>

//#include <redGrapes/resource/resource.hpp>
#include <redGrapes/resource/resource.hpp>

namespace redGrapes
{
Expand All @@ -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;
};
Expand All @@ -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<ResourceAccess, 8> access_list;
ChunkedList<ResourceUsageEntry, 8> unique_resources;

ChunkedList<ResourceAccess> access_list;
ChunkedList<ResourceUsageEntry> unique_resources;
uint8_t scope_level;
}; // class ResourceUser

} // namespace redGrapes
Expand Down
8 changes: 4 additions & 4 deletions redGrapes/scheduler/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&);
Expand Down
10 changes: 5 additions & 5 deletions redGrapes/task/property/graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 };
Expand Down

0 comments on commit 200b0c4

Please sign in to comment.