You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While implementing a basic piece of software, I found that I should call the global setup handler only once per core and not once per thread. Therefore, I thought of the following approach:
Global setup handler: called once per core (used for global initialization)
Local setup handler: called once per thread (used for thread-local initialization)
Thread code: called in a loop in each thread (actual code)
To implement this, I need a way to run the global setup in one thread and prevent others from running. Unfortunately, since there is no guarantee about memory contents, I couldn't find a way to make one thread execute the global handler and other threads to wait for it (there is no guarantee about timing between threads, so I can't initialize some flag in memory and be sure that it will happen before other threads reach it).
To make it work, I have the following hardware change in mind:
On reset, only thread 0 starts running (others are waiting)
Software initializes whatever is needed to synchronize execution with thread 0
Software wakes up other threads
Software runs global initialization only on thread 0 and other threads wait for it to continue
Software lets other threads run
I haven't thought the details of how synchronization is going to happen, but here are some options:
Use some word in memory (thread 0 initializes to zero, other threads wait until it's non-zero. Thread 0 writes 1 when done)
Wake up others only after global init is done
The disadvantage of this approach is that resetting one thread may become a problem (because it may no longer be possible to initialize the core properly)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
While implementing a basic piece of software, I found that I should call the global setup handler only once per core and not once per thread. Therefore, I thought of the following approach:
To implement this, I need a way to run the global setup in one thread and prevent others from running. Unfortunately, since there is no guarantee about memory contents, I couldn't find a way to make one thread execute the global handler and other threads to wait for it (there is no guarantee about timing between threads, so I can't initialize some flag in memory and be sure that it will happen before other threads reach it).
To make it work, I have the following hardware change in mind:
I haven't thought the details of how synchronization is going to happen, but here are some options:
The disadvantage of this approach is that resetting one thread may become a problem (because it may no longer be possible to initialize the core properly)
Beta Was this translation helpful? Give feedback.
All reactions