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 Feb 1, 2024
1 parent 299a6e6 commit 3f18e5c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions redGrapes/resource/resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ namespace redGrapes
static unsigned int generateID();

public:
unsigned int id;
unsigned int scope_level;

SpinLock users_mutex;
ChunkedList<Task*, REDGRAPES_RUL_CHUNKSIZE> users;
SpinLock users_mutex;

uint16_t id;
uint8_t scope_level;

/**
* Create a new resource with an unused ID.
Expand Down
4 changes: 2 additions & 2 deletions redGrapes/resource/resource_user.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ResourceAccess, 8> access_list;
ChunkedList<ResourceUsageEntry, 8> 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 @@ -92,17 +92,17 @@ namespace redGrapes
*/
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, REDGRAPES_EVENT_FOLLOWER_LIST_CHUNKSIZE> 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 @@ -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<TaskSpace, TaskSpaceDeleter>::Guard space;

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

0 comments on commit 3f18e5c

Please sign in to comment.